![]() |
#2
lm339lm2011-07-12 22:17
回复 楼主 lm339lm
|

<html>
<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<body>
<!--#include file="top.asp"-->
<%
session("user_name")=""
%>
<script language=javascript>
function check()
{if (document.loginform.user_name.value=="")
{alert("请输入用户名");
document.loginform.user_name.focus();
return false;}
if (document.loginform.user_password.value=="")
{alert("请输入用户密码");
document.loginform.user_password.focus();
return false;}
document.loginform.submit();
}
</script>
<div align="center">
<center>
<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="100">
<tr>
<td align="center">
<div align="center">
<center>
<form name="loginform" action="check.asp">
<br>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="300">
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td width="100" align="right">用户名:</td>
<td width="200"><input type="text" name="user_name" size="20"></td>
</tr>
<tr>
<td align="right">密 码:</td>
<td><input type="password" name="user_password" size="20"></td>
</tr>
<tr>
<td><div align="right">登陆时间:</div></td>
<td><input type="text" name="sj" value="<%response.write formatdatetime(now())%>"readonly onClick="alert('禁止修改')" size="20"></td>
</tr>
<tr>
<td></td>
<td><input type="button" class="button" value="登录" name="B1" onClick="check()">
<input type="reset" class="button" value="重置" name="B2">
<input type="button" class="button" value="注册" name="B12" onClick="window.location.href('user_res.asp')"></td>
</tr>
</table>
</form>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
<!--#include file="bottom.asp"-->
</body>
</html>
check.asp<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<body>
<!--#include file="top.asp"-->
<%
session("user_name")=""
%>
<script language=javascript>
function check()
{if (document.loginform.user_name.value=="")
{alert("请输入用户名");
document.loginform.user_name.focus();
return false;}
if (document.loginform.user_password.value=="")
{alert("请输入用户密码");
document.loginform.user_password.focus();
return false;}
document.loginform.submit();
}
</script>
<div align="center">
<center>
<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="100">
<tr>
<td align="center">
<div align="center">
<center>
<form name="loginform" action="check.asp">
<br>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="300">
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td width="100" align="right">用户名:</td>
<td width="200"><input type="text" name="user_name" size="20"></td>
</tr>
<tr>
<td align="right">密 码:</td>
<td><input type="password" name="user_password" size="20"></td>
</tr>
<tr>
<td><div align="right">登陆时间:</div></td>
<td><input type="text" name="sj" value="<%response.write formatdatetime(now())%>"readonly onClick="alert('禁止修改')" size="20"></td>
</tr>
<tr>
<td></td>
<td><input type="button" class="button" value="登录" name="B1" onClick="check()">
<input type="reset" class="button" value="重置" name="B2">
<input type="button" class="button" value="注册" name="B12" onClick="window.location.href('user_res.asp')"></td>
</tr>
</table>
</form>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
<!--#include file="bottom.asp"-->
</body>
</html>

<html>
<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<body>
<!--#include file="top.asp"-->
<!--#include file="menu.asp"-->
<div align="center">
<center>
<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="350">
<tr>
<td align="center">
<div align="center">
<center>
<%
sql="select * from tbUser where user_name='" & Request("user_name") & "' and user_password='" & Request("user_password") & "'"
Set Rs=conn.Execute(sql)
If Rs.Bof OR Rs.Eof Then
Response.Write "用户名或密码错误!请重新登录!<br>"
Response.Write "<a href='login.asp'>返回</a>"
else
session("user_name")=Request("user_name")
sql = "update tbUser set sj='" & Request("sj") & "' where user_id=" & Request("user_id")
conn.Execute(sql)
Response.Redirect "index.asp"
end if
%>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<body>
<!--#include file="top.asp"-->
<!--#include file="menu.asp"-->
<div align="center">
<center>
<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="350">
<tr>
<td align="center">
<div align="center">
<center>
<%
sql="select * from tbUser where user_name='" & Request("user_name") & "' and user_password='" & Request("user_password") & "'"
Set Rs=conn.Execute(sql)
If Rs.Bof OR Rs.Eof Then
Response.Write "用户名或密码错误!请重新登录!<br>"
Response.Write "<a href='login.asp'>返回</a>"
else
session("user_name")=Request("user_name")
sql = "update tbUser set sj='" & Request("sj") & "' where user_id=" & Request("user_id")
conn.Execute(sql)
Response.Redirect "index.asp"
end if
%>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
tbuesr表里
user_name
user_password
quanxian(帐号的权限)
sj(用来记录登陆时间时间)
就想把每次的登陆时间,都在access数据库里记录。
新登陆一次把上次的登陆时间替换了