<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%
founderr=false
UserIP=Request.ServerVariables("REMOTE_ADDR")
if request("username")="" then
%>
<script>alert('请输入您的用户名。');history.back();</script>
<%
founderr=true
else
	username=Checkin(trim(request("username")))
end if
if request("password")="" then
%>
<script>alert('请输入您的密码。');history.back();</script>
<%
	founderr=true
else
	password=Checkin(trim(request("password")))
end if
set rs=server.createobject("adodb.recordset")
sql="select * from [user2] where username='"&username&"'"
rs.open sql,conn,1,3
if rs.bof and rs.eof then
%>
<script>alert('您输入的用户名不存在。');history.back();</script>
<%
founderr=true
else
	if rs("password")<>password then
%>
<script>alert('您输入的密码不正确。');history.back();</script>
<%
	founderr=true
	else
		rs("loginIP")=Request.ServerVariables("REMOTE_ADDR")
		rs.update
	       	session("UserName")=UserName
		session("PassWord")=PassWord
		session("tjrs")=rs("tjrs")
		session("id")=rs("id")
		session.timeout=200
	end if
end if

if founderr=true then
	call error()
else
	response.redirect("index.asp")
end if
%>