| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 660 人关注过本帖
标题:检查用户登录
只看楼主 加入收藏
finaly
Rank: 1
来 自:广州
等 级:新手上路
帖 子:80
专家分:0
注 册:2006-6-5
收藏
 问题点数:0 回复次数:1 
检查用户登录

login.asp
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="css.css" rel="stylesheet" type="text/css" />
<SCRIPT language=javascript>
<!--
function chkuser()
{
if (login.username.value=="")
{
alert("请输入用户名!");
login.username.focus();
return false;
}
if (login.password.value=="")
{
alert("请输入密码!");
login.password.focus();
return false;
}
if (login.passcode.value=="")
{
alert("请输入验证码!");
login.passcode.focus();
return false;
}
}
//-->
</SCRIPT>
</head>

<body>
<table width="100%">
<tr>
<td><%
dim username
username=request.Cookies("shoptimes")("username")
IF username="" then
%>
<table width="100%">
<tr>
<td height="30" colspan="3" class="tableborder" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;会员登录 </td>
</tr>
<form action="chklogin.asp" method="post" name="login" id="login" onsubmit="return chkuser();" >
<tr>
<td width="280" height="25" align="left">用户名:</td>
<td width="448" height="25"><input name="username" type="text" id="username" size="15" maxlength="12" />
</td>
<td width="23" height="30"> </td>
</tr>
<tr>
<td height="25" align="left">密&nbsp; 码:</td>
<td height="25"><input name="password" type="password" id="password" size="15" maxlength="18" />
</td>
<td height="30"> </td>
</tr>
<tr>
<td height="25" align="left">验证码:</td>
<td height="25"><input name="passcode" type="text" id="passcode" size="8" maxlength="4" />
<img src="Code.asp"> </td>
<td height="30"> </td>
</tr>
<tr>
<td height="25"></td>
<td height="25"><a href="reg.asp">新用户注册</a>
<input type="submit" name="Submit" value="登录" /></td>
<td height="30">&nbsp;</td>
</tr>
</form>
</table>
<% else
Dim rs,Sql
set rs=Server.CreateObject("Adodb.Recordset")
Sql="select * from userinfo where username='"&username&"'"
rs.open Sql,conn,1,1
%>
<table width="100%">
<tr>
<td align="center"><marquee scrollamount="1" scrolldelay="1" direction="down" height="100">
<div align="center"> <%= username %>您是<br />
<span style="color:#FF0000">
<% select case rs("rank")
case "0"
Response.Write("普通会号")
case "1"
Response.Write("市级代理")
case "2"
Response.Write("省级代理")
end select
%>
</span><br />
<%= rs("message") %> </div>
</marquee>
</td>
</tr>
</table>
<% end if %></td>
</tr>
</table>
</body>
</html>

chklogin.asp
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
dim username,password,code,sql
username=Trim(Request.Form("username"))
password=md5(Trim(Request.Form("password")))
passcode=Request.Form("passcode")
if not isnumeric(passcode) then
response.Write"<script language='javascript'>alert('验证码为数字!');history.go(-1)</script>"
response.End()
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from userinfo where username='"&username&"'"
rs.open sql,conn,1,3
if rs.bof and rs.eof then
response.Write"<script language='javascript'>alert('请检查用户名!');history.go(-1)</script>"
response.end
else
if password<>rs("password") then
Response.Write"<script language='javascript'>alert('密码错误!');history.go(-1)</script>"
response.End
end if
if int(passcode)<>Session("GetCode") then
Response.Write"<script language='javascript'>alert('验证码错误!');history.go(-1)</script>"
response.End
end if

response.Cookies("shoptimes")("username")=name
response.cookies("shoptimes")("rank")=rs("rank")
rs("lastlogin")=now()
rs("logintimes")=rs("logintimes")+1
rs("cent")=rs("cent")+2
rs.Update
rs.Close
set rs=nothing
end if

response.Redirect "msg.asp?msg=rightmsg"
%>

搜索更多相关主题的帖子: DTD dtd xhtml target 
2007-07-17 21:04
finaly
Rank: 1
来 自:广州
等 级:新手上路
帖 子:80
专家分:0
注 册:2006-6-5
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册


http://
2007-07-17 21:29
快速回复:检查用户登录
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.043571 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved