用户注册及跟踪代码(三)

网络整理 - 07-26
2. ASP代码(设立一DSN,请改动begin.asp)
----------------------------------
-----文件reg_step2.asp
<%
ValidCodeLogin=Request.QueryString("VailCodeLogin")
u_name=Request.QueryString("name")

if ValidCodeLogin="" or u_name="" then
Response.Redirect "reg_step1.asp"
Response.end
end if
%>
<html>
<head>
<title>详细信息填写</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/lotsty1.css">
<script LANGUAGE="Javascript1.1">
function isPosInteger(inputVal) {
    inputStr = inputVal.toString()
    for (var i = 0; i < inputStr.length; i++) {
        var oneChar = inputStr.charAt(i)
        if (oneChar < "0" || oneChar > "9") {
            return false
        }
    }
    return true
}

function CheckForm(form) {
    for (i = 0; i <document.forms[0].elements.length; i++) {
        if (document.forms[0].elements[i].type == "text" && document.forms[0].elements[i].value == ""){
            alert("所有内容必须填写!")
            return false;
        }
    }
    if (document.forms[0].email.value.indexOf("@")==-1 || document.forms[0].email.value.indexOf(".")==-1 || document.forms[0].email.value.indexOf("@.")!=-1 || document.forms[0].email.value=="" || document.forms[0].email.value==null || document.forms[0].email.value.indexOf("@")==0){
    alert('E-mail未输入或格式有误,请查看!')
    return false
    }

    if(!isPosInteger(document.forms[0].year.value)){
    alert("年份必须是数字!")
    return false
    }
    if(!isPosInteger(document.forms[0].month.value)){
    alert("月份必须是数字!")
    return false
    }
    if(!isPosInteger(document.forms[0].date.value)){
    alert("日期必须是数字!")
    return false
    }
return true;
}
</script>
<link href="../css/sty1.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#333333">
<table cellspacing="0" cellpadding="0">
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td>
      <table cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top">  </td>
          <td valign="top">
            <table cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top"> </td>
                <td valign="top"> </td>
              </tr>
              <tr>
                <td valign="top">
                  <table cellspacing="0" cellpadding="0">
                    <tr>
                      <td  valign="top"> </td>
                      <td valign="top">
                        <table cellspacing="0" cellpadding="0">
                          <tr>
                            <td><font color="#006600">个人详细信息填写
                              </font></td>
                          </tr>
                          <tr valign="top">
                            <td>
                              <form method="post"action="reg_step2_sub.asp" >
                                <table cellspacing="4" cellpadding="0">
                                  <tr>
                                    <td colspan="2">
                                      <hr size="1" color="#669999">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td valign="bottom"><font color="#336600">真实姓名:</font></td>
                                    <td valign="top">
                                      <input type="text" size="10">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td valign="bottom"><font color="#336600">性别:</font></td>
                                    <td valign="top">
                                      <select>
                                        <option value="男" selected>男</option>
                                        <option value="女">女</option>
                                      </select>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td valign="bottom"><font color="#336600">生日:</font></td>
                                    <td valign="top">
                                      <input type="text" size="4">
                                      年
                                      <input type="text" size="2">
                                      月
                                      <input type="text" size="2">
                                      日 </td>
                                  </tr>
                                  <tr>
                                    <td><font color="#336600">身份证编号:</font></td>
                                    <td valign="top">
                                      <input type="text">
                                      <br>
                                      作为取货凭证,请务必正确填写。 </td>
                                  </tr>
                                  <tr>
                                    <td valign="bottom"><font color="#336600">联系地址:</font></td>
                                    <td valign="top">
                                      <input type="text">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td><font color="#336600">联系电话:</font></td>
                                    <td valign="top">
                                      <input type="text">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td><font color="#336600">Email地址:</font></td>
                                    <td valign="top">
                                      <input type="text">
                                      <br>
                                      中奖信息将以此E-mail地址发送。 </td>
                                  </tr>
                                  <tr>
                                    <td colspan="2">
                                      <hr size="1" color="#669999">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td colspan="2">
                                      <input type="submit" value="提交">
                                      <input type="reset" value="重填">
                                      <input type="hidden" value="<%=ValidCodeLogin%>" >
                                      <input type="hidden" value="<%=u_name%>" >
                                    </td>
                                  </tr>
                                  <tr>
                                    <td colspan="2">
                                      <hr size="1" color="#669999">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td colspan="2">
                                      <table cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td><font color="#FF6666">请查看上述信息的正确性,我们将据此来确认您的真实身份。
                                            </font></td>
                                        </tr>
                                      </table>
                                    </td>
                                  </tr>
                                </table>
                              </form>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td valign="top"> </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>

</html>


---文件reg_step2_sub.asp

<%
islogin=Request("isLogin")
u_name=Request("u_name")

if islogin="" or u_name="" then
Response.Redirect "reg_step1.asp"
Response.end
end if
%>
<!-- #include file = "../inc/adovbs.inc" -->
<!-- #include file = "../inc/begin.asp" -->
<html>
<head>
<title>详细信息填写</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/lotsty1.css">
<link href="../css/sty1.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#333333">
<table cellspacing="0" cellpadding="0">
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td>
      <table cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top">  </td>
          <td valign="top">
            <table cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top"> </td>
                <td valign="top"> </td>
              </tr>
              <tr>
                <td valign="top">
                  <table cellspacing="0" cellpadding="0">
                    <tr>
                      <td valign="top"> </td>
                      <td valign="top">
<%
true_name=Request("true_name")
sex=Request("sex")
birth=Request("year")&"-"&Request("month")&"-"&Request("date")

if IsDate(birth) then
birth=FormatDateTime(birth,1)
    if Year(birth)<=999 then %>
    <table cellspacing="0" cellpadding="0">
        <tr>
                            <td><font color="#CC0000">出生日期输入错误,<a href="javascript:history.go(-1)">返回。</a></font></td>
        </tr>
      </table>
      <%
Response.write "</body></html>"
Response.end
end if
else%>
      <table cellspacing="0" cellpadding="0">
        <tr>
                            <td><font color="#CC0000">出生日期输入错误,<a href="javascript:history.go(-1)">返回。</a></font></td>
        </tr>
      </table>
      <%
Response.write "</body></html>"
Response.end
end if

idcard=Request("idcard")
address=Request("address")
email=Request("email")
telephone=Request("telephone")

'response.write birth
'response.end

strSql="proc_UserInfoUpdate"
strSql=strSql & "  '" & islogin & "'"
strSql=strSql & " ,'" & true_name & "'"
strSql=strSql & " ,'" & sex & "'"
strSql=strSql & " ,'" & birth & "'"
strSql=strSql & " ,'" & idcard & "'"
strSql=strSql & " ,'" & address & "'"
strSql=strSql & " ,'" & email & "'"
strSql=strSql & " ,'" & telephone & "'"
Set rs = Con.Execute(strSql)
ret=rs.fields("resultID")
%>
                        <table cellspacing="0" cellpadding="0">
                          <%if ret=0 then%>
                          <tr>
                            <td><font color="#006600">您的个人信息填写如下:</font></td>
                          </tr>
                          <tr>
                            <td>
                              <hr size="1" color="#669999">
                            </td>
                          </tr>
                          <tr>
                            <td>真实姓名:<%=true_name%></td>
                          </tr>
                          <tr>
                            <td>性别:<%=sex%></td>
                          </tr>
                          <tr>
                            <td>生日:<%=birth%></td>
                          </tr>
                          <tr>
                            <td>身份证:<%=idcard%></td>
                          </tr>
                          <tr>
                            <td>地址:<%=address%></td>
                          </tr>
                          <tr>
                            <td>Email:<%=email%></td>
                          </tr>
                          <tr>
                            <td>联系电话:<%=telephone%></td>
                          </tr>
                          <tr>
                            <td>
                              <hr size="1" color="#669999">
                            </td>
                          </tr>
                          <tr>
                            <td>
                              <table cellspacing="0" cellpadding="0">
                                <tr>
                                  <td><font color="#FF6666">请查看上述信息的正确性,我们将据此来确认您的真实身份。</font></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                          <tr>
                            <td>
                              <p>请注意您现在已处于登录状态。</p>
                              <p><a href="winload.asp">>>登出--临时用<<</a></p>
                            </td>
                          </tr>
                          <%elseif MyCommand("ReturnCode")=-1 then %>
                          <tr>
                            <td><font color="#CC0000">请先登录。</font></td>
                          </tr>
                          <%elseif MyCommand("ReturnCode")=-2 then %>
                          <tr>
                            <td><font color="#CC0000">用户超时</font></td>
                          </tr>
                          <%elseif MyCommand("ReturnCode")=-3 then %>
                          <tr>
                            <td><font color="#CC0000">用户资料输入错误</font></td>
                          </tr>
                          <%else%>
                          <%end if%>
                        </table>
                       
                      </td>
                    </tr>
                  </table>
                </td>
                <td valign="top"> </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td> </td>
  </tr>
</table>
<%Con.Close%>
</body>
</html>


---文件winload.asp


<!-- #include file = "../inc/adovbs.inc" -->
<!-- #include file = "../inc/begin.asp" -->
<%
validlogin=Session("lotto_isLogin")
if validlogin<>"" then
Set MyComquit=Server.CreateObject("ADODB.Command")
Set MyComquit.ActiveConnection=Con
MyComquit.CommandType=adCmdStoredProc
MyComquit.CommandText="proc_UserLogout"
MyComquit.Parameters.Append MyComquit.CreateParameter("ReturnCode",adInteger,adParamReturnValue)
MyComquit.Parameters.Append MyComquit.CreateParameter("quitid",adVarChar,adParamInput,30)
MyComquit.Parameters("quitid")=validlogin
MyComquit.Execute()
end if
Session("lotto_isLogin")=""
Session("lotto_username")=""
Session("lotto_UserLevel")=""
%>
<%Con.Close%>
<meta http-equiv=refresh content='0;url=http://myang.533.net'>