📄 admin_index.asp
字号:
<!--#include file="Conn.asp"-->
<!--#include file="Md5.asp"-->
<%
'验证是否登陆
If session("username")="" then
Response.Write "<script>alert('你不是站长!');this.location.href='Index.asp';</SCRIPT>"
Response.End
End If
'退出
If Request.QueryString("action")="Quit" then
session("username")=""
Response.Write "<script>alert('已安全退出!');this.location.href='Index.asp';</SCRIPT>"
End If
'添加管理员
If Request.QueryString("action")="Admin_Add" then
username=request.form("username")
password=request.form("password")
If username="" or password="" then
Response.Write "<script>alert('管理员用户名或者密码不能为空!');this.location.href='?action=Admin_add';</SCRIPT>"
Response.End
End If
If len(password)<6 then
Response.Write "<script>alert('密码不要小于6个字符!;');this.location.href='?action=Admin_add';</SCRIPT>"
Response.End
End If
If request("password")<>request("password1") then
Response.Write "<script>alert('两次密码不一致!');this.location.href='?action=Admin_add';</SCRIPT>"
Response.End
End If
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin"
mRs.open Sql,conn,1,3
mRs.addnew
mRs("username")=trim(request("username"))
mRs("password")=md5(request("password"))
mRs.update
mRs.close
Set mRs=nothing
Response.Write "<script>alert('管理员添加成功!');this.location.href='?action=Admin_list';</SCRIPT>"
End If
'修改管理员
If Request.QueryString("action")="Admin_Modify" then
username=request.form("username")
password=request.form("password")
If username="" or password="" then
Response.Write "<script>alert('管理员用户名或者密码不能为空!');this.location.href='?action=Admin_list';</SCRIPT>"
Response.End
End If
If len(password)<6 then
Response.Write "<script>alert('密码不要小于6个字符!;');this.location.href='?action=Admin_list';</SCRIPT>"
Response.End
End If
If request("password")<>request("password1") then
Response.Write "<script>alert('两次密码不一致!');this.location.href='?action=Admin_list';</SCRIPT>"
Response.End
End If
Id=request("Id")
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin where Id="&Id
mRs.open Sql,conn,1,3
mRs("username")=request("username")
mRs("password")=md5(request("password"))
mRs.update
mRs.close
Set mRs=nothing
session("username")=""
Response.Write "<script>alert('修改成功,请重新登陆!');this.location.href='login.asp';</SCRIPT>"
End If
'删除管理员
If Request.QueryString("action")="Admin_del" then
Id=cint(trim(request("Id")))
Sql="delete * from A_admin where Id="&Id
conn.execute(Sql)
mRs.close
Set mRs=nothing
Response.Write "<script>alert('管理员删除成功!');this.location.href='?action=Admin_list';</SCRIPT>"
End If
'验证短信
If Request.QueryString("action")="Validate" then
dim Msg_Validate
Set mRs=Server.CreateObject("ADODB.RecordSet")
Sql="Select * from M_msg"
If Request("Msg_Validate")="0" then
mRs.open "update M_msg Set Msg_validate=1 where Id="&Request.QueryString("Id"),conn,1,3
Else
mRs.open "update M_msg Set Msg_validate=0 where Id="&Request.QueryString("Id"),conn,1,3
Set mRs=nothing
End If
Response.Write "<script>alert('验证成功!');this.location.href='Admin_index.asp';</SCRIPT>"
End If
'添加短信
If Request.QueryString("action")="Add" then
dim Msg_info
Msg_info=Request.form("Msg_info")
If Msg_info="" then
Response.Write "<script>alert('短信内容不能为空!');this.location.href='Admin_index.asp';</SCRIPT>"
ElseIf len(Msg_info)>150 or len(Msg_info)<5 then
Response.Write "<script>alert('短信内容请不要大于150个汉字小于5个汉字!');this.location.href='Admin_index.asp';</SCRIPT>"
Else
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from M_msg"
mRs.open Sql,conn,1,3
mRs.addnew
mRs("Msg_info")=trim(Request("Msg_info"))
mRs("Msg_Validate")=1
mRs.update
mRs.close
Set mRs=nothing
Response.Write "<script>alert('短信添加成功!');this.location.href='Admin_index.asp';</SCRIPT>"
End If
End If
'修改短信
If Request.QueryString("action")="Modify" then
Msg_info=Request.form("Msg_info")
If Msg_info="" then
Response.Write "<script>alert('短信内容不能为空!');this.location.href='Admin_index.asp';</SCRIPT>"
ElseIf len(Msg_info)>150 or len(Msg_info)<5 then
Response.Write "<script>alert('短信内容请不要大于150个汉字小于5个汉字!');this.location.href='Admin_index.asp';</SCRIPT>"
Else
Id=Request("Id")
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from M_msg where Id="&Id
mRs.open Sql,conn,1,3
mRs("Msg_info")=Request("Msg_info")
mRs.update
mRs.close
Set mRs=nothing
Response.Write "<script>alert('短信修改成功!');this.location.href='Admin_index.asp';</SCRIPT>"
End If
End If
'删除短信
If Request.QueryString("action")="Del" then
Id=cint(trim(Request("Id")))
Sql="delete * from M_msg where Id="&Id
conn.execute(Sql)
Set mRs=nothing
Response.Write "<script>alert('短信删除成功!');this.location.href='Admin_index.asp';</SCRIPT>"
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><% =Title %></title>
<style type="text/css">
body,td,th {
font-size: 12px;
color: #2E2E2E;
line-height: 20px;
scrollbar-base-color:#CCCCCC;
scrollbar-face-color:#FFFFFF;
scrollbar-track-color:#FFFFFF;
scrollbar-arrow-color:#CCCCCC;
scrollbar-3dlight-color:#CCCCCC;
scrollbar-highlight-color:#CCCCCC;
scrollbar-shadow-color:#FFFFFF;
scrollbar-darkshadow-color:#000000;
}
a:link {
color: #2E2E2E;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #2E2E2E;
}
a:hover {
text-decoration: none;
color: #FF6600;
border-bottom-color: #FF6600;
}
.text{
font-size: 12px;
border: 1px solid #CCCCCC;
background-color: transparent;
}
.button {
font-size: 12px;
border: 1px solid #CCCCCC;
background-color: transparent;
width: 50px;
}
.buttonb {
font-size: 12px;
border: 1px solid #CCCCCC;
background-color: transparent;
width: 20px;
}
.input {
font-size: 12px;
border: 1px solid #CCCCCC;
background-color: #FFFFFF;
width: 130px;
}
.inputb {
font-size: 12px;
border: 1px solid #CCCCCC;
background-color: transparent;
width: 30px;
}
</style>
</head>
<body>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="50%" align="center">
<tr>
<td height="25" width="20%">欢迎:<span class=style><% Response.Write session("username")%></span></td>
<td><a href="?action=Admin_list">管理员列表</a></td>
<td><a href="?action=Admin_add">添加管理员</a></td>
<td><a href="?action=Quit">安全退出</a></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="1" style="border-collapse: collapse" width="700" bgcolor="#F3F3F3" align="center">
<tr>
<td align="center">
<%
'添加管理员
If Request.QueryString("action")="Admin_add" then
%>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%">
<form action="?action=Admin_Add" method="post" style="margin:0" onSubmit="return doCheck();">
<tr>
<td height="33">添加管理员:</td>
<td>名称:</td>
<td><input name="username" type="text" class="input"></td>
<td>密码:</td>
<td><input name="password" type="password" class="input"></td>
<td>确认密码:</td>
<td><input name="password1" type="password" class="input"></td>
<td><input name="Submit3" type="submit" value=" 添 加 " class="button"></td>
</tr>
</form>
</table>
<%
End If
'修改管理员
If Request.QueryString("action")="Admin_modify" then
id=cint(trim(request("id")))
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin where Id="&Id
mRs.open Sql,conn,1,1
%>
<form action="?id=<% =request.QueryString("id") %>&action=Admin_Modify" method="post" style="margin:0">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -