急求 一个ASP 登陆页面 连接ACCESS数据库 验证用户名和密码 还有 数字验证码 登陆成功 并跳转到用户页面 10

RT希望有注释在线等... RT 希望有注释 在线等 展开
 我来答
百度网友511426f1e
2011-06-22 · TA获得超过202个赞
知道小有建树答主
回答量:424
采纳率:0%
帮助的人:370万
展开全部
login.asp
<%
option explicit
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<script language=javascript><!--
if (top.location != self.location)top.location=self.location;
// -->
</script>
<html>
<head>
<link href="/css.css" type=text/css rel=stylesheet>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<style type="text/css">

body {
background-image: url(skins/bg.gif);
margin: 0px;
background-repeat: repeat-x;
}
table,td{
font-family:"宋体";
font-size:12px;
}
.inputtext{
border-left:1px solid balck;
border-right:1px solid balck;
border-top:1px solid balck;
border-bottom:1px solid balck;
}
.loginbg {
font-size: 12px;
width: 59px;
height: 26px;
background-image: url(skins/login_bg.gif);
border: none;
padding-top: 3px;
color:#666666;
}
</style>
</head>
<body>
<form method=post action="chklogin.asp">
<table width="100%" height="98" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="50%" align="center" height="34" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="skins/images/admin_02.gif" width="291" height="34"></td>
</tr>
</table>
<table width="100%" height="30" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="50%" height="261" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="457" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><img src="skins/images/admin_05.gif" width="457" height="40" border="0" usemap="#map"></td>
</tr>
<tr>
<td width="142" rowspan="3"><img src="skins/images/admin_07.gif" width="142" height="221"></td>
<td width="240" valign="top"><img src="skins/images/admin_08.gif" width="240" height="42"></td>
<td width="75" rowspan="3"><img src="skins/images/admin_09.gif" width="75" height="221"></td>
</tr>
<tr>
<td height="107" valign="top" background="skins/images/admin_10.gif">
<table width="75%" align="center" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="24%" height="30">用  户:</td>
<td width="76%" height="30"><input name="admin" type="text" class="inputtext" id="admin" size="15"></td>
</tr>
<tr>
<td height="25">密  码:</td>
<td height="25"><input name="password" type="password" class="inputtext" id="password" size="15">

<tr>
<td height="25" colspan="2"><p align="center"><input name="submit" type="submit" class="loginbg" id="submit" value="登 陆">
  <input name="submit2" type="reset" class="loginbg" id="submit2" value="取 消"></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="bottom"><img src="skins/images/admin_11.gif" width="240" height="72"></td>
</tr>
</table></td>
</tr>
</table>
</form>
<map name="map"><area shape="rect" coords="348,1,436,39" href="../"></map>
</body>
</html>

chklogin.asp

<!--#include file="conn.asp" -->
<!--#include file="inc/md5.asp"-->
<%
Dim Usr,Pwd,rs
Usr=Request.form("admin")
Pwd=Request.form("password")
if (Usr<>"") and (Pwd<>"") then
Usr=Replace(Replace(Usr,"'",""),"or","")
Pwd=Replace(Replace(Pwd,"'",""),"or","")
set rs=server.createobject("adodb.recordset")
rs.open "select * from admin where admin='" & Usr & "' and password='"& md5(Pwd) &"'",conn,1
' rs.open "select * from admin where admin='" & Usr & "' and password='"& Pwd &"'",conn,1
if rs.eof and rs.bof then
response.write"<script language=javascript>alert('用户名或密码不正确!');"
response.write"javascript:history.go(-1)</script>"
response.end
else
session("admin")=rs("admin")
session("password")=rs("password")
session("aleave")=rs("aleave")
session("login")=true
session("userkey")=rs("userkey")
if rs("userkey") =2 then
response.redirect "noticenews/index.asp"
else
response.redirect "index.asp"
end if
end if
rs.close
set rs=nothing
else

response.write"<script language=javascript>alert('用户名和密码不能为空!');"
response.write"javascript:history.go(-1)</script>"
response.end
response.redirect "../login.asp"
end if
%>

conn.asp

<%
dim startime
dim conn
dim connstr
dim db,pass_word,User_ID,Data_Source
startime=timer()
db="" '数据库名称
Pass_word="" 'Password=帐号密码
User_ID="" 'User ID=登陆帐号
Data_Source= 'Data Source=服务名称或者ip
Set conn = Server.CreateObject("ADODB.Connection")
connStr="Provider=SQLOLEDB.1;Password='"&pass_word&"';Persist Security Info=True;User ID='"&User_ID&"';Initial Catalog='"&db&"';Data Source='"&Data_Source&"'"
conn.Open connstr
%>
追问
md5呢 还想验证 数字验证码 写在哪 谢谢
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式