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

📄 user_reg.asp

📁 971音乐站全站程序
💻 ASP
字号:
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新用户注册</title>
<style>
body,td{font-size:12px}
.bk {color: #f78d00; border:1px #f78d00 solid;}
.Tips_bo {
	FONT-FAMILY: "Arial", "宋体";
	BORDER: 0px #f78d00 solid; 
	FONT-SIZE: 12px; 
	COLOR: #f78d00;  
	text-decoration: none; 
	POSITION: relative;
	HEIGHT: 19;
}
</style>
<script language="JavaScript">
<!--
function form1_onsubmit() {
if (document.form1.UserName.value=="")
	{
	  alert("错误! \n\n请设定您的用户名称。")
	  document.form1.UserName.focus()
	  return false
	 }
else if(document.form1.Userpass.value=="")
	{
	  alert("错误! \n\n请设定一个登陆密码。")
	  document.form1.Userpass.focus()
	  return false
	 }
else if(document.form1.Userpass2.value=="")
	{
	  alert("错误! \n\n请填验证密码。")
	  document.form1.Userpass2.focus()
	  return false
	 }
else if(document.form1.Usermail.value=="")
	{
	  alert("错误! \n\n请填写您的E-Mail地址。")
	  document.form1.Usermail.focus()
	  return false
	 }
else if(document.form1.truename.value=="")
	{
	  alert("错误! \n\n请输入你的真实姓名。")
	  document.form1.truename.focus()
	  return false
	 }
else if(document.form1.Userpass2.value!=document.form1.Userpass.value)
	{
	  alert("错误! \n\n两次输入的密码不一致。")
	  document.form1.Userpass.focus()
	  return false
	 }	
}
// -->
</script>
</head>
<body bgColor="#FFCC00" text="#000000" >
<center>
<%
Dim UserName,Userpass,Userpass2,Usermail,truename,usersex,userip,userip1,userip2

If request.QueryString("action")="save" Then
	UserName=replace(trim(Request.Form("UserName")),"'","‘")
	Userpass=replace(trim(Request.Form("Userpass")),"'","‘")
	Userpass2=replace(trim(Request.Form("Userpass2")),"'","‘")
	Usermail=trim(Request.Form("Usermail"))
	truename=trim(Request.Form("truename"))
	usersex=Request.Form("usersex")

	If UserName="" or Userpass="" or Userpass2="" or Usermail="" or truename="" or usersex="" or IsValidEmail(Usermail)=falseh Then
		Response.Write ("<font color=#ffffff>注册用户失败! 必须真实填写全部注册内容.</font>")
		Response.Write ("<br><br><a href='javascript:history.back();'><font color=#ffffff>返回</font></a>")
		Response.end
	End If
	userip1 = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	userip2 = Request.ServerVariables("REMOTE_ADDR")

	If userip1 = "" Then
		userip = userip2
	Else
		userip = userip1
	End If 	
	'conn.execute("insert into [user] (UserName,Password,Sex,Email,Name,LoginIP) values ('"&UserName&"','"&Userpass&"','"&usersex&"','"&Usermail&"','"&truename&"','"&userip&"')")

	set rs=server.createobject("adodb.recordset")
	sql="select * from [user] where username='"&UserName&"'"
	rs.open sql,conn,1,3
	if not rs.eof then
		Response.Write ("<font color=#ffffff>注册用户失败! 这个用户名已经被占用,请更换其他名称.</font>")
		Response.Write ("<br><br><a href='javascript:history.back();'><font color=#ffffff>返回</font></a>")
		Response.end
	else
		rs.addnew
		rs("username")=username
		rs("password")=Userpass
		rs("Sex")=usersex
		rs("email")=Usermail
		rs("Name")=truename
		rs("LoginIP")=userip
		rs.update
	end if
	rs.close
	Response.Write ("<font color=#ffffff>注册用户成功! <br>您现在可以立即登陆了.</font>")
	Response.Write ("<br><br><a href='javascript:window.close();'><font color=#ffffff>关闭窗口</font></a>")
	
	conn.close
	set conn=nothing
Else
%>
<form method="post" language="javascript" onsubmit="return form1_onsubmit()" action="?action=save" name="form1">
  <table width="359" border="0" bgcolor="#FFFFFF" height="27">
    <tr>
      <td height="33" width="344" align="center" colspan="2"> 用 户 注 册 <hr align="center" color="#ff0000" SIZE="1" width="98%"></td> 
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;用户名称:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=UserName class="bk"> 
        *登陆名称(中文/字母/数字)</td>    
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;用户密码:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=Userpass class="bk" type="password"> 
        *登陆密码(英文字母/数字)</td>     
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;验证密码:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=Userpass2 class="bk" type="password"> 
        *再重复输入一次用户密码</td>     
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;电子邮件:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=80 size=16 name=Usermail class="bk"> 
        *经常使用的E-mail</td>   
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;真实姓名:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=truename class="bk"> 
        *</td>    
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;用户称呼:</td>
      <td height="28" width="287">&nbsp;<select style="FONT-SIZE: 9pt" name="usersex" class="bk" size="1">    
                  <option value="先生"> 先 生 </option>
                  <option value="女士"> 女 士 </option>
        </select>  *</td>  
    </tr>
    <tr>
      <td height="1" width="349" colspan="2">
        <p align="center">&nbsp;&nbsp;<input type="submit" value=" 注 册 " name="B1" class="Tips_bo">&nbsp;&nbsp;   
        <input type="button" value=" 关 闭 " name="B3" class="Tips_bo" onclick="javascript:window.close();"><%Response.Write (MusicWord)%></p>
      </td>
    </tr>
  </table>
</form>
<%End If%>
</center>
</body>
</html>
<%


'检查EMAIL格式是否正确
Function IsValidEmail(email)
Dim names, name, i, c
IsValidEmail = TRUE
names = Split(email, "@")
If UBound(names) <> 1 Then
   IsValidEmail = FALSE
   Exit Function
End If
For Each name in names
   If Len(name) <= 0 Then
     IsValidEmail = FALSE
     Exit Function
   End If
   For i = 1 To Len(name)
     c = LCase(Mid(name, i, 1))
     'If InStr("`!@#$%^&*()+=|\?';:<>,。,~!·¥……—()——、;:“’《》?", c) <> 0 AND NOT IsNumeric(c) Then	'支持中文格式地址
     If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 AND NOT IsNumeric(c) Then	'不支持中文格式地址
       IsValidEmail = FALSE
       Exit Function
     End If
   Next
   If Left(name, 1) = "." or Right(name, 1) = "." Then
      IsValidEmail = FALSE
      Exit Function
   End If
Next
If InStr(names(1), ".") <= 0 Then
   IsValidEmail = FALSE
   Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 AND i <> 3 Then
   IsValidEmail = FALSE
   Exit Function
End If
If InStr(email, "..") > 0 Then
   IsValidEmail = FALSE
End If
End Function
%>

⌨️ 快捷键说明

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