快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

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

2. ASP代码(设立一DSN,请改动begin.asp)
----------------------------------
------文件begin.asp
<%
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "test" ,"test","test"
%>
-----文件reg_step1.asp
<html>
<head>
<title>会员注册--基本信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE="JavaScript1.1">
function verifyIt(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].n_pass.value.length<6){
alert("密码不得少于6位")
return false
}
if (document.forms[0].n_pass.value!=document.forms[0].nq_pass.value){
alert("密码与确认密码不一致!")
document.forms[0].n_pass.value=""
document.forms[0].nq_pass.value=""
return false;
}
return true;
}
</SCRIPT>
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#333333">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="149" valign="top" >&nbsp; </td>
<td width="628" valign="top">
<table width="628" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="464" height="12" valign="top">&nbsp;</td>
<td width="164" height="12" valign="top">&nbsp;</td>
</tr>
<tr>
<td width="464" height="203" valign="top">
<table width="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10" height="198" valign="top">&nbsp;</td>
<td width="450" height="198" valign="top" align="center" class="txt105">
<form name="ord_1" action="reg_step1_sub.asp" onSubmit="return verifyIt(this)" method="post">
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td class="txt105" height="36"><font color="#336600">新会员注册-基本信息</font>
<hr size="1" align="left" color="#669999">
</td>
</tr>
<tr valign="top">
<td height="45">
<table width="400" border="0">
<tr>
<td width="150" class="txt105" align="right"><font color="#336600">用户名:</font></td>
<td width="240" class="txt105">


<input type="text" name="n_name" class="txt9" size="20">
</td>
</tr>
<tr>
<td width="150" class="txt105" align="right"><font color="#336600">密码:</font></td>
<td width="240" class="txt105">
<input type="password" name="n_pass" class="txt9" size="20">
<font color="#336600"> 至少6位</font></td>
</tr>
<tr>
<td width="150" class="txt105" align="right" height="33"><font color="#336600">确认密码:</font></td>
<td width="240" class="txt105" height="33">
<input type="password" name="nq_pass" class="txt9" size="20">
</td>
</tr>
</table>
</td>
</tr>
<tr align="center">
<td height="41">
<hr size="1" align="left" color="#669999">
<input type="submit" name="Submit" value="申请" class="txt9">
<input type="reset" name="reset" value="重填" class="txt9">
</td>
</tr>
<tr align="center">
<td class="txt105">&nbsp;</td>
</tr>
</table>
</form>

</td>
</tr>
</table>
</td>
<td width="164" valign="top">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

---文件reg_step1_sub.asp
<%
u_name=Request.Form("n_name")
u_pass=Request.Form("n_pass")

if u_name="" and u_pass="" 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 rel="stylesheet" href="../css/sty1.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#333333">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="49">&nbsp;</td>
</tr>
<tr>
<td>
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="147" valign="top" height="400">&nbsp; </td>
<td width="630" valign="top" height="400">
<table width="620" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="474" height="12" valign="top">&nbsp;</td>
<td width="146" height="12" valign="top">&nbsp;</td>
</tr>
<tr>
<td width="474" height="379" valign="top">
<table width="452" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18" height="376" valign="top">&nbsp;</td>
<td width="434" height="376" valign="top" class="txt105">
<p>
<%

if trim(u_name)="" then
Response.write "<div align=\\\'center\\\'><a class=\\\'link8\\\' href=\\\'javascript:history.go(-1)\\\'>用户名不能为空格,返回。</a></div>"
Response.write "</body></html>"
Response.end
else
u_name=rtrim(trim(u_name))
end if

if instr(u_name," ")<>0 then
Response.write "<div align=\\\'center\\\'><a class=\\\'link8\\\' href=\\\'javascript:history.go(-1)\\\'>用户名中不能包含空格,返回。</a></div>"
Response.write "</body></html>"
Response.end
end if

if instr(u_pass," ")<>0 then
Response.write "<div align=\\\'center\\\'><a class=\\\'link8\\\' href=\\\'javascript:history.go(-1)\\\'>密码中不能包含空格,返回。</a></div>"
Response.write "</body></html>"
Response.end
end if

Set MyCommand=Server.CreateObject("ADODB.Command")
Set MyCommand.ActiveConnection=Con
MyCommand.CommandType=adCmdStoredProc
MyCommand.CommandText="proc_UserRegBase"

MyCommand.Parameters.Append MyCommand.CreateParameter("u_name",adVarChar,adParamInput,30)
MyCommand.Parameters.Append MyCommand.CreateParameter("u_pass",adVarChar,adParamInput,30)

MyCommand.Parameters("u_name")=u_name
MyCommand.Parameters("u_pass")=u_pass


Set RS=MyCommand.Execute()

\\\'Set RS=Server.CreateObject("ADODB.RecordSet")
\\\'strSql="proc_userRegBase \\\'"&u_name&"\\\',\\\'"&u_pass&"\\\'"
\\\'SET RS=Con.Execute(strSql)

check_reg=RS("resultID")

if check_reg=0 then
set RS=rs.NextRecordSet
VailCodeLogin=rtrim(trim(RS("ValidCodeLogin")))
Session("lotto_isLogin")=rtrim(trim(RS("ValidCodeLogin")))
Session("lotto_username")=u_name

end if

RS.Close
Con.Close
%>
<%if check_reg=0 then%>
</p>
<table width="400" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="txt105" align="center"><font color="#336600">注
册 成 功!</font></td>
</tr>
<tr>
<td class="txt105" align="center">
<hr size="1" color="#669999">
</td>
</tr>
<tr>
<td class="txt105" align="center" height="35">
<p>用户名:<b><%=u_name%></b><br>
密码:<b><%=u_pass%></b></p>
</td>
</tr>
<tr>
<td class="txt9" height="188">
<hr size="1" color="#669999">
<table width="320" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td class="txt105" colspan="2">按<a href="reg_step2.asp?VailCodeLogin=<%=VailCodeLogin%>&name=<%=u_name%>"><font color="#336600">这里</font></a>,<a href="reg_step2.asp?VailCodeLogin=<%=VailCodeLogin%>&name=<%=u_name%>"><font color="#336600">填写具体的个人资料</font></a>。</td>
</tr>
<tr>
<td class="txt105" colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="txt105" width="18">&nbsp;</td>
<td class="txt105" width="302"><font color="#000000">注重,请仔细阅读下列事项:</font></td>
</tr>
<tr>
<td class="txt105" colspan="2" valign="top">
<hr size="1" color="#669999">
</td>
</tr>
<tr>
<td class="txt105" width="18" valign="top">1.</td>
<td class="txt105" width="302">假如您想进行网上订购, 必须填写更具体的个人资料。</td>
</tr>
<tr>
<td class="txt105" width="18" valign="top">2.</td>
<td class="txt105" width="302">假如您想以后填写, 请在登录状态,进入&quot;彩民社区&quot;-&quot;用户服务&quot;
功能区填写。</td>
</tr>
<tr>
<td class="txt105" width="18" valign="top">&nbsp;</td>
<td class="txt105" width="302">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="txt9" align="center">&nbsp;</td>
</tr>
</table>
<%end if%>
<%if check_reg=-1 then%>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td>&nbsp;</td>
</tr>
<tr align="center">
<td>&nbsp;</td>
</tr>
<tr align="center">
<td><a href="javascript:history.go(-1)" class="LINK8">该用户名已经存在,返回。</a></td>
</tr>
</table>
<%end if%>
</td>
</tr>
</table>
</td>
<td width="147" valign="top" height="379">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
返回类别: 教程
上一教程: ASP初学者常犯的几个错误
下一教程: WEB打印设置解决方案三(FILESYSTEM组件实现WEB打印)

您可以阅读与"用户注册及跟踪代码(二)"相关的教程:
· 用户注册及跟踪代码(三)
· 用户注册及跟踪代码(一)
· ASP创建EXCHANGE用户的一段代码
· 使用COOKIE来跟踪用户
· 建立一个广告交换及跟踪系统
    微笑服务 优质保证 索取样品