📄 admin_login.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<% option explicit %>
<%
If Request("action") = "login" Then
Dim objXML,loadResult
Dim userNameNode, passwordNode
Set objXML = server.CreateObject("Msxml2.DOMDocument")
loadResult = objXML.Load(server.MapPath("config.xml"))
If Not loadResult Then
Response.Write ("加载config.xml文件出错。")
Response.end
End If
Set userNameNode = objXML.getElementsByTagName("用户名")
Set passwordNode = objXML.getElementsByTagName("密码")
If Request("text1")<> userNameNode.item(0).Text Then
Response.Write ("<strong><font color=""#FF0000"">用户名错误</strong></font>")
Else
If Request("text2") <> passwordNode.item(0).Text Then
Response.Write ("<strong><font color=""#FF0000"">密码错误</strong></font>")
Else
Response.Cookies("isAdmin") = "yes"
Response.Redirect ("admin.asp")
'response.Write("登陆成功")
Response.End
End If
End If
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理员登录</title>
<style type="text/css">
body,tr,td {
text-align: center;
font-family: 宋体;
font-size: 13px
}
</style>
<script language="JavaScript">
function checkInput(){
if (document.form1.text1.value==""){
alert("请输入用户名");
document.form1.text1.focus();
return false;
}else if(document.form1.text2.value==""){
alert("请输入密码")
document.form1.text2.focus();
return false;
}else{
return true;
}
}
</script>
</head>
<body>
<table width="730" border="0" bgcolor="#FFFFCC" cellpadding="3" cellspacing="1" align="center">
<tr>
<td height="28"><font color="#FF6699"><strong>管理员登录</strong></font></td>
</tr>
<tr>
<td height="100">
<form action="admin_login.asp" method="post" name="form1" onSubmit="return checkInput();" target="_self">
<input type="hidden" name="action" value="login">
<table width="400" border="0" bgcolor="#003399" cellpadding="3" cellspacing="1" align="center">
<tr bgcolor="#FFFFCC">
<td width="84"><font color="#FF6699"><strong> 用户名</strong></font></td>
<td width="201">
<div align="left">
<input type="text" name="text1" style="width:150px">
</div></td></tr>
<tr bgcolor="#FFFFCC">
<td><font color="#FF6699"><strong>密 码</strong></font></td>
<td>
<div align="left">
<input type="password" name="text2" style="width:150px">
</div></td></tr>
<tr bgcolor="#FFFFCC">
<td colspan="2"><div align="center"></div>
<div align="center">
<input type="submit" name="Submit" value="login">
<input type="reset" name="Submit2" value="reset">
</div></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -