|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP脚本是采用明文(plaintext)方式来编写的。数据库地位:data/data.mdb
数据库表:useridnamepwdwentidaanconn.asp
<%
db="data/data.mdb"数据库寄存目次
onerrorresumenext
setconn=server.createobject("adodb.connection")
conn.open"driver={microsoftaccessdriver(*.mdb)};dbq="&server.mappath(db)
iferrthen
err.clear
setconn=Nothing
response.write"数据库毗连堕落,请反省conn.asp中的毗连字符串。"
response.end
endif
functionCloseDB
Conn.Close
setConn=Nothing
EndFunction
%>
<%
dimbadword
badword="|and|select|update|chr|delete|%20from|;|insert|mid|master.|set|chr(37)|="
ifrequest.QueryString""then
chk=split(badword,"|")
foreachquery_nameinrequest.querystring
fori=0toubound(chk)
ifinstr(lcase(request.querystring(query_name)),chk(i))0then
response.write"<scriptlanguage=javascript>alert(传参毛病!参数"&query_name&"的值中包括不法字符串!
);location="&request.ServerVariables("HTTP_REFERER")&"</Script>"
response.end
endif
next
next
endif
%>
reg.asp
<!--#includefile="conn.asp"-->
<%
ifrequest("action")="reg"then
setrs=server.CreateObject("adodb.recordset")
rs.open"select*fromuserwherename="&trim(request("name"))&"",conn,1,1
ifrs.recordcount>0then
response.write"<Scriptlanguage=JavaScript>window.alert(您输出的用户名已存在,请前往从头输出!);history.back(-1);</Script>"
response.End()
endif
sql="select*fromuser"
setrs=server.createobject("adodb.recordset")
rs.opensql,conn,1,3
rs.addnew
rs("name")=trim(request.Form("name"))
rs("pwd")=trim(request.Form("pwd"))
rs("wenti")=trim(request.Form("wenti"))
rs("daan")=trim(request.Form("daan"))
rs.update
rs.close
setrs=nothing
response.write"<scriptlanguage=javascript>alert(注册乐成,点击断定当即登录!);location.replace(login.asp);</script>"
response.end
endif
%>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td>用户注册
<formname="form1"method="post"action="?action=reg">
<tablewidth="347"border="1"cellpadding="5"cellspacing="0">
<tr>
<tdwidth="142">用户名</td>
<tdwidth="179"><inputname="name"type="text"id="name"></td>
</tr>
<tr>
<td>暗码</td>
<td><inputname="pwd"type="password"id="pwd"></td>
</tr>
<tr>
<td>暗码提醒成绩</td>
<td><inputname="wenti"type="text"id="wenti"></td>
</tr>
<tr>
<td>暗码提醒谜底</td>
<td><inputname="daan"type="text"id="daan"></td>
</tr>
<tr>
<tdcolspan="2"><inputtype="submit"name="Submit"value="注册">
<inputtype="reset"name="Submit"value="重置"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
top.asp
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td><ahref="/"";index.asp">首页</a>
<%
ifSession("name")=""then
%>
<ahref="/"";reg.asp">注册</a><ahref="/"";login.asp">上岸</a>
<ahref="/"";pwd.asp">健忘暗码?</a><%
else
%>
接待您<%=Session("name")%>,<ahref="/"";loginout.asp">刊出上岸</a>
<%
endif
%>
<ahref="/"";jiami.asp">加密页</a></td>
</tr>
</table>
<br>
login.asp
<!--#includefile="conn.asp"-->
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td>
用户上岸
<%
ifSession("name")=""then
%>
<formname="form1"method="post"action="loginok.asp?action=login">
<tableborder="1"cellspacing="0"cellpadding="5">
<tr>
<tdwidth="116">用户名</td>
<tdwidth="116"><inputname="name"type="text"id="name"></td>
</tr>
<tr>
<td>暗码</td>
<td><inputname="pwd"type="password"id="pwd"></td>
</tr>
<tr>
<tdcolspan="2"><inputtype="submit"name="Submit"value="上岸">
<inputtype="reset"name="Submit"value="重置"></td>
</tr>
</table>
</form>
<%
else
%>
<tableborder="1"cellspacing="0"cellpadding="5">
<tr>
<tdwidth="303"><%=Session("name")%>,您已乐成上岸</td>
</tr>
</table>
<%
endif
%>
</td>
</tr>
</table>
</body>
</html>
loginok.asp
<!--#includefile="conn.asp"-->
<%
Session.TimeOut=30
ifrequest("action")="login"then
name=trim(request.form("name"))
pwd=trim(request.form("pwd"))
ifname=""orpwd=""then
Response.Redirect("login.asp")
endif
setrs=server.createobject("adodb.recordset")
sql="select*fromuserwherename="&name&"andpwd="&pwd&""
rs.opensql,conn,1,1
ifnotrs.eofthen
session("name")=name
response.redirect"edit.asp"
else
response.redirect"Error.asp"
response.end
endif
endif
%>loginout.asp
<%
session("name")=""
response.write"<scriptlanguage=javascript>alert(加入上岸乐成!);location.href(index.asp);</script>"
response.end
%>pwd.asp
<!--#includefile="conn.asp"-->
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td><p>找回暗码</p>
<formname="form1"method="post"action="pwd2.asp?action=pwd">
<tablewidth="398"border="1"cellpadding="5"cellspacing="0">
<tr>
<tdwidth="130">请输出用户名</td>
<tdwidth="168"><inputname="name"type="text"id="name"></td>
<tdwidth="62"><inputtype="submit"name="Submit"value="查询"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
pwd2.asp
<!--#includefile="conn.asp"-->
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td>
找回暗码
<%
name=trim(request.form("name"))
setrs=server.createobject("adodb.recordset")
sql="select*fromuserwherename="&name&""
rs.opensql,conn,1,1
ifnotrs.eofthen
%>
<formname="form1"method="post"action="pwd3.asp">
<tablewidth="398"border="1"cellpadding="5"cellspacing="0">
<tr>
<td><%=rs("name")%></td>
<td></td>
<td><inputname="name"type="hidden"id="name"value="<%=rs("name")%>"></td>
</tr>
<tr>
<tdwidth="130">暗码提醒成绩</td>
<tdwidth="168"><%=rs("wenti")%>
</td>
<tdwidth="62"></td>
</tr>
<tr>
<td>暗码提醒谜底</td>
<td><inputname="daan"type="text"id="daan"></td>
<td><inputtype="submit"name="Submit"value="查询"></td>
</tr>
</table>
</form>
<%else
%>
<tablewidth="413"border="1"cellpadding="5"cellspacing="0">
<tr>
<td>你输出的用户名不存在,请<ahref="/"";javascript:history.back()">前往</a>从头输出,大概<ahref="/"";reg.asp">注册</a></td>
</tr>
</table>
<%endif
%>
</td>
</tr>
</table>
</body>
</html>
pwd3.asp
<!--#includefile="conn.asp"-->
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td>
找回暗码
<%
name=trim(request.form("name"))
daan=trim(request.form("daan"))
setrs=server.createobject("adodb.recordset")
sql="select*fromuserwherename="&name&"anddaan="&daan&""
rs.opensql,conn,1,1
ifnotrs.eofthen
%>
<tablewidth="398"border="1"cellpadding="5"cellspacing="0">
<tr>
<tdwidth="130"><%=rs("name")%>,您的暗码</td>
<td><%=rs("pwd")%>
</td>
</tr>
</table>
<%else
%>
<tablewidth="413"border="1"cellpadding="5"cellspacing="0">
<tr>
<td>你输出的暗码提醒谜底不准确,请<ahref="/"";javascript:history.back()">前往</a>从头输出</td>
</tr>
</table>
<%endif
%>
</td>
</tr>
</table>
</body>
</html>
error.asp
<!--#includefile="conn.asp"-->
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td>上岸失利,请反省用户名和暗码是不是准确<ahref="/"";login.asp">前往</a></td>
</tr>
</table>
</body>
</html>
edit.asp
<!--#includefile="conn.asp"-->
<%
ifrequest("action")="edit"then
name=session("name")
setrs=server.createobject("adodb.recordset")
sql="select*fromuserwherename="&name&""
rs.opensql,conn,3,2
rs("pwd")=trim(request.Form("pwd"))
rs("daan")=trim(request.Form("daan"))
rs.update
rs.close
setrs=nothing
response.write"<scriptlanguage=javascript>alert(编纂乐成!);location.href(edit.asp);</script>"
endif
%>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>无题目文档</title>
</head><body><!--#includefile="top.asp"-->
<tablewidth="90%"border="1"align="center"cellpadding="10"cellspacing="0">
<tr>
<td><p>修正材料</p>
<p>
<%
ifSession("name")=""then
%>
对不起你还没有上岸,请<ahref="/"";login.asp">上岸</a>大概<ahref="/"";reg.asp">注册</a>
<%
else
%>
<%
name=session("name")
setrs=server.createobject("adodb.recordset")
sql="select*fromuserwherename="&name&""
rs.opensql,conn,1,1
%>
</p>
<formaction="?action=edit"method="post"name="form"id="form">
<tableborder="1"cellpadding="5">
<tr>
<td>用户名</td>
<td><%=rs("name")%></td>
</tr>
<tr>
<td>暗码</td>
<td><inputname="pwd"type="text"id="pwd"value="<%=rs("pwd")%>"></td>
</tr>
<tr>
<td>暗码提醒成绩</td>
<td><%=rs("wenti")%></td>
</tr>
<tr>
<td>暗码提醒谜底</td>
<td><inputname="daan"type="text"id="daan"value="<%=rs("daan")%>"></td>
</tr>
<tr>
<td></td>
<td><inputtype="submit"name="Submit"value="修正">
<inputtype="reset"name="Submit"value="重置"></td>
</tr>
</table>
</form>
<p><%
endif
%>
</p></td>
</tr>
</table>
</body>
</html>
asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。 |
|