设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 47|回复: 2
打印 上一主题 下一主题

检查用户登录

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-8 01:22:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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"
%>
2#
发表于 2010-1-8 01:22:22 | 只看该作者
附件: 只有本站会员才能下载或查看附件,请您 登录 或 注册
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 06:18 , Processed in 0.093497 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表