<!--#include file="conn.asp" -->
<% dim verifycode,verifycode2
verifycode=trim(Request.Form("verifycode"))
verifycode2=trim(Request.Form("verifycode2"))
if verifycode<>verifycode2 then
response.write"<SCRIPT language=JavaScript>alert('您输入的验证码不正确。');"
response.write"location.href='login.asp'</SCRIPT>"
founderr=true
else
session("verifycode")=""
%>
<%
dim uid,upwd,rs,sqltext
uid=replace(trim(request("userid")),"","")
upwd=replace(trim(request("password")),"","")
set rs=server.createobject("adodb.recordset")
sqltext="select * from Manage_user where Username='"&uid&"' and PassWord='"&upwd& "'"
rs.open sqltext,conn,1,1
if rs.eof and rs.bof then
response.write"<SCRIPT language=JavaScript>alert('您输入的用户名和密码不正确。');"
response.write"location.href='login.asp'</SCRIPT>" 
rs.close
set rs=nothing
else
session("username")=rs("username")
session("password")=rs("password")
session("LastLogin")=rs("LastLogin")
session("flag")=rs("username")
session.timeout=45
conn.execute("update Manage_user set LastLogin=Now(),LastLoginIP='"&Request.ServerVariables("REMOTE_ADDR")&"' where username='"&uid&"'")
rs.close
set rs=nothing
response.redirect "admin.asp"
end if
end if
%>