|
<% if request("action")="login" then %> <% Set conn = Server.CreateObject("ADODB.Connection") 'conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb") '数据库连接语句,替换成SQL Server的即可执行 StrCnn = "Provider=SQLOLEDB;Server=ahui;UID=sa;PWD=;Database=enterprise" conn.open strcnn set rs=server.createobject("adodb.recordset") sql="select admin,pass from admin where admin='"&request("admin")&"' and pass='"&request("pass")&"'" rs.open sql,conn,1,1 if rs.bof or rs.eof then response.write"<SCRIPT language=JavaScript>alert('用户名或密码错误!');" response.write"javascript:history.go(-1)</SCRIPT>" else response.cookies("admin")=request("admin") response.cookies("pass")=request("pass") session("admin")=request("admin") session("pass")=request("pass") response.redirect"index.asp" end if rs.close 'endconnection else session.abandon response.cookies("admin")="" response.cookies("pass")="" end if %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <body> <form name="form1" method="post" action="manage_news.asp?action=login"> <table width="97%" border="0" cellpadding="0" cellspacing="0" class="classdo2"> <tr> <td height="15" valign="top" align="center"> <table align=center border=0 cellpadding=1 cellspacing=1 height=190 width="97%" class="temp"> <tr> <td height=4 width="36%"></td> <td height=4 width="64%"></td> </tr> <tr> <td height=22 noWrap width="40%" align="center">用 户 名:</td> <td height=22 noWrap width="64%"> <input name=admin value="<%=request.cookies("admin")%>" size=11> </td> </tr> <tr> <td noWrap width="40%" height="19" align="center">密 码:</td> <td height=19 noWrap width="64%"> <input name=pass type=password value="<%=request.cookies("pass")%>" size=11> </td> </tr> <tr align=middle> <td height=2 width="40%"> <div align=center> <input type="submit" name="Submit" value="提交"> </div> </td> <td width="64%"> <div align=center> <input type="reset" name="Submit2" value="取消"> </div> </td> </tr> <tr align=middle> <td colspan=2 height=17> <div align="center"><font color="#5d91c0">〖忘记密码/修改资料〗</font></div> </td> </tr> </table> </td> </tr> </table> </form> </body> </html> |
|
|
|
sql="select admin,pass from [admin] where admin='"&trim(request("admin"))&"' and pass='"&trim(request("pass"))&"'"
rs.open sql,conn,1,1 if rs.bof and rs.eof then |
|