www.gusucode.com > 25175 学生同学录管理系统 2007 build 1231D源码程序 > user_chklogin.asp

    <!--#include file="conn.asp"-->
<!--#include file="inc/inc.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">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="images/css.css" type="text/css" rel="stylesheet" />
<link href="images/user_style.css" type="text/css" rel="stylesheet" />

<title>学生登陆</title>
</head>
<body>
<%
Dim UserName,PassWord,CheckCode,cookiesinfo
Dim rs1,user_chk
Dim user25175s
Dim FoundErr,ErrMsg
login(1)
if founderr=true Then errormsg(ErrMsg)
Function login(Model)
	FoundErr=False
	UserName=che(request.Form("UserName"))
	PassWord=che(request.Form("PassWord"))
	CheckCode=che(request.Form("CheckCode"))
	if UserName="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<li>用户名不能为空!</li>"
	end if
	if PassWord="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<li>密码不能为空!</li>"
	end if
	if CheckCode="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<li>验证码不能为空!</li>"
	end if
	If cookiesinfo=1 And session("CheckCode")="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<li><a href='login.asp'>你的登录等待时间过长,请返回登录页面重新登录</a></li>"
	end if
	if cookiesinfo=1 And CheckCode<>CStr(session("CheckCode")) then
		FoundErr=True
		ErrMsg=ErrMsg & "<li>您输入的确认码和系统产生的不一致,请重新输入</li>"
	end If
	Sql_Conditions=" IdentityNO='"&PassWord&"' and stuid='"&UserName&"'"
	If UserName=PassWord Then 
		Sql_Conditions=" stuid='"&UserName&"'"
		FoundErr=False
	End If
	if FoundErr<>True then
		sql=Sqlinfo("id,name,lj_id,Col_id,pro_id,cla_id","admin_stu",Sql_Conditions,"","","")
		user_chk =connopen(sql)
		If Not isArray(user_chk) Then
			FoundErr=True
			ErrMsg=ErrMsg & "<li>用户名或密码或身份错误!!!</li>"
		else 
			set rs1=conn.execute("update admin_stu set ulastdate='"&now()&"',uloads=uloads+1 where ID="&user_chk(0,0)&"")
			cookiesinfo=request("cooks")
			user25175s=user_chk(0,0)&"||"&user_chk(1,0)&"||"&UserName&"||"&PassWord&"||"&_
				user_chk(2,0)&"||"&user_chk(3,0)&"||"&user_chk(4,0)&"||"&user_chk(5,0)
			If cookiesinfo="1" Then 
				session("user25175_xx")=user25175s
			Else
				response.cookies("user25175")("xx")=user25175s
				response.cookies("user25175")("info")=md5(user25175s&"||"&siteinfo(5))
				If cookiesinfo="0" Then 
					Response.Cookies("user25175").Expires = DateAdd("m",12,now())
				ElseIf cookiesinfo="2" Then 
					Response.Cookies("user25175").Expires = DateAdd("h", 1, Now()) 
				ElseIf cookiesinfo="3" Then 
					Response.Cookies("user25175").Expires = DateAdd("h", 12, Now()) 
				ElseIf cookiesinfo="4" Then 
					Response.Cookies("user25175").Expires = DateAdd("m",1,now()) 
				End If
			End If
			session("id")=user_chk(0,0)
			FoundErr=False
		end if
		set rs=nothing
	Else
		login=FoundErr
		exit function
	end If
End function
If login(1)=True Then
	main_errormsg ErrMsg
Else
	Response.Redirect "main.asp"
End If
%>
</body></html>