用ASP对仓库加锁的方法解决盗号问题
我的仓库ASP原码
说明:密码填写一定要是4位数的数字!填写为0里是解锁!
文件名一定要改为ckasp.asp
放在一个有conn.asp的目录下!
<!--#include file="conn.asp" -->
<%
'Response.Expires = -1
'Response.ExpiresAbsolute = Now() - 1
'Response.cachecontrol="no-cache"
on error resume next
if request.form("username2")<>"" then
ps_loginname2=request.form("username2")
ps_password2=request.form("password2")
ps_tj2=request.form("tj2")
ps_tj12=request.form("tj12")
if instr(ps_loginname2,"'")<>0 or instr(ps_loginname2,"=")<>0 or instr(ps_loginname2,"&")<>0 or instr(ps_loginname2,"%")<>0 then
response.write "您所输入的数据包含非法字符,对不起!"
response.end
end if
if ps_loginname2="" or ps_password2="" or ps_tj2="" then
response.write "<script language=javascript>alert('请填写清楚!');history.back();</script>"
response.end
end if
if len(ps_tj2) < 1 or len(ps_tj2) =5 then
response.write "<script language=javascript>alert('仓库密码填写错误!');history.back();</script>"
response.end
end if
set rs1 = Server.CreateObject("ADODB.Recordset")
sql="select * from MEMB_INFO where memb___id = '"&ps_loginname2&"'"
rs1.open sql,conn,1,3
chg=0
set rs2 = Server.CreateObject("ADODB.Recordset")
sql2="select * from warehouse where AccountID = '"&ps_loginname2&"'"
rs2.open sql2,conn,1,3
if not rs1.eof then
if ps_password2=rs1("memb__pwd") and ps_tj12=rs1("fpas_answ") then
rs2("pw")=ps_tj2
rs2.update
chg=1
else
chg=2
end if
else
chg=3
end if
if chg=1 then response.write "<script language=javascript>alert('仓库加密成功!密码是"&ps_tj2&"请记好了!');location.href='default.asp';</script>"
if chg=2 then response.write "<script language=javascript>alert('密码错误或问题答案错误');history.back();</script>"
if chg=3 then response.write "<script language=javascript>alert('请正确输入您的帐号!');history.back();</script>"
rs1.close
rs2.close
set rs1=nothing
set rs2=nothing
conn.close
set conn=nothing
response.end
else
%>
<title>登陆页面</title>
<LINK href="../images/mu.css" rel=stylesheet>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY text=#000000 bgColor=#006699 leftMargin=0 topMargin=0 background="../images/bg.gif">
<FORM method=post name=chgform2 action="ckasp.asp">
<p align="center"> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" height="28"> <div align="right">用户名:</div></td>
<td width="54%"><input type="text" name="username2" size="20" class=button maxlength=20></td>
</tr>
<tr>
<td height="28"> <div align="right">密 码:</div></td> dedecms.com
<td><input type="password" name="password2" size="20" class=button maxlength=20></td>
</tr>
<tr>
<td height="29"> <div align="right">问题答案:</div></td>
<td><input type="text" name="tj12" size="20" class=button maxlength=20></td>
</tr>
<tr>
<td height="29"> <div align="right">仓库密码:</div></td>
<td><input type="text" name="tj2" size="20" class=button maxlength=4></td>
</tr>
<tr>
<td height="65" colspan="2"> <div align="right">
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="53%"><div align="right"><a href="javascript:document.chgform2.submit()"><img border=0 src="http://www.5uwl.net/wyjs/2005/images/bt_confirm.gif"></a></div></td>
<td width="47%"><img border=0 src="http://www.5uwl.net/wyjs/2005/images/bt_back.gif" style="cursor:hand" ></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<p align="center"> </p>
<p align="center"></p>
<p align="center"></p>
</p>
</form>
</BODY>
<%end if%>
完美仓库加密!绝对好用。[作者:freespace8]
为上面的补充!
需要验证旧密码的。名字为cangku.asp
<!--#include file="conn.asp" -->
<%
n=request.form("username")
s=request.form("password")
j=request.form("jioupassword")
p1=request.form("ps_password")
p2=request.form("ps_repassword")
if instr(n,"'")<>0 then response.end
if instr(n,"=")<>0 then response.end
if instr(n,"%")<>0 then response.end
if n<>"" and j<>"" then
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from MEMB_INFO where memb___id = '"&n&"' and memb__pwd='"&s&"'"
rs.open sql,conn,1,1
if rs.eof or rs.bof then
response.write "<script language=javascript>alert('\n\n帐号信息错误,请重新填写!');history.back()</script>"
response.end
else
set rs1 = Server.CreateObject("ADODB.Recordset")
sql1="select * from warehouse where AccountID='"&n&"' and pw='"&j&"'"
rs1.open sql1,conn,1,3
if rs1.eof or rs1.bof then
response.write "<script language=javascript>alert('\n\n用户名或旧仓库密码错误!');history.back()</script>"
response.end
end if
if p1<>p2 then
response.write "<script language=javascript>alert('\n\n新仓库密码输入错误,请确认两次输入的密码是否一致!');history.back()</script>"
response.end
end if
if rss.eof or rss.bof then
rs1("pw")=p1
rs1.update
response.write "<script language=javascript>alert('\n\n恭喜,您的仓库密码已经更改为"&p1&",请别忘记了!');history.back()</script>"
response.end
end if
end if
else
%>
<HTML>
<HEAD>
<TITLE><%=sitename%>-仓库密码设定</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<LINK href="images/mu.css" rel=stylesheet type=text/css>
</HEAD>
<BODY bgColor=#000000 leftMargin=0 text=#666666 topMargin=0 marginheight="0" marginwidth="0">
<DIV align=center>
<FORM method=post name=chgform action="cangku.asp">
<TABLE background=images/top_bg5.gif border=0 cellPadding=0 cellSpacing=0 width=90%>
<TBODY>
<TR>
<TD align=center vAlign=top><BR>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=60%>
<TBODY>
<TR>
<TD align=center class=txt_gray width="100%">
<p align="left"><h3>请仔细阅读以下注意事项</h3></p>
<p align="left">
为了保证用户仓库的,并由于0.96.y版端的未知原因。
导致无法修改仓库和设定密码,特设计了改仓库密码修改程序。
为了考虑,请给您的仓库加上锁!
如果仓库密码还没有,旧密码处请填写密码为0,如果要解除仓库密码,请在新密码处填写0就可以了!
</p>
</TD></TR>
<TR>
<TD align=right> <TABLE align=center border=0 cellPadding=5 cellSpacing=1 width="100%">
<TBODY>
<TR>
<TD align=right class=txt_gray width="83">
<DIV align=left>用户帐号</DIV></TD>
<TD class=txt_gray width="261">
<INPUT maxLength=12 name=username size=17>
<DIV align=center></DIV></TD></TR>
<TR>
<TD align=right class=txt_gray width="83">
<DIV align=left>用户密码</DIV></TD>
<TD class=txt_gray width="261">
<INPUT maxLength=12 name=password size=17 type="password">
<DIV align=center></DIV></TD></TR>
<TR>
<TD align=right class=txt_gray width="83">
<DIV align=left>旧仓库密码</DIV></TD>
<TD class=txt_gray width="261">
<INPUT maxLength=4 name=jioupassword size=17 type=password>
<DIV align=center></DIV></TD></TR>
<TR>
<TD align=right class=txt_gray width="83">
<DIV align=left>新仓库密码</DIV></TD>
<TD class=txt_gray width="261">
<INPUT maxLength=4 name=ps_password size=17 type=password>
<DIV align=center></DIV></TD></TR>
<TR>
<TD align=right class=txt_gray width="83">
<DIV align=left>确认新密码</DIV></TD>
<TD class=txt_gray width="261">
<INPUT maxLength=4 name=ps_repassword size=17 type=password>
<DIV align=center></DIV></TD></TR>
<TR>
<TD height=1 colspan=2 width="323"><p align="center"><BR><A href="javascript:document.chgform.submit()"><IMG border=0 src="http://www.5uwl.net/wyjs/2005/images/bt_confirm.gif"></A>
<img src="http://www.5uwl.net/wyjs/2005/images/bt_back.gif" style="cursor:hand" ><BR><BR></TD></TR></TBODY></TABLE>
</TD></TR>
</TBODY>
</TABLE>
</DIV></FORM>
</table><Br>
<center><font color=red><%=copy%></font>
</div>
</BODY>
</HTML>
<%end if%>