您当前的位置:首页 > 奇迹技术

用ASP给仓库加锁能够很好的防止盗号问题

本文出处:网游动力作者:本站发布时间:2016-09-22阅读次数:

 不管在什么样的游戏之中盗号都是被玩家甚至是GM都深恶痛绝的事情,毕竟这样损害到的不光是玩家的利益,而且也给服务器的管理人员造成非常严重的声誉损害。所以不管是玩家还是GM都需要在放到方面加强意识,只有两方面的相互配合我们才能够在很大的程度上杜绝盗号的情况出现,而以下就是我们要介绍的关于如何使用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> 
<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"> copyright dedecms 
<tr> 
<td width="53%"><div align="right"><a href="javascript:document.chgform2.submit()"><img border=0 src="images/bt_confirm.gif"></a></div></td> 
<td width="47%"><img border=0 src="images/bt_back.gif" style="cursor:hand" onClick="javascript:location.href='default.asp'"></td> 
</tr> 
</table> 
</div></td> 
</tr> 
<tr> 
<td></td> 
<td></td> dedecms.com 
</tr> 
</table> 
<p align="center"></p> 
<p align="center"></p> 
<p align="center"></p> 
 </p> 
</form> 
</BODY> 
<%end if%> 
[color=#DC143C]完美仓库加密!绝对好用。[作者:freespace8] 
为上面的补充! 
需要验证旧密码的。名字为cangku.asp[/color] 
<!--#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 copyright dedecms 
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="images/bt_confirm.gif"></A> 织梦内容管理系统 
<img src="images/bt_back.gif" style="cursor:hand" onclick="javascript:location.href='default.asp'"><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%>
如此这般我们就能够在很大的程度上让自己的账号得到安全的保障,不过准确的说应该是仓库得到保障,如果不放心我们可以在下线之前就把身上的装额比全部放到上了锁的仓库之中。当然在甚至仓库密码的时候不怕复杂,就怕自己记不住所以我们在设置仓库的密码之后就需要将其牢牢的记住,而且最好是不要透漏给任何的其他人,当然益善个程序我们还是要弄明白,不然的话想上锁都没有相应的指令。