热门资讯更多>>
- 05-03[网站建设]关于IE6下绝对定位…
- 11-23[网站建设]jquery 做TABS切换…
- 02-13[网站建设]——dopostback缺…
- 07-14[网站优化]如何修改网站标题…
- 11-13[网站建设]SQLSERVER2005 数…
- 09-25[网站建设]屏蔽 Flash 右键的…
- 03-13[网站建设]Windows+ IIS 的手…
- 03-22[网站建设]谈谈如何利用网络…
- 03-04[网站建设]magento整合WORDP…
- 02-07[网站建设]MSSQL备份移植到另…
批量修改SERVU用户密码的asp源代码
由于工作需要自己写的批量修改servu用户密码为8位随机程序代码。md5程序请自己从网上搜索!转载请保留出处,谢谢!
<%set fso=CreateObject("Scripting.FileSystemObject")
Set f1=fso.openTextFile(Server.mappath("111.txt"),1) ''111.txt需要修改的配置文件
Set f2=fso.createTextFile(Server.mappath("222.txt"),true) ''222.txt修改后的配置文件
do while not f1.atEndOfStream
fread=f1.readline
if instr(fread,"[USER=")>0 then
user=replace(fread,"[USER=","")
user=replace(user,"|1]","")
response.Write("用户名:"&user)
elseif instr(fread,"Password=")>0 and instr(fread,"LocalSetupPassword")<1 then
pwd=getradpassword()
response.Write(" 密码:"&pwd&"<br>")
fread="Password="&SerUPassEnCode(pwd)
end if
f2.WriteLine(fread)
''response.Write(fread&"<br>")
loop
f1.close
f2.close
Function getradpassword()
Dim i, intNum, intUpper, intLower, intRand, strPartPass, genPassword
Dim arrBindings(2)
genPassword = ""
''生成随机种子;
Randomize
For i = 1 To 8
intNum = Int(10 * Rnd + 48)
intUpper = Int(26 * Rnd + 65)
intLower = Int(26 * Rnd + 97)
intRand = Int(3 * Rnd + 1)
Select Case intRand
Case 1
strPartPass = Chr(intNum)
Case 2
strPartPass = Chr(intUpper)
Case 3
strPartPass = Chr(intLower)
End Select
genPassword = genPassword & strPartPass
Next
getradpassword = genPassword
End Function
Function SerUPassEnCode(strPass)
tmp =gettmp()
SerUPassEnCode=tmp &UCase(MD5(tmp&strPass))
End Function
Function gettmp()
Randomize
For i = 1 To 2
intLower = Int(26 * Rnd + 97)
gettmp = gettmp + Chr(intLower)
Next
End Function
%>