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

📄 newuser.asp

📁 ASP论坛2000
💻 ASP
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<!--#include file="newconn.asp"-->
<%
dim username
dim sex
dim useremail
dim userpassword
dim comefrom
dim homepage

username=replace(trim(request.form("username")),"<","&lt;")
sex=request.form("sex")
useremail=replace(trim(request.form("email")),"<","&lt;")
userpassword=replace(trim(request.form("password")),"<","&lt;")
comefrom=replace(trim(request.form("comefrom")),"<","&lt;")
homepage=replace(trim(request.form("homepage")),"<","&lt;")

on error resume next
dim cmdTemp
dim InsertCursor
dim dataconn
dim sql
dim rs
set rs=server.createobject("adodb.recordset")
sql="select username from user"
rs.open sql,conn,1,1
dim FoundUser
      FoundUser=false
      do while  not (rs.eof or err.number<>0)
         if ucase(rs("UserName"))=ucase(Trim(UserName)) then
            FoundUser=True
	       exit do 
	 end if
	 rs.movenext
      loop
if not FoundUser then
rs.close
Set DataConn = Server.CreateObject("ADODB.Connection")
dataconn.open connstr

Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT * FROM User WHERE (UserName IS NULL)"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = dataConn
InsertCursor.Open cmdTemp, , 1, 3
InsertCursor.AddNew
InsertCursor("UserName") = UserName
InsertCursor("sex")=sex
InsertCursor("useremail")=useremail
InsertCursor("UserPassword") = UserPassword
InsertCursor("comefrom")=comefrom
InsertCursor("homepage")=homepage
InsertCursor.Update
if err.number<>0 then 
   err.clear
   FoundError=true
   ErrMsg="数据库操作失败,请以后再试"&err.Description 
else
   response.write "<html><head>"
   response.write "<link rel=stylesheet type=text/css href=forum.css>"
   response.write "</head><body>"
   response.write "<p align=center><br>注册成功!请记住你的密码。<br></p>"
   response.write "</body></html>"

end if
InsertCursor.close
dataconn.close

else
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新手注册</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<link rel="stylesheet" type="text/css" href="forum.css">
<script  LANGUAGE="javascript">
<!--

function AddUser_onsubmit() {
if (document.AddUser.Username.value=="")
   {
      alert("请输入您的姓名!")
      document.AddUser.Username.focus()
      return false
    }
else if(document.AddUser.Password.value=="")
   {
      alert("请输入密码!")
      document.AddUser.Password.focus()
      return false
    }
else if(document.AddUser.ConfirmPwd.value=="")
   {
     alert("请输入确认密码!")
     document.AddUser.ConfirmPwd.focus()
     return false
    }
else if(document.AddUser.Password.value!=document.AddUser.ConfirmPwd.value)
   {
      alert("密码和确认密码不相同,请重新填写!")
      document.AddUser.Password.focus()
      return false
    }
else
   {
     return true
    }
}                    
//-->
</script>
</head>

<body>

<p align="left"><strong><font color="#FF8040">对不起,该用户名已经存在!请用别的名字注册。</font></strong></p>

<p align="center"><strong><font face="楷体_GB2312" size="5" color="#000080"><br>
新 手 注 册</font></strong></p>

<p align="center">请认真填写下面的内容(<font color="#FF8040"><strong>*</strong></font>为必填项目)</p>

<form method="POST" action="NewUser.asp" name="AddUser" LANGUAGE="javascript"
onsubmit="return AddUser_onsubmit()">
  <div align="center"><center><table border="0" cellpadding="0" width="80%">
    <tr>
      <td width="35%"><div align="right"><p>姓 名:</td>
      <td width="65%"><input type="text" name="Username" size="20" maxlength="20"
      class="smallInput" value="<%=username%>"><font color="#FF8040"><strong>*</strong></font></td>
    </tr>
    <tr>
      <td width="35%"><div align="right"><p>性 别:</td>
      <td width="65%"><input type="radio" value="男" checked name="Sex"><span class="smallFont">男</span> 
      <input type="radio" name="Sex" value="女"><span class="smallFont">女</span><font
      color="#FF8040"><strong> *</strong></font></td>
    </tr>
    <tr>
      <td width="35%"><div align="right"><p>Email:</td>
      <td width="65%"><input type="text" name="Email" size="20" maxlength="50"
      class="smallInput" value="<%=useremail%>"></td>
    </tr>
    <tr>
      <td width="35%"><div align="right"><p>密 码:</td>
      <td width="65%"><input type="password" name="Password" size="20" maxlength="10"
      class="smallInput"><font color="#FF8040"><strong>*</strong></font></td>
    </tr>
    <tr>
      <td width="35%"><div align="right"><p>确认密码:</td>
      <td width="65%"><input type="password" name="ConfirmPwd" size="20" maxlength="10"
      class="smallInput"><font color="#FF8040"><strong>*</strong></font></td>
    </tr>
    <tr>
      <td width="35%"><div align="right"><p>来 自:</td>
      <td width="65%"><input type="text" name="Comefrom" size="30" class="smallInput"
      maxlength="255" value="<%=comefrom%>"></td>
    </tr>
    <tr>
      <td width="35%"><div align="right"><p>主 页:</td>
      <td width="65%"><input type="text" name="Homepage" size="30" class="smallInput"
      maxlength="255" value="<%=homepage%>"></td>
    </tr>
  </table>
  </center></div><div align="center"><center><p><input type="submit" value=" 发送 "
  name="cmdOK" class="buttonface"> <input type="reset" value=" 重写 " name="cmdCancel"
  class="buttonface"></p>
  </center></div>
</form>


</body>
</html>
<%end if%>

⌨️ 快捷键说明

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