% if session("adminlgOk")=true then response.Redirect("admin_main.asp") else session("adminlgOk")=false end if dim sql,rs,action dim username,password action=trim(request.QueryString("action")) select case action case "checkLoginUser" call checkLoginUser() case "" call showLoginForm() end select function checkLoginUser() username=checkStr(trim(request.Form("username"))) password=md5(checkStr(trim(request.Form("password")))) //从数据库中查询用户名和密码 sql="select * from adminInfo where [username]='"&username&"' and [password]='"&password&"'" set rs=conn.execute(sql) if not rs.eof then session("adminlgOk")=true session("admin")=username response.Redirect("admin_main.asp") else response.Write("非法用户,请重新登陆") session("adminlgOk")=false end if end function function showLoginForm() %>
<% end function %>