⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_adminadd.asp

📁 大榕树网络文章管理系统
💻 ASP
字号:
<%
Option Explicit
Response.buffer=true
const purviewlevel=1
%>
<!--#include file="admin_PurviewChe.asp" -->
<!--#include file="../inc/md5.asp" -->
<!--#include file="../inc/function.asp" -->
<!--#include file="conn.asp" -->
<%
dim adminadd
adminadd=trim(request.form("adminadd"))
if adminadd="add" then
dim adminname,password,adminpass,adminpurview,founderr,errmsg
adminname=trim(request.form("adminname"))
password=trim(request.form("password"))
adminpass=trim(request.form("adminpass"))
adminpurview=trim(request.form("adminpurview"))
if adminname="" or strlength(adminname)>20 or strlength(adminname)<6 then
   founderr=true
   errmsg=errmsg & "<br><li>请输入用户名(不能小于6而大于20)</li>"
   else
   if instr(adminname,"=")>0 or instr(adminname,"%")>0 or instr(adminname,"'")>0 or instr(adminname,"?")>0 or instr(adminname,"&")>0 or instr(adminname,";")>0 or instr(adminname,",")>0 or instr(adminname," ")>0 or instr(adminname,"$")>0 or instr(adminname,chr(34))>0 or instr(adminname,chr(32))>0 or instr(adminname,chr(9))>0 then
   founderr=true
   errmsg=errmsg + "<br><li>用户名中含有非法字符!</li>"
   end if
end if
if password="" or strLength(password)<6 or strlength(password)>20 then
    founderr=true
    errmsg=errmsg + "<br><li>请输入密码(密码不能小于6而大于50)</li>"
    else
    if instr(password,"=")>0 or instr(password,"%")>0 or instr(password,"'")>0 or instr(password,"?")>0 or instr(password,"&")>0 or instr(password,";")>0 or instr(password,",")>0 or instr(password," ")>0 or instr(password,"$")>0 or instr(password,chr(34))>0 or instr(password,chr(32))>0 or instr(password,chr(9))>0 then
       founderr=true
       errmsg=errmsg + "<br><li>密码中含有非法字符!</li>"
    end if
end if
if adminpass="" then
    founderr=true
    errmsg=errmsg + "<br><li>请输入确认密码!</li>"
    else
    if password<>adminpass then
       founderr=true
       errmsg=errmsg + "<br><li>两次输入的密码不一致!</li>"
     end if
	 end if	
	if adminpurview="" then
	founderr=true
	errmsg=errmsg + "<br><li>管理员权限不能为空!</li>"
	end if
	if founderr=false then
    dim rs
	set rs=conn.execute("select * from admin where adminname='"&adminname&"'")
	if rs.bof or rs.eof then
	adminpass=md5(adminpass)
	conn.execute"insert into admin (adminname,adminpass,adminpurview) values ('"&adminname&"','"&adminpass&"','"&adminpurview&"')"
	founderr=false
	else
	founderr=true
	errmsg=errmsg + "<br><li>管理员已存在,请用另外的帐号!</li>"
	  end if
	  if founderr=false then
	  call regsuccess()
	  else
	  call writeerrmsg()  
	 end if 
	 rs.close
	 set rs=nothing
	 call closeconn()	
	end if 
end if 
%>
<%
sub regsuccess()
 response.write"<br><table align='center' width='350' border='0' cellpadding='2' cellspacing='0'>"
 response.write"<tr class='txt1'><td align='center'>添加成功!</td></tr>"
 response.write"<tr class='txt05'><td align='center'>你的用户名是:"&adminname&"<br></td></tr>"
 response.write"<tr class='txt05'><td align='center'><br>【<a href='admin_AdminMan.asp'>返回管理面板</a>】</td></tr>"
 response.end()
end sub

sub writeerrmsg()
response.write"<br><table align='center' width='350' border='0' cellpadding='2' cellspacing='0'>"
response.write"<tr class='txt04'><td align='center'>可能是以下的原因,导致添加失败!</td></tr>"
response.write"<tr class='txt05'><td >"&errmsg&"</td></tr>"
response.write"<tr class='txt05'><td align='center'><br>【<a href='javascript:onclick=history.go(-1)'>返回</a>】</td></tr>"

response.end()
end sub
 %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="Style.css" rel="stylesheet" type="text/css">
<script language=javascript>
function checkform()
{
if (window.document.form1.adminname.value=="")
{
alert("帐号不能为空!");
return false;
}
if (window.document.form1.password.value=="")
{
alert("密码不能为空!");
return false;
}
if (window.document.form1.adminpass.value=="")
{
alert("确认密码不能为空!");
return false;
}
if (window.document.form1.password.value!=window.document.form1.adminpass.value)
{
alert("两次输入的密码不一致!");
return false;
}
if (window.document.form1.adminpurview.value=="")
{
alert("权限不能为空!");
return false;
}
}
</script>
</head>

<body>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" class="txt1">欢迎添加管理员</td>
  </tr>
  <tr>
    <td align="center" class="txt05">[<a href="admin_AdminMan.asp">返回管理面板</a>]</td>
  </tr>
  <tr>
    <td><form name="form1" method="post" action="" onsubmit="return checkform();">
      <table width="98%"  border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#f5f8f5">
        <tr>
          <td width="46%" align="right" class="txt05"><strong>帐号:</strong><br>
            管理员登录帐号,不能小于6而大于20</td>
          <td width="54%"><input name="adminname" type="text" class="but" id="adminname" maxlength="20"></td>
        </tr>
        <tr>
          <td align="right" class="txt05"><strong>密码:</strong><br>
            管理员登录密码,不能小于6而大于50</td>
          <td><input name="password" type="password" class="but" id="password" maxlength="50"></td>
        </tr>
        <tr>
          <td align="right" class="txt05"><strong>确认密码:</strong><br>
            请将你的密码再输入一遍</td>
          <td><input name="adminpass" type="password" class="but" id="adminpass" maxlength="50"></td>
        </tr>
        <tr>
          <td align="right" class="txt05"><strong>权限:</strong><br>
            管理员所具有的权限</td>
          <td><select name="adminpurview" class="but" id="adminpurview">
            <option>请选择管理员权限</option>
            <option value="1">特级管理员</option>
            <option value="2">高级管理员</option>
            <option value="3">大类管理员</option>
            <option value="4">小类管理员</option>
            <option value="5">文章管理员</option>
          </select></td>
        </tr>
        <tr align="center">
          <td colspan="2"><input name="Submit" type="submit" class="but" value="添加">&nbsp;
            <input name="Submit2" type="reset" class="but" value="重置">
            <input name="adminadd" type="hidden" id="adminadd" value="add"></td>
          </tr>
      </table>
    </form></td>
  </tr>
  <tr>
    <td><table width="80%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td class="txt03"><strong>管理员权限说明:</strong><br>
          <strong>特级管理员:</strong>拥有一切权限;<br>
          <strong>高级管理员:</strong>除了管理员的管理外,拥有管理其它的一切权限;
		<br>
		<strong>大类管理员:</strong>除具有小类管理员权限外,可对调查、栏目、专题、公告、广告进行管理,可删除文章、公告,上传文件等;
		<br>
		<strong>小类管理员:</strong>除具有文章管理员权限外,可对文章评论、BBS、友情链接添加、管理、审核等;
		<br>
		<strong>文章管理员:</strong>具有添加、审核、管理文章的权限。</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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