login.asp

来自「本系统由齐齐哈尔职业学院计算机软件052班 袁利峰 开发, 版权属于 袁利峰 所」· ASP 代码 · 共 97 行

ASP
97
字号
<%@ CODEPAGE = "936" %>
<!--#include file="Connections.asp" -->

<html>
<head>
<title>管理登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
function CheckForm()
{
	if (document.form1.textfield.value.length == 0)
 {
		alert("请输入用户名.");
		document.form1.textfield.focus();
		return false;
	}
	if (document.form1.textfield.value.indexOf("<")!=-1 || document.form1.textfield.value.indexOf(">")!=-1)
{
		alert("用户名中包含非法字符 (<,>) ");
		document.form1.textfield.focus();
		return false;
	}
	if (document.form1.textfield.value.indexOf("'")!=-1)
{
		alert("用户名中包含非法字符 (') ");
		document.form1.textfield.focus();
		return false;
	}
	if (document.form1.textfield2.value.length == 0) 
{
		alert("请输入密码.");
		document.form1.textfield2.focus();
		return false;
	}
		return true;
}
</script>
<%
if request.querystring("action")="add" then
username=request.Form("textfield")
password=request.Form("textfield2")
username=replace(username,"'","’")
password=replace(password,"'","’")
sqlchk="select * from admin where admin='" & Username & "' and password='" & password & "'"
set rschk=conn.Execute (sqlchk)
if rschk.eof and rschk.bof then 
response.Redirect("login.asp?act=a")
else
session("25175guestbook")=username
response.Redirect("index.asp")
end if
%>
<%elseif request.querystring("action")="" then%>
</head>
 <!--#include file="bbs.css" -->
 <body background="images/dw.gif" topmargin="0" leftmargin="0">
 <!--#include file="top.asp" -->
   <div align="center"> 
     <table width="700" border="1" cellspacing="0" cellpadding="4" style="border-collapse: collapse" bordercolor="<%=bgcolor%>">
  <form name="form1" method="post" action="login.asp?action=add" onSubmit="return CheckForm();">
  <tr> 
      <td colspan="2" <%=hColor%> class=tdc1 height="23"> 
        <div align="center">管理登陆</div>
      </td>
    </tr>
    	<% if request.QueryString("act")="a" then%>
<tr> 
      <td colspan="2"   <%=tColor%> class=tdc1 height=23> 
        <div align="center">你输入的用户名或者密码错误</div>
      </td>
    </tr>
  <%end if%>
    <tr> 
      <td width="30%"  bgcolor=<%=tColor2%> class=tdc align="right">用户名:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <input type="text" name="textfield" class=tdc size="20">
      </td>
    </tr>
    <tr> 
      <td width="30%" bgcolor=<%=tColor2%> class=tdc align="right">密码:</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
          <input type="password" name="textfield2" class=tdc size="20">
      </td>
    </tr>
    <tr> 
      <td bgcolor=<%=tColor2%> class=tdc>&nbsp;</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <input type="submit" name="Submit" value="提交" class=bdtj>
        <input type="reset" name="Submit2" value="重设" class=bdtj>
          <input type="button" value="取消" name="B2" class=bdtj onClick="window.location.href='index.asp'">
        </td>
    </tr></form>
  </table>
</div>
</body>
</html>
<%end if%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?