📄 adduser.asp
字号:
<%
if not session("sfadmin") then response.redirect("welcome.asp")
%>
<!--#INCLUDE FILE="../inc/db_inc.asp"-->
<!--#INCLUDE FILE="../inc/md5_inc.asp"-->
<!--#INCLUDE FILE="../inc/char_inc.asp"-->
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK rel="stylesheet" href="image/style.css" type="text/css">
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="10" topmargin="10">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open StrConn
%>
<!--#INCLUDE FILE="checkadmin.asp"-->
<%
if request("step") = "2" then
errstr = ""
if len(request("username")) <2 or (not IsValidSqlValue(request("username"))) then errstr = errstr & "<li>用户名不得小于2个字符<BR>"
if request("password") = "" or len(request("password")) < 6 or request("password2") = "" or request("password") <> request("password2") then errstr = errstr & "<LI>密码不能少于6个字符, 重复输入密码时密码应一致<BR>"
if not IsValidEmail(request("email")) then errstr = errstr & "<li>email地址错误<BR>"
StrSql = "select userid from sf_user where email = '" & ChkSql(request("email")) & "'"
Set rs2 = Conn.Execute(StrSql)
if not (rs2.bof or rs2.eof) then errstr = errstr & "<li>email地址已经存在<BR>"
StrSql = "select userid from sf_user where username = '" & ChkSql(request("username")) & "'"
Set rs2 = Conn.Execute(StrSql)
if not (rs2.bof or rs2.eof) then errstr = errstr & "<li>用户名已经存在<BR>"
sex = request("sex")
if errstr = "" then
StrSql = "insert into sf_user(username, password, email, usergroup, homepage, qq, [like], sex, country, signature, showemail,invisible, usertitle, joindate, lastvisit, lastactivity, lastposttime, lastpostid, lastposttitle, posts, avatar, defineavatar, avatarwidth, avatarheight, birthday, ipaddress, rating) values("
StrSql = StrSql & "'" & ChkSql(request("username")) & "', "
StrSql = StrSql & "'" & md5(ChkSql(request("password"))) & "', "
StrSql = StrSql & "'" & ChkSql(request("email")) & "', "
StrSql = StrSql & "0, '', '', '', " & sex & ", '', '', 1, 0, '', '" & now() & "', '" & now() & "', '" & now() & "', '" & now() &"', 0, '', 0, '1.gif', '', 0, 0, '1900-01-01', '" & cstr(request.ServerVariables("REMOTE_ADDR")) & "', 0)"
Conn.Execute(StrSql)
StrSql = "select top 1 userid from sf_user order by userid DESC"
Set rs2 = Conn.Execute(StrSql)
if not (rs2.bof or rs2.eof) then
StrSql = "update sf_counter set usernum = usernum + 1, lastuser = '" & ChkSql(request("username")) & "', lastuserid = " & rs2("userid") & ", lastreg = '" & now() & "'"
Conn.Execute(StrSql)
end if
%>
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
<TR>
<TD bgcolor="#D1E3BF" align="center">添加新用户成功</TD>
</TR>
</TABLE>
<%
else
%>
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
<TR>
<TD bgcolor="#D1E3BF">出现错误:<BR><%= errstr %></TD>
</TR>
</TABLE>
<%
end if
else
%>
<FORM name="form1" method="post" action="adduser.asp">
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
<TR bgcolor="#D1E3BF" align="center">
<TD colspan="2"><B>添加新用户</B></TD>
</TR>
<tr>
<td bgcolor="#F5F5F5" width="30%" align="right">用户名:</td>
<td bgcolor="#FFFFFF" width="70%">
<input type="text" name="username" maxlength="50" size="16"></td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="right">密码:</td>
<td bgcolor="#FFFFFF">
<input type="password" name="password" maxlength="50" size="16"></td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="right">重复输入密码:</td>
<td bgcolor="#FFFFFF">
<input type="password" name="password2" maxlength="50" size="16">
</td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="right">性别:</td>
<td bgcolor="#FFFFFF">
<input type="radio" name="sex" value="1" checked>
帅哥
<input type="radio" name="sex" value="2">
美女</td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="right">E-mail:</td>
<td bgcolor="#FFFFFF">
<input type="text" name="email" maxlength="50" size="25"></td>
</tr>
<TR align="center">
<TD colspan="2" bgcolor="#FFFFFF">
<INPUT type="hidden" name="step" value="2">
<INPUT type="submit" name="Submit" value="确 定">
</TD>
</TR>
</TABLE>
</FORM>
<%
end if
%>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -