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

2. ASP代码(设立一DSN,请改动begin.asp)
----------------------------------
-----文件reg_step2.asp

1   
2ValidCodeLogin=Request.QueryString("VailCodeLogin")   
3u_name=Request.QueryString("name")   
4  
5if ValidCodeLogin="" or u_name="" then   
6Response.Redirect "reg_step1.asp"   
7Response.end   
8end if   
  1<html>
  2<head>
  3<title>详细信息填写</title>
  4<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  5<link href="../css/lotsty1.css" rel="stylesheet"/>
  6<script language="JavaScript1.1">   
  7function isPosInteger(inputVal) {   
  8inputStr = inputVal.toString()   
  9for (var i = 0; i < inputStr.length; i++) {   
 10var oneChar = inputStr.charAt(i)   
 11if (oneChar < "0" || oneChar > "9") {   
 12return false   
 13}   
 14}   
 15return true   
 16}   
 17  
 18function CheckForm(form) {   
 19for (i = 0; i <document.forms[0].elements.length; i++) {   
 20if (document.forms[0].elements[i].type == "text" && document.forms[0].elements[i].value == ""){   
 21alert("所有内容必须填写!")   
 22return false;   
 23}   
 24}   
 25if (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){   
 26alert('E-mail未输入或格式有误,请查看!')   
 27return false   
 28}   
 29  
 30if(!isPosInteger(document.forms[0].year.value)){   
 31alert("年份必须是数字!")   
 32return false   
 33}   
 34if(!isPosInteger(document.forms[0].month.value)){   
 35alert("月份必须是数字!")   
 36return false   
 37}   
 38if(!isPosInteger(document.forms[0].date.value)){   
 39alert("日期必须是数字!")   
 40return false   
 41}   
 42return true;   
 43}   
 44</script>
 45<link href="../css/sty1.css" rel="stylesheet" type="text/css"/>
 46</head>
 47<body bgcolor="#FFFFFF" leftmargin="0" marginheight="0" marginwidth="0" text="#333333" topmargin="0">
 48<table border="0" cellpadding="0" cellspacing="0" width="750">
 49<tr>
 50<td height="46"> </td>
 51</tr>
 52<tr>
 53<td height="426">
 54<table border="0" cellpadding="0" cellspacing="0" width="777">
 55<tr>
 56<td height="386" valign="top" width="149">  </td>
 57<td height="386" valign="top" width="628">
 58<table border="0" cellpadding="0" cellspacing="0" width="620">
 59<tr>
 60<td height="12" valign="top" width="474"> </td>
 61<td height="12" valign="top" width="146"> </td>
 62</tr>
 63<tr>
 64<td height="367" valign="top" width="474">
 65<table border="0" cellpadding="0" cellspacing="0" width="474">
 66<tr>
 67<td height="368" valign="top" width="12"> </td>
 68<td class="txt105" height="368" valign="top" width="462">
 69<table align="center" border="0" cellpadding="0" cellspacing="0" width="400">
 70<tr align="center">
 71<td class="txt105" height="20" width="100%"><font color="#006600">个人详细信息填写   
 72</font></td>
 73</tr>
 74<tr valign="top">
 75<td height="346" width="100%">
 76<form action="reg_step2_sub.asp" method="post" onsubmit="return CheckForm(this)">
 77<table align="center" border="0" cellpadding="0" cellspacing="4" width="400">
 78<tr>
 79<td class="txt9" colspan="2">
 80<hr align="left" color="#669999" size="1"/>
 81</td>
 82</tr>
 83<tr>
 84<td align="right" class="txt9" valign="bottom" width="111"><font color="#336600">真实姓名:</font></td>
 85<td class="txt9" valign="top" width="277">
 86<input class="txt9" name="true_name" size="10" type="text"/>
 87</td>
 88</tr>
 89<tr>
 90<td align="right" class="txt9" valign="bottom" width="111"><font color="#336600">性别:</font></td>
 91<td class="txt9" valign="top" width="277">
 92<select class="txt9" name="sex">
 93<option selected="" value="男">男</option>
 94<option value="女">女</option>
 95</select>
 96</td>
 97</tr>
 98<tr>
 99<td align="right" class="txt9" valign="bottom" width="111"><font color="#336600">生日:</font></td>
100<td class="txt9" valign="top" width="277">
101<input class="txt9" name="year" size="4" type="text"/>   
102103<input class="txt9" name="month" size="2" type="text"/>   
104105<input class="txt9" name="date" size="2" type="text"/>   
106日 </td>
107</tr>
108<tr>
109<td align="right" class="txt9" width="111"><font color="#336600">身份证编号:</font></td>
110<td class="txt9" valign="top" width="277">
111<input class="txt9" name="idcard" type="text"/>
112<br/>   
113作为取货凭证,请务必正确填写。 </td>
114</tr>
115<tr>
116<td align="right" class="txt9" valign="bottom" width="111"><font color="#336600">联系地址:</font></td>
117<td class="txt9" valign="top" width="277">
118<input class="txt9" name="address" type="text"/>
119</td>
120</tr>
121<tr>
122<td align="right" class="txt9" height="23" width="111"><font color="#336600">联系电话:</font></td>
123<td class="txt9" height="23" valign="top" width="277">
124<input class="txt9" name="telephone" type="text"/>
125</td>
126</tr>
127<tr>
128<td align="right" class="txt9" width="111"><font color="#336600">Email地址:</font></td>
129<td class="txt9" valign="top" width="277">
130<input class="txt9" name="email" type="text"/>
131<br/>   
132中奖信息将以此E-mail地址发送。 </td>
133</tr>
134<tr>
135<td class="txt9" colspan="2">
136<hr align="left" color="#669999" size="1"/>
137</td>
138</tr>
139<tr align="center">
140<td class="txt9" colspan="2">
141<input class="txt9" name="Submit" type="submit" value="提交"/>
142<input class="txt9" name="reset" type="reset" value="重填"/>
143<input name="isLogin" type="hidden" value="```
144=ValidCodeLogin
145```"/>
146<input name="u_name" type="hidden" value="```
147=u_name
148```"/>
149</td>
150</tr>
151<tr align="center">
152<td class="txt9" colspan="2">
153<hr align="left" color="#669999" size="1"/>
154</td>
155</tr>
156<tr align="center">
157<td class="txt9" colspan="2">
158<table border="0" cellpadding="0" cellspacing="0" width="353">
159<tr>
160<td class="txt9" height="26" width="353"><font color="#FF6666">请查看上述信息的正确性,我们将据此来确认您的真实身份。   
161</font></td>
162</tr>
163</table>
164</td>
165</tr>
166</table>
167</form>
168</td>
169</tr>
170</table>
171</td>
172</tr>
173</table>
174</td>
175<td height="367" valign="top" width="146"> </td>
176</tr>
177</table>
178</td>
179</tr>
180</table>
181</td>
182</tr>
183</table>
184</body>
185</html>

---文件reg_step2_sub.asp

1   
2islogin=Request("isLogin")   
3u_name=Request("u_name")   
4  
5if islogin="" or u_name="" then   
6Response.Redirect "reg_step1.asp"   
7Response.end   
8end if   
 1<html>
 2<head>
 3<title>详细信息填写</title>
 4<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 5<link href="../css/lotsty1.css" rel="stylesheet"/>
 6<link href="../css/sty1.css" rel="stylesheet" type="text/css"/>
 7</head>
 8<body bgcolor="#FFFFFF" leftmargin="0" marginheight="0" marginwidth="0" text="#333333" topmargin="0">
 9<table border="0" cellpadding="0" cellspacing="0" width="750">
10<tr>
11<td height="50"> </td>
12</tr>
13<tr>
14<td>
15<table border="0" cellpadding="0" cellspacing="0" width="777">
16<tr>
17<td valign="top" width="149">  </td>
18<td valign="top" width="628">
19<table border="0" cellpadding="0" cellspacing="0" width="620">
20<tr>
21<td height="12" valign="top" width="474"> </td>
22<td height="12" valign="top" width="146"> </td>
23</tr>
24<tr>
25<td valign="top" width="474">
26<table border="0" cellpadding="0" cellspacing="0" width="471">
27<tr>
28<td valign="top" width="14"> </td>
29<td class="txt105" valign="top" width="457">   

true_name=Request("true_name")
sex=Request("sex")
birth=Request("year")&amp;"-"&amp;Request("month")&amp;"-"&amp;Request("date")

if IsDate(birth) then
birth=FormatDateTime(birth,1)
if Year(birth)&lt;=999 then

1<table align="center" border="0" cellpadding="0" cellspacing="0" width="400">
2<tr align="center">
3<td class="txt9" height="120" width="400"><font color="#CC0000">出生日期输入错误,<a class="link8" href="javascript:history.go(-1)">返回。</a></font></td>
4</tr>
5</table>   

Response.write "</td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

1"   
2Response.end   
3end if   
4else
1<table align="center" border="0" cellpadding="0" cellspacing="0" width="400">
2<tr align="center">
3<td class="txt9" height="120" width="400"><font color="#CC0000">出生日期输入错误,<a class="link8" href="javascript:history.go(-1)">返回。</a></font></td>
4</tr>
5</table>
 1   
 2Response.write "
 3"   
 4Response.end   
 5end if   
 6  
 7idcard=Request("idcard")   
 8address=Request("address")   
 9email=Request("email")   
10telephone=Request("telephone")   
11  
12'response.write birth   
13'response.end   
14  
15strSql="proc_UserInfoUpdate"   
16strSql=strSql & " '" & islogin & "'"   
17strSql=strSql & " ,'" & true_name & "'"   
18strSql=strSql & " ,'" & sex & "'"   
19strSql=strSql & " ,'" & birth & "'"   
20strSql=strSql & " ,'" & idcard & "'"   
21strSql=strSql & " ,'" & address & "'"   
22strSql=strSql & " ,'" & email & "'"   
23strSql=strSql & " ,'" & telephone & "'"   
24Set rs = Con.Execute(strSql)   
25ret=rs.fields("resultID")   
1<table align="center" border="0" cellpadding="0" cellspacing="0" width="400">   

if ret=0 then

 1<tr>
 2<td align="center" class="txt9" height="20" width="400"><font color="#006600">您的个人信息填写如下:</font></td>
 3</tr>
 4<tr>
 5<td align="center" class="txt9" height="20" width="400">
 6<hr align="left" color="#669999" size="1"/>
 7</td>
 8</tr>
 9<tr>
10<td align="center" class="txt9" height="20" width="400">真实姓名:```
11=true_name
12```</td>
13</tr>
14<tr>
15<td align="center" class="txt9" height="20" width="400">性别:```
16=sex
17```</td>
18</tr>
19<tr>
20<td align="center" class="txt9" height="20" width="400">生日:```
21=birth
22```</td>
23</tr>
24<tr>
25<td align="center" class="txt9" height="20" width="400">身份证:```
26=idcard
27```</td>
28</tr>
29<tr>
30<td align="center" class="txt9" height="20" width="400">地址:```
31=address
32```</td>
33</tr>
34<tr>
35<td align="center" class="txt9" height="20" width="400">Email:```
36=email
37```</td>
38</tr>
39<tr>
40<td align="center" class="txt9" height="20" width="400">联系电话:```
41=telephone
42```</td>
43</tr>
44<tr>
45<td align="center" class="txt9" height="20" width="400">
46<hr align="left" color="#669999" size="1"/>
47</td>
48</tr>
49<tr align="center">
50<td class="txt105" height="22" width="400">
51<table border="0" cellpadding="0" cellspacing="0" width="320">
52<tr>
53<td class="txt9" height="26" width="320"><font color="#FF6666">请查看上述信息的正确性,我们将据此来确认您的真实身份。</font></td>
54</tr>
55</table>
56</td>
57</tr>
58<tr align="center">
59<td class="txt9" height="17" width="400">
60<p>请注意您现在已处于登录状态。</p>
61<p><a href="winload.asp">&gt;&gt;登出--临时用&lt;&lt;</a></p>
62</td>
63</tr>   

elseif MyCommand("ReturnCode")=-1 then

1<tr>
2<td align="center" class="txt105" height="120" width="400"><font color="#CC0000">请先登录。</font></td>
3</tr>   

elseif MyCommand("ReturnCode")=-2 then

1<tr>
2<td align="center" class="txt105" height="120" width="400"><font color="#CC0000">用户超时</font></td>
3</tr>   

elseif MyCommand("ReturnCode")=-3 then

1<tr>
2<td align="center" class="txt105" height="120" width="400"><font color="#CC0000">用户资料输入错误</font></td>
3</tr>   

else

end if

1</table>
1<td valign="top" width="146"> </td>
1<tr align="center">
2<td height="76"> </td>
3</tr>
1Con.Close

---文件winload.asp

 1   
 2validlogin=Session("lotto_isLogin")   
 3if validlogin<>"" then   
 4Set MyComquit=Server.CreateObject("ADODB.Command")   
 5Set MyComquit.ActiveConnection=Con   
 6MyComquit.CommandType=adCmdStoredProc   
 7MyComquit.CommandText="proc_UserLogout"   
 8MyComquit.Parameters.Append MyComquit.CreateParameter("ReturnCode",adInteger,adParamReturnValue)   
 9MyComquit.Parameters.Append MyComquit.CreateParameter("quitid",adVarChar,adParamInput,30)   
10MyComquit.Parameters("quitid")=validlogin   
11MyComquit.Execute()   
12end if   
13Session("lotto_isLogin")=""   
14Session("lotto_username")=""   
15Session("lotto_UserLevel")=""   
1Con.Close
1<meta content="0;url=http://myang.533.net" http-equiv="refresh"/>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus