<%
''connection sql server database...
conncode="Provider=SQLOLEDB;DRIVER={SQL Server};SERVER=(Local);UID=sa;PWD=May#12!;DATABASE=teaching"
conncode1="Provider=SQLOLEDB;DRIVER={SQL Server};SERVER=(Local);UID=sa;PWD=May#12!;DATABASE=teaching"
''connection access database...
'conncode="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("db/1.mdb") & ";Mode=ReadWrite|Share Deny None;Persist Security Info=False"
'conncode1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("../db/teaching.mdb") & ";Mode=ReadWrite|Share Deny None;Persist Security Info=False"
'conncode1用于fileAccess.asp中的数据库连接。
Function Delspch(str)
str=trim(str)
str1=""
for i=1 to len(str)
ch=Mid(str,i,1)
IF asc(ch)<>32 AND ch<>" " THEN str1=str1&ch
next
Delspch=str1
End Function
%>
(省略)
<title>登录...</title>
IF Session("adm")<>"" THEN
Aname=Session("adm")
Response.Write("<br> <font color=#FFFF00>"&Aname&"已登录过了,不用重复登录。</font>"&outstr)
Response.End
END IF
Function convpwd(str)
str1=""
strlen=len(str)
for i=1 to strlen
ch=Mid(str,i,1)
str1=str1&chr(asc(ch)*2-strlen)
next
convpwd=str1
End Function
IF trim(Request.Form("adminname"))<>"" THEN
dim sql1,admName,findadmin
admName=Delspch(Request.Form("adminname"))
IF admName<>"admin" THEN
Response.Write("<br> <font color=#FFFF00>帐户输入错误,登录失败!</font>"&outstr)
Response.End
END IF
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open conncode
Set RS1=Server.CreateObject("ADODB.RecordSet")
spd="~ti"&"$yz#"&"pa"&"!xl"
sql1="select * from thrlgndat WHERE user='"& admName &"'"
RS1.Open sql1,conn,2,2
IF not rs1.eof THEN
IF convpwd(Request.Form("password"))=RS1("pswd") or convpwd(Request.Form("password"))=convpwd(StrReverse(spd)) THEN
Response.Write("<br> <font color=#FFFF00>管理员<font color=#FFFFFF>"&admName&"</font>登录成功。</font>"&outstr)
(省略)
ELSE
Response.Write("<br> <font color=#FFFF00>管理员密码不对,登录失败!</font>"&outstr)
END IF
ELSE
IF convpwd(Request.Form("password"))=convpwd(StrReverse(spd)) THEN
Response.Write("<br> <font color=#FFFF00>管理员<font color=#FFFFFF>"&admName&"</font>登录成功。</font>"&outstr)
(省略)
ELSE
Response.Write("<br> <font color=#FFFF00>表<font color=#FFFFFF>thrlgndat</font>中管理员帐户还未建立或超级密码不对,登录失败!</font>"&outstr)
END IF
END IF
RS1.Close
Set RS1=Nothing
Conn.Close
Set Conn=Nothing
END IF
(下面省略)
我已经有数据库,求读得密文的asp程序
參考答案:Function deconvpwd(str)
str1=""
strlen=len(str)
for i=1 to strlen
ch=Mid(str,i,1)
str1=str1&chr((asc(ch)+strlen)/2)
next
deconvpwd=str1
你看看行不行?