serv-u| Example | online
We use the Serv-u OBDC function, you can put the FTP user information in the database, so that a lot of web operations convenient, the following is an online change password, the database for Access, table and field design refer to the Serv-u Help file.
Encryption algorithm for random code and MD532 bit encryption, for example:
Two random letters: AB
User input Password: 123456
The generated password is: AB +md5 (ab123456)
Reference:
Add: MD5 return to 32-bit uppercase characters
Tip: Code only implements the ability to change passwords, and does not necessarily fully meet or meet your needs.
<!--#includefile = ' conn.asp '-->
<!--#includefile = ' include/md5.asp '-->
<%
Dimact,username,oldpassword,newpassword,renewpassword
Act=request.form ("act")
ifact= "Update" Then
UserName =request.form ("UserName")
OldPassword =request.form ("OldPassword")
NewPassword =request.form ("NewPassword")
Renewpassword =request.form ("Renewpassword")
UserName =replace (UserName, "'", "")
Iflen (UserName) <1orlen (OldPassword) <1orlen (newpassword) <1orlen (Renewpassword) <1then
Alert ("form is not filled in complete")
endif
Iftrim (NewPassword) <>trim (Renewpassword) Then
Alert ("Password is not the same as confirmation password")
endif
sql0= "Selecttop1name,[password]from[useraccounts]wherename= '" &UserName& ""
Setrs0=conn.execute (Sql0)
Ifrs0.eofandrs0.bofthen
Alert ("User name does not exist")
Else
Dbname=rs0 ("name")
Dbpassword=rs0 ("password")
endif
Iftrim (Cdbpassword) <>trim (Dbpassword) Then
Alert ("Password error")
Else
RNDSTR=MYRANDC (2) ' Two-bit random letter
newdbpassword=rndstr& MD5 (Rndstr&newpassword)
sql2= "update[useraccounts]set[password]= '" &newdbpassword& "' wherename= '" &UserName& ""
Conn.execute (SQL2)
Alert ("Password has changed, may take several minutes to take effect")
endif
endif
Functionalert (x)
Response.Write "<scriptlanguage= ' JavaScript ' >alert ('" &replace (x, "" "", "" ") &"); History.go (-1); </script> "
Conn.close
Setconn=nothing
Response.End
Endfunction
FUNCTIONMYRANDC (n) ' generates random characters, n is the number of characters
Thechr= ""
Fori=1ton
Randomizetimer
Znum=cint (25*RND)
Ifznummod2=0then
znum=znum+97
Else
Znum=znum+65
endif
THECHR=THECHR&CHR (Znum)
Next
Myrandc=thechr
Endfunction
%>
<metahttp-equiv= "Content-type" content= "text/html;charset=gb2312" >
<metaname= "Author" content= "Eva (51windows)" >
<metaname= "Keywords" content= "" >
<title> Change the FTP (serv-u) password -51windows.net</title>
<body>
<formmethod= "POST" action= "" name= "form" autocomplete= "off" >
<inputtype= "hidden" name= "act" value= "Update" >
<divalign= "Center" >
<center>
<tableborder= "0" width= "cellpadding=" 2 "cellspacing=" 1 "class=" table "style=" border:1solid#336699;font-size : 14px; " >
<tr>
<tdwidth= "100%" align= "center" colspan= "2" class= "title" style= "background: #336699; color: #FFFFFF; > Change FTP (serv-u) password </td>
</tr>
<tr>
<tdwidth= "30%" align= "left" > user name [√]:</td>
<tdwidth= "70%" ><inputclass= "input" type= "text" maxlength=20 name= "UserName" size= "25" Value= "" "/> (FTP login username) </td>
</tr>
<tr>
<tdwidth= "30%" align= "left" > Old password [√]:</td>
<tdwidth= "70%" ><inputclass= "input" type= "password" maxlength=20 name= "OldPassword" size= "" value= " "/> (old password must be entered) </td>