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

📄 reguser.asp

📁 体育商城
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conn.asp" -->
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Redirect if username exists
MM_flag="MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
  MM_dupKeyRedirect="regerr.asp"
  MM_rsKeyConnection=MM_conn_STRING
  MM_dupKeyUsernameValue = CStr(Request.Form("user"))
  MM_dupKeySQL="SELECT user FROM user WHERE user='" & MM_dupKeyUsernameValue & "'"
  MM_adodbRecordset="ADODB.Recordset"
  set MM_rsKey=Server.CreateObject(MM_adodbRecordset)
  MM_rsKey.ActiveConnection=MM_rsKeyConnection
  MM_rsKey.Source=MM_dupKeySQL
  MM_rsKey.CursorType=0
  MM_rsKey.CursorLocation=2
  MM_rsKey.LockType=3
  MM_rsKey.Open
  If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then 
    ' the username was found - can not add the requested username
    MM_qsChar = "?"
    If (InStr(1,MM_dupKeyRedirect,"?") >= 1) Then MM_qsChar = "&"
    MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
    Response.Redirect(MM_dupKeyRedirect)
  End If
  MM_rsKey.Close
End If
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) <> "") Then

  MM_editConnection = MM_conn_STRING
  MM_editTable = "user"
  MM_editRedirectUrl = "regok.asp"
  MM_fieldsStr  = "user|value|password|value|pquestion|value|panswer|value|email|value|username|value|xingbie|value|City|value|address|value|snumber|value|zip|value|phone|value"
  MM_columnsStr = "user|',none,''|password|',none,''|pquestion|',none,''|panswer|',none,''|email|',none,''|username|',none,''|xingbie|',none,''|city|',none,''|address|',none,''|snumber|',none,''|zip|',none,''|phone|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End if
    MM_tableValues = MM_tableValues & MM_columns(i)
    MM_dbValues = MM_dbValues & FormVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>	
function DoTrimProperly(str, nNamedFormat, properly, pointed, points)
  dim strRet
  strRet = Server.HTMLEncode(str)
  strRet = replace(strRet, vbcrlf,"")
  strRet = replace(strRet, vbtab,"")
  If (LEN(strRet) > nNamedFormat) Then
    strRet = LEFT(strRet, nNamedFormat)			
    If (properly = 1) Then					
      Dim TempArray								
      TempArray = split(strRet, " ")	
      Dim n
      strRet = ""
      for n = 0 to Ubound(TempArray) - 1
        strRet = strRet & " " & TempArray(n)
      next
    End If
    If (pointed = 1) Then
      strRet = strRet & points
    End If
  End If
  DoTrimProperly = strRet
End Function
</SCRIPT>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="ddd.css" type="text/css">
<script language="JavaScript">
<!--
function checkdata() {
if (document.registerForm.user.value=="") {
window.alert ("请输入您的用户名 !")
return false
}
if (document.registerForm.user.value.length<4) {
window.alert ("您的用户名必须大于4位 !")
return false
}
if (document.registerForm.user.value.length>10) {
window.alert ("您的用户名必须小于10位 !")
return false
}
if (document.registerForm.password.value=="") {
window.alert ("请输入您的密码 !")
return false
}
if (document.registerForm.password.value.length<4) {
window.alert ("您的密码数必须大于4位 !")
return false
}
if (document.registerForm.password.value.length>10) {
window.alert ("您的密码数必须小于10位 !")
return false
}
if (document.registerForm.qpassword.value=="") {
window.alert ("请输入您的确认密码 !")
return false
}
if (document.registerForm.qpassword.value!=document.registerForm. password.value) {
window.alert ("您的密码不一致 !")
return false
}
if (document.registerForm.pquestion.value=="") {
window.alert ("请输入您取回密码的问题 !")
return false
}
if (document.registerForm. panswer.value=="") {
window.alert ("请输入您取回密码的答案!")
return false
}
if (document.registerForm.email.value=="") {
window.alert ("请输入您EMAIL !")
return false
}
if (document.registerForm.username.value=="") {
window.alert ("请输入您的真实姓名 !")
return false
}
if (document.registerForm.City.value=="") {
window.alert ("请选择您所在城市 !")
return false
}
if (document.registerForm.address.value=="") {
window.alert ("请输入您的详细地址 !")
return false
}
if (document.registerForm.snumber.value=="") {
window.alert ("请输入身份证号码 !")
return false
}
if (document.registerForm.zip.value=="") {
window.alert ("请输入您的邮编 !")
return false
}
if (document.registerForm.phone.value=="") {
window.alert ("请输入您的电话 !")
return false
}
return true
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="top.asp" -->
<table width="771" border="0" cellspacing="0" cellpadding="0" align="center" height="305" class="bk1">
  <tr> 
    <td valign="top" height="525"><br>
      <br>
      <form name="registerForm" method="POST" action="<%=MM_editAction%>" onSubmit="return checkdata()">
        <table width="688" border="0" cellspacing="3" cellpadding="0" align="center" class="dfont">
          <tr valign="top"> 
            <td colspan="2" height="51"><img src="images/reg.gif" width="290" height="30"></td>
          </tr>
          <tr> 
            <td colspan="2" height="2" bgcolor="#99CC00"></td>
          </tr>
          <tr> 
            <td colspan="2"><font color="#FF0000">以下是你的登陆信息:</font></td>
          </tr>
          <tr> 
            <td width="121">用户名:</td>
            <td width="561"> 
              <input type="text" name="user">
            </td>
          </tr>
          <tr> 
            <td width="121">登录密码:</td>
            <td width="561"> 
              <input type="password" name="password">
            </td>
          </tr>
          <tr> 
            <td width="121">确认密码:</td>
            <td width="561"> 
              <input type="password" name="qpassword">
            </td>
          </tr>
          <tr> 
            <td colspan="2" height="2" bgcolor="#99CC00"></td>
          </tr>
          <tr> 
            <td colspan="2"><font color="#FF0000">以下是您忘记密码时用于取回密码的信息:</font></td>
          </tr>
          <tr> 
            <td width="121">密码问题:</td>
            <td width="561"> 
              <input type="text" name="pquestion">
            </td>
          </tr>
          <tr> 
            <td width="121">密码答案:</td>
            <td width="561"> 
              <input type="text" name="panswer">
            </td>
          </tr>
          <tr> 
            <td width="121">EMAIL:</td>
            <td width="561"> 
              <input type="text" name="email">
            </td>
          </tr>
          <tr> 
            <td colspan="2" bgcolor="#99CC00" height="2"></td>
          </tr>
          <tr> 
            <td colspan="2"><font color="#FF0000">以下为您的个人真实信息,请认真填写,以便我们为你更好的服务。(真实信息我们会为您保密)</font></td>
          </tr>
          <tr> 
            <td width="121">真实姓名:</td>
            <td width="561"> 
              <input type="text" name="username">
            </td>
          </tr>
          <tr> 
            <td width="121" height="11">性别:</td>
            <td width="561" height="11"> 
              <input type="radio" name="xingbie" value="男" checked>
              <input type="radio" name="xingbie" value="女">
              女</td>
          </tr>
          <tr> 
            <td width="121">所在城市:</td>
            <td width="561"> 
              <select name="City">
              </select>
              <script language=JavaScript 
      src="CitysName.js.htm"></script>
            </td>
          </tr>
          <tr> 
            <td width="121">详细地址:</td>
            <td width="561"> 
              <textarea name="address" rows="4" cols="40"></textarea>
            </td>
          </tr>
          <tr> 
            <td width="121">身份证号码:</td>
            <td width="561"> 
              <input type="text" name="snumber">
            </td>
          </tr>
          <tr> 
            <td width="121">邮政编码:</td>
            <td width="561"> 
              <input type="text" name="zip">
            </td>
          </tr>
          <tr> 
            <td width="121">联系电话:</td>
            <td width="561"> 
              <input type="text" name="phone">
            </td>
          </tr>
          <tr> 
            <td colspan="2" height="2" bgcolor="#99CC00"></td>
          </tr>
          <tr> 
            <td colspan="2" height="41"> 
              <div align="center"> 
                <input name=next onFocus=blur() style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px" type=submit value="注册">
                <input name=next2 onFocus=blur() style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px" type=reset value="重填">
              </div>
            </td>
          </tr>
        </table>
        <input type="hidden" name="MM_insert" value="true">
      </form>
    </td>
  </tr>
</table>
<br>
<!--#include file="bottom.asp" -->
</body>
</html>


<html></html>

⌨️ 快捷键说明

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