<!--#include file="admin_head.asp"-->
<!--#include file="md5.asp"-->
<br><br>
<%
if request("method") = 1 then
Unid = Request.Form("Unid")
if Trim(Request.Form("username")) = "" then
Errmsg = "<li>请输入用户名。"
FoundErr = true
else
username = NewsXP.checkStr(Trim(Request.Form("username")))
end if
if Trim(Request.Form("pass1"))<>Trim(Request.Form("pass2")) then
Errmsg = Errmsg + "<li>输入的密码和确认密码不符。"
FoundErr = true
else
password = NewsXP.checkStr(Trim(Request.Form("pass1")))
password = md5(password,16)
end if
if Request.Form("flag") = "" then
Errmsg = Errmsg + "<li>发生异常错误。<li>错误编号为: error 104。<li>请和管理员联系解决问题。"
FoundErr = true
else
flag = Request.Form("flag")
end if
if Request.Form("flag1") = "" then
Errmsg = Errmsg + "<li>发生异常错误。<li>错误编号为: error 105。<li>请和管理员联系解决问题。"
FoundErr = true
else
flag1 = Request.Form("flag1")
end if
if Trim(Request.Form("user1")) = "" then
Errmsg = "<li>请输入姓名。"
else
user1 = NewsXP.checkStr(Trim(Request.Form("user1")))
end if
if FoundErr then
Call NewsXP.Err_List(Errmsg,1)
Response.end
end if
birth=date()
if Unid = "" then
Sql = "Select id from article_user where username = '"& username &"'"
set rs = conn.execute(Sql)
if rs.eof and rs.bof then
sqlstr = "insert into article_user(username,[password],flag,flag1,user1,birth)values('"& username &"','"& password &"','"& flag &"','"& flag1 &"','"& user1 &"',"& birth &")"
Conn.execute(sqlstr)
Response.Write("<script>alert(""添加用户成功"");location.href=""Admin_user.asp"";</script>")
Response.End()
else
Errmsg = "<li>您输入的用户名,数据库中已经存在了。"
Call NewsXP.Err_List(Errmsg,1)
Response.end
end if
Rs.close
else
if Trim(Request.Form("pass1"))<>"" or Trim(Request.Form("pass2"))<>"" then
sql = "Update article_user set username = '"& username &"',[password] = '"& password &"',flag = '"& flag &"',flag1 = '"& flag1 &"',user1 = '"& user1 &"' where id = " & Unid
conn.execute(sql)
Response.write("<script>alert(""修改成功"");location.href=""admin_user.asp"";</script>")
Response.end
else
sql = "Update article_user set username = '"& username &"',flag = '"& flag &"',flag1 = '"& flag1 &"',user1 = '"& user1 &"' where id = " & Unid
conn.execute(sql)
Response.write("<script>alert(""修改成功"");location.href=""admin_user.asp"";</script>")
Response.end
end if
end if
end if
Unid = Request("Unid")
if Unid = "" then
%>
<table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
<form name="form1" action="" method="post">
<tr>
<td colspan="2" align="center" height="30" background="image/tablebg.gif"><b>添
加 用 户 信 息</b> </td>
</tr>
<tr>
<td width="20%" height="25">用 户 名:</td>
<td height="25">
<input name="username" type="text" id="username" size="30" maxlength="20"></td>
</tr>
<tr>
<td height="25">密 码:</td>
<td height="25">
<input name="pass1" type="password" id="pass1" size="30" maxlength="20"></td>
</tr>
<tr>
<td height="25">确认密码:</td>
<td height="25">
<input name="pass2" type="password" id="pass2" size="30" maxlength="20"></td>
</tr>
<tr>
<td height="25">前台用户名:</td>
<td height="25">
<input name="user1" type="text" id="user1" size="30" maxlength="20"></td>
</tr>
<tr>
<td height="25">管理权限:</td>
<td height="25"> <input type="radio" name="flag" value="1">
高级管理员
<input type="radio" name="flag" value="2">
管理员
<input name="flag" type="radio" value="3" checked>
录入员</td>
</tr>
<tr>
<td height="25">发布权限:</td>
<td height="25"><input type="radio" name="flag1" value="1">
1
<input name="flag1" type="radio" value="2">
2
<input type="radio" name="flag1" value="3">
3
<input name="flag1" type="radio" value="4" checked>
4
<input type="radio" name="flag1" value="5">
1+2
<input name="flag1" type="radio" value="6">
1+3
<input type="radio" name="flag1" value="7">
2+3
<input name="flag1" type="radio" value="8">
1+2+3 </td>
</tr>
<tr>
<td height="25" colspan="2" align="center"><input type="submit" name="Submit" value="提交" class="tbutton">
<input type="reset" name="Submit2" value="重置" class="tbutton"></td>
</tr>
<input type="hidden" name="method" value="1">
</form>
</table>
<%
else
sql = "Select username,flag,flag1,user1 from article_user where id = " & Unid
set rs = conn.execute(sql)
if not rs.eof then
username = rs(0)
flag = rs(1)
flag1 = rs(2)
user1 = rs(3)
rs.close
end if
%>
<table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
<form name="form1" action="" method="post">
<input type="hidden" name="unid" value="<%=Unid%>">
<tr>
<td colspan="7" align="center" height="30" background="image/tablebg.gif"><b>修 改 用 户 信 息</b> </td>
</tr>
<tr>
<td width="20%" height="25">用 户 名:</td>
<td height="25">
<input name="username" type="text" id="username" size="30" maxlength="20" value="<%=username%>"></td>
</tr>
<tr>
<td height="25">密 码:</td>
<td height="25">
<input name="pass1" type="text" id="pass1" size="30" maxlength="20" value="<%=password%>" ></td>
</tr>
<tr>
<td height="25">确认密码:</td>
<td height="25">
<input name="pass2" type="text" id="pass2" size="30" maxlength="20" value="<%=password%>" ></td>
</tr>
<tr>
<td width="20%" height="25">姓 名:</td>
<td height="25">
<input name="user1" type="text" id="user1" size="30" maxlength="20" value="<%=user1%>"></td>
</tr>
<tr>
<td height="25">管理权限:</td>
<td height="25"> <input type="radio" name="flag" value="1" <%if flag = 1 then Response.write "checked"%>>
高级管理员
<input type="radio" name="flag" value="2" <%if flag = 2 then Response.write "checked"%>>
管理员
<input name="flag" type="radio" value="3" <%if flag = 3 then Response.write "checked"%>>
录入员</td>
</tr>
<tr>
<td height="25">发布权限:</td>
<td height="25">
<input type="radio" name="flag1" value="1" <%if flag1 = 1 then Response.write "checked"%>>
1
<input name="flag1" type="radio" value="2" <%if flag1 = 2 then Response.write "checked"%>>
2
<input type="radio" name="flag1" value="3" <%if flag1 = 3 then Response.write "checked"%>>
3
<input name="flag1" type="radio" value="4" <%if flag1 = 4 then Response.write "checked"%>>
4
<input type="radio" name="flag1" value="5" <%if flag1 = 5 then Response.write "checked"%>>
1+2
<input name="flag1" type="radio" value="6" <%if flag1 = 6 then Response.write "checked"%>>
1+3
<input type="radio" name="flag1" value="7" <%if flag1 = 7 then Response.write "checked"%>>
2+3
<input name="flag1" type="radio" value="8" <%if flag1 = 8 then Response.write "checked"%>>
1+2+3
</td>
</tr>
<tr>
<td height="25" colspan="2" align="center"><input type="submit" name="Submit" value="提交" class="tbutton">
<input type="reset" name="Submit2" value="重置" class="tbutton"></td>
</tr>
<input type="hidden" name="method" value="1">
</form>
</table>
<%end if%>
<!--#include file="admin_copy.asp"-->