怎样自动生成用户名,密码???

jiangjiewebsky 2003-10-10 12:58:50
一个录入框,输入一个开头字。如t
然后提交生成。
就会有1000个。如。user:t1 pwd:3432w
user:t2 pwd:dk309
.......
密码是随机生成。把这些信息写到数据库里面。这个怎么实现 。
...全文
384 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
cdsun 2003-10-10
  • 打赏
  • 举报
回复
楼上的

你的类型不匹配把数据库字段属性修改一下就可以了

其它的部分我也学习
jiangjiewebsky 2003-10-10
  • 打赏
  • 举报
回复

<% Function gen_key(digits)
dim char_array(35)
char_array(0) = "0"
char_array(1) = "1"
char_array(2) = "2"
char_array(3) = "3"
char_array(4) = "4"
char_array(5) = "5"
char_array(6) = "6"
char_array(7) = "7"
char_array(8) = "8"
char_array(9) = "9"
char_array(10) = "A"
char_array(11) = "B"
char_array(12) = "C"
char_array(13) = "D"
char_array(14) = "E"
char_array(15) = "F"
char_array(16) = "G"
char_array(17) = "H"
char_array(18) = "I"
char_array(19) = "J"
char_array(20) = "K"
char_array(21) = "L"
char_array(22) = "M"
char_array(23) = "N"
char_array(24) = "O"
char_array(25) = "P"
char_array(26) = "Q"
char_array(27) = "R"
char_array(28) = "S"
char_array(29) = "T"
char_array(30) = "U"
char_array(31) = "V"
char_array(32) = "W"
char_array(33) = "X"
char_array(34) = "Y"
char_array(35) = "Z"
randomize
do while len(output) < digits
num = char_array(Int(35 * Rnd + 0))
output = output + num
loop
gen_key = output
End Function

userstart=request("userstart")
point=request("point")
num=cint(trim(request("num")))

if num>1000 then
response.write "<script>alert('用户超过1000了');history.back(-1);</script>"
response.end
end if
dim pwd(1000),user(1000)
for j=1 to num
p=0
p=p+j
user(j)=userstart&p
next
for i=1 to num
pwd(i)=gen_key(5)
next
for k=1 to num
response.write user(k)&"<br>"
response.write pwd(k)&"<br>"
next

%>
但总是提示:
Microsoft VBScript 运行时错误 错误 '800a000d'

类型不匹配: 'num'

/mov/manage/douser.asp,行65
yangsm 2003-10-10
  • 打赏
  • 举报
回复
用户名把它做成一个循环就可以了吗,再把它存到数据库里就行了。但随机密码不知道怎么实现。UP一下了!
rexsp 2003-10-10
  • 打赏
  • 举报
回复
这是我N久前写的一个BQQ的自动注册程序
密码是随机生成的,账号是规律数字
你可以稍微改改
rexsp 2003-10-10
  • 打赏
  • 举报
回复
<%
if request("action")="select" then
StudentNum=request.form("StudentNum")
if studentnum="" then
response.write "<script>alert('请填写你的学号,我的兄弟姐妹!');location.href='index.asp?'</script>"
response.end
elseif not IsNumeric(studentNum) then
response.write "<script>alert('学号居然不是数字,个性!');location.href='index.asp?'</script>"
response.end
elseif len(studentNum)<>9 and len(studentNum)<>6 and len(studentNum)<>8 then
response.write "<script>alert('你的学号真特别,跟别人的不一样长!');location.href='index.asp?'</script>"
response.end
elseif int(left(studentNum,2))<>99 and int(left(studentNum,2))<>00 and int(left(studentNum,2))<>01 and int(left(studentNum,2))<>02 then
response.write "<script>alert('你的学号还真特别,明显是假的嘛,莫非你已经毕业N年?!');location.href='index.asp?'</script>"
response.end
end if%>
<tr><td><%Selected(StudentNum)%></td></tr>
<%elseif request("action")="probqq" then
first=request.form("first")
num=request.form("num")
if first="" or num="" then
response.write "<tr><td align=middle>信息填写不完整</td></tr>"
else

call ProBqqNum(first,num)
end if
else%>
<tr><td align=middle> <form name="form1" method="post" action="index.asp?action=select">
<input name="StudentNum" type="text" id="StudentNum" size=10>
<input type="submit" name="Submit" value="生成号码">
</form></td></tr>

<%end if
if session("loginok")=true then%>
<tr> <td class="biaoti" align=center>

<%set rs=conn.execute("select max(bqqnum) from bqquser")
if rs.eof then
firstf=2001
else
firstf=rs(0)
end if
rs.close
set rs=nothing%>
<form name="form33" method="post" action="index.asp?action=probqq">
起始号: <input name="first" type="text" size=10 readonly value=<%=firstf%> >
数量:<input name="num" type="text" size=10 >
<input type="submit" name="Submit" value="生成号码"></form>
</td>
</tr>
<%end if%>



<%if request("action")="login" then%>
<form name="form2" method="post" action="index.asp?action=check">
<tr>
<td class="biaoti" align=center><font color="#003333">
管理账号: <input name="username" type="text" size=10>
密码:<input name="password" type="password" size=10 >
<input type="submit" name="Submit" value="登陆管理">
</td>
</tr>
</form>
<%end if%>

<tr>
<td height="100" align="center" valign="bottom" class="biaoti">   <font color="#FFFF00"> 为了使大家充分合理有效的利用网络资源,请您不要一个人占用多个号码,另请登陆后即刻修改资料,我们过一段时间后将没有任何资料的号码回收!</font></td>
</tr>
</table>

</td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#FFFFFF" class="font12"><font color="#0099CC">CopyRight
© 2002-2003 All Rights Reserved 学生之友 Designed By 网络部</font></td>
</tr>
</table>
</body>
</html>
<%

'号码选择
function Selected(studentnum)
set rs=conn.execute("select id from bqquser where StudentNum='"&StudentNum&"'")
if rs.eof then
Set rs1 = Server.CreateObject("ADODB.Recordset")
sql1="select bqqnum,password,studentnum,selected,pass,addtime from bqquser where selected=0 order by id"
rs1.Open sql1,conn,1,3
Randomize
for i=0 to Int((rs1.recordcount)*Rnd +0)
rs1.movenext
next
bqq=rs1(0)
password=rs1(1)
rs1(2)=studentnum
rs1(3)=true
rs1(4)=false
rs1(5)=now()
rs1.update
response.write "<center>"&StudentNum&",你的BQQ号码已经生成,号码:"&Bqq&"  密码:"&Password&"<br><font color=blue>请持本人学生证到学生之友网站办公室(研究生东馆一楼)开通此号,号码开通后请第一时间更改密码</font><br><a href='javascript:history.back();'>返回</a></center>"

rs1.close
set rs1=nothing
else
response.write "<script>alert('此学生证号已经被注册!');location.href='index.asp?'</script>"
end if
rs.close
set rs=nothing
end function
function ProBqqNum(first,num)

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from bqquser"
rs.Open sql,conn,1,3

for i=first to int(first)+int(num)-1
rs.addnew
rs("bqqnum")=i
rs("password")=PasswordPro()
rs("selected")=false
rs.update
next
rs.close
set rs=nothing
response.write "<tr><td align=center>号码生成成功,号码范围:"&first&"--"&int(first)+int(num)&"</td></tr>"
end function



Function PasswordPro()
Dim stringc,stringlist,stringnum,i,stringnum2
randomize timer
stringc="0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
stringlist=split(stringc,",")
for i=0 to 35
stringnum=Int((35)*Rnd +0)
PasswordPro=PasswordPro&stringlist(stringnum)
next
stringnum2=Int((29)*Rnd +1)
PasswordPro=mid(PasswordPro,stringnum2,5)
end Function


%>
Jaron 2003-10-10
  • 打赏
  • 举报
回复
写进数据库的部分你自已搞定吧,呵呵。
<%
for i=1 to 1000
response.write "用户名:t" & i
response.write "口令:" & makepassword(8) '生成8位密码
response.write "<br>"
next

Function makePassword(ByVal maxLen) '生成随机密码
Dim strNewPass
Dim whatsNext, upper, lower, intCounter
Randomize
For intCounter = 1 To maxLen
whatsNext = Int((1 - 0 + 1) * Rnd + 0)
If whatsNext = 0 Then
'character
upper = 90
lower = 65
Else
upper = 57
lower = 48
End If
strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + lower))
Next
makePassword = strNewPass
End Function
%>
rexsp 2003-10-10
  • 打赏
  • 举报
回复
<!--#include file="Conn.asp"-->
<%

'退出注销
if request("action")="loginout" then
session("loginok")=false
end if
'登陆管理
if request("action")="check" then
username=request.form("username")
password=request.form("password")
set rs=conn.execute("select password from admin where username='"&username&"'")
if rs.eof then
session("loginok")=false
response.write "<script>alert('你以为你是谁啊??走错地方了吧?!');location.href='index.asp?'</script>"
else
if rs(0)=password then
session("loginok")=true
else
session("loginok")=false
end if
end if
rs.close
set rs=nothing
end if%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Bqq管理</title>
<link href="bqq.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="3">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#003366">
<tr>
<td height="20" align="center" bgcolor="#0099CC" class="font12"><a href="http://202.117.83.12/xsc">首页</a>
| <a href="http://202.117.83.12/xsc/news">新闻中心</a> | <a href="http://202.117.83.12/xsc/film/">视听世界</a>
| <a href="http://202.117.83.12/xsc/czmail/">处长信箱</a> | <a href="http://202.117.83.12/xsc/xyfc/">校园风采</a>
| <a href="http://202.117.89.119/">免费主页</a> | <a href="http://202.117.83.12/xsc/xsc/xlzxzx.htm">学生处</a>
| <a href="http://202.117.83.12/xsc/soft/">软件下载</a> | <a href="http://202.117.83.12/xsc/view/index.asp">学生视点</a>|
<a href="http://202.117.83.12/xsc/flea">跳蚤市场</a> | <a href="http://202.117.83.12/xsc/yxxsgz/">院系主页</a>
| <a href="http://202.117.83.12/xsc/gf/">国防风景</a></td>
</tr>
<tr>
<td bgcolor="#0099CC"><img src="pic/banner.gif" width="760" height="80"></td>
</tr>
<tr>
<td height="20" align="center" bgcolor="#0099CC" class="font12"><a href="index.htm">学校内部使用说明</a><img src="pic/space.gif" width="100" height="8"><a href="campus.htm">网站内部使用说明</a><img src="pic/space.gif" width="100" height="1"><a href="about.htm">使用说明及常见问题</a> <%if request("action")="login" then%> <a href='index.asp?'>隐藏登陆</a> <%else%><a href='index.asp?action=login'>显示登陆</a><%end if%>  <%if session("loginok")=true then%><a href="view.asp">号码管理</a> <a href="index.asp?action=loginout">退出</a><%end if%></td>
</tr>
<tr>
<td height="400" align="center" valign="top" bgcolor="#0099CC">
<table width="600" border="0" cellpadding="3" cellspacing="0">
<tr>
<td height="10"><img src="pic/space.gif" width="400" height="10"></td>
</tr>
<tr>
<td height="50" align="center" class="biaoti">管理说明</td>
</tr>
<tr>
<td class="zw">    为了建立崭新的校园沟通平台,丰富校园网络生活,增加大家之间的信息交流,同时也使广大工大同学对我们学生之友网站有更加深入的了解,网站特地对各校园网络用户分配了首批BQQ测试号码,现测试工作已经结束。<br>
    客户端下载地址 <a href="http://202.117.83.12/xsc/bqq.exe">http://202.117.83.12/xsc/bqq.exe</a>
或者登录腾讯网站下载。<br>
    服务器地址 <font color="#FFFF00">202.117.89.119</font>
具体使用请看<a href="about.htm">使用说明及常见问题</a></td>
</tr>
<tr>
<td class="zw">   学生之友决定发放第二批号码,为了避免一个人占用几个号的现象。现先由网络生成号码,后采用学生证(须本人原件)派放号码,请大家将此消息告诉身边同学,另第一批领到号的同学请将你的学生证号码发到学生之友专用客服号码:8888。否则,号码将被强制回收!现在开通网上注册服务,注册号码和密码随机生成,但<font color=blue>须持学生证到学生学生之友网站办公室(研究生东馆一楼)验证后开通号码服务(时间:每日21:00-22:00),号码开通后请第一时间更改密码</font>!<br>   PS:如果有团体批量需求,请直接到学生之友办理!
</td>
</tr>
不老书生 2003-10-10
  • 打赏
  • 举报
回复
for i=1 to 1000
name="t"&i 产生规律名单
pass=INT(256*RND) '产生随即密码
sql="insert into。。。。"
conn.execute sql

next

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧