?? user_add.asp
字號:
<!--#include file="Conn.asp"-->
<!--#include file="Check.asp"-->
<!--#include file ="Inc/MD5.asp"-->
<html>
<head>
<title>管理中心</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="Image/style.css" type=text/css rel=stylesheet>
<script language="JavaScript" src="Image/js.js"></SCRIPT>
</head>
<%
If Request.QueryString("action")="add" Then
Call UserSave
Else
%>
<script language="JavaScript">
<!--
function chk(theForm){
if (theForm.name.value == ""){
alert("請輸入用戶名!");
theForm.name.focus();
return (false);
}
if (theForm.pwd.value == ""){
alert("密碼不能為空!");
theForm.pwd.focus();
return (false);
}
}
//-->
</script>
<body text="#000000">
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<form action="?action=add" method=post id=form1 name=form1 onSubmit="return chk(this)">
<tr bgcolor=ffffff align="center">
<th colspan=2 height=25>管理員管理--添加管理員 </th>
</tr>
<tr bgcolor=ffffff>
<td width="26%" align="right" class=forumrow>登陸名稱:</td>
<td width="74%" class=forumrow><input name="name" type=text maxlength="16"></td>
</tr>
<tr bgcolor=ffffff>
<td width="26%" align="right" class=forumrow>登陸密碼:</td>
<td width="74%" class=forumrow><input name="pwd" type="password" maxlength="16"></td>
</tr>
<tr align="center" bgcolor=ffffff>
<td colspan="2" class=forumrow><input type="submit" name="Submit" value="添 加"></td>
</tr>
</form>
</table>
<%End if%>
</html>
<%
Sub UserSave
Dim ad,pwd,rs,useradd,Sql
ad = Request.Form("name")
Set rs = Conn.execute("Select admin From [Admin] Where admin ='"&ad&"'")
If Not (Rs.Eof and Rs.Bof) Then
Response.write "<script language='javascript'>alert('此用戶已經(jīng)存在!');" & chr(13)
Response.write "window.document.location.href='javascript:history.go(-1)';</script>"
Else
pwd = MD5(Request.Form("pwd"))
Set useradd = Server.CreateObject("ADODB.RecordSet")
Sql = "Select admin,password,ip From [Admin] Where (ID is null)"
useradd.Open Sql,Conn,1,3
useradd.addNew
useradd("admin") = ad
useradd("password") = pwd
useradd("ip") = Request.ServerVariables("REMOTE_HOST")
useradd.update
useradd.Close
Conn.Close
Set useradd=Nothing
Set Conn=Nothing
Response.Write "<script language=javascript>alert('新用戶添加成功!');"
Response.Write "window.document.location.href='User_List.asp';</script>"
End If
Set rs = Nothing
End Sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -