如何返回用户的注册信息

sysdy 2001-12-28 09:46:03
我正在做一个用户注册的页面,想实现注册完后返回注册信息,不知代码该怎样写。
我的注册代码如下:
<%
name=Request.Form("name")
pwd=Request.Form("pwd")
sex=request.form("sex")
age=Request.Form("age")
email=Request.Form("email")
QQ=Request.Form("QQ")

Set DataCon=Server.CreateObject("ADODB.Connection")
Set Rs=Server.CreateObject("ADODB.Recordset")
DataCon.ConnectionTimeout=20
DataCon.Open "DSN=guestbook_server;uid=sysdy;pwd=185898"

sqlquery="select * from reg_info where name='"&name&"'"
set rs=datacon.execute(sqlquery)
if not rs.eof then
Response.Write "<html><body><center><font size=5>您的名字已经有人在使用。</font></center></body></html>"
else
sqlstr="insert into reg_info(name,pwd,sex,age,email,QQ)"
sqlstr=sqlstr & "values('"&name&"','"&pwd&"','"&sex&"','"&age&"','"&email&"','"&QQ&"')"
DataCon.Execute(sqlstr)
end if

response.write request.cookies("name")
response.write request.cookies("sex")
response.write request.cookies("age")
response.write request.cookies("email")
response.write request.cookies("QQ")
dataCon.close
%>
...全文
161 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ppsg 2001-12-29
  • 打赏
  • 举报
回复
当然然后想返回用户的注册信息只需读取这些session便可以了的--它们的“小命很长的”
ppsg 2001-12-29
  • 打赏
  • 举报
回复
最简单有效的办法,将那些值记入seesion便可以了:)
<%
name=Request.Form("name")
pwd=Request.Form("pwd")
sex=request.form("sex")
age=Request.Form("age")
email=Request.Form("email")
QQ=Request.Form("QQ")

session("name")=strFilter(request("name"))
session("sex")=strFilter(request("sex"))
session("age")=strFilter(request("age"))
session("email")=strFilter(request("email"))
session("QQ")=strFilter(request("QQ"))

Set DataCon=Server.CreateObject("ADODB.Connection")
Set Rs=Server.CreateObject("ADODB.Recordset")
DataCon.ConnectionT.............然后都一样了:)你试试瞧,应没问题的
mkiss 2001-12-29
  • 打赏
  • 举报
回复
参考一下这个:
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/char.asp"-->
<!--#include file="inc/email.asp"-->
<html>
<head>
<title>用户注册</title>
<LINK href="forum.css" rel=stylesheet></head>
<!--#include file="inc/theme.asp"--><body bgcolor="<%=Tablebodycolor%>" alink="#333333" vlink="#333333" link="#333333" topmargin="0" leftmargin="0">
<%
dim username
dim sex
dim pass1
dim pass2
dim password
dim useremail
dim face,width,height
dim oicq
dim sign
dim showRe
dim rs,sql
dim founderr
dim errmsg
dim boardtype
founderr=false

call chkinput
sub chkinput()
if request("name")="" or strLength(request("name"))>20 then
errmsg=errmsg+"<br>"+"<li>请输入您的用户名(长度不能大于20)。"
founderr=true
else
username=trim(request("name"))
end if
if Instr(request("name"),"=")>0 or Instr(request("name"),"%")>0 or Instr(request("name"),chr(32))>0 or Instr(request("name"),"?")>0 or Instr(request("name"),"&")>0 or Instr(request("name"),";")>0 or Instr(request("name"),",")>0 or Instr(request("name"),"'")>0 or Instr(request("name"),",")>0 or Instr(request("name"),chr(34))>0 then
errmsg=errmsg+"<br>"+"<li>用户名中含有非法字符。"
founderr=true
else
username=trim(request("name"))
end if
if request("sex")="" then
errmsg=errmsg+"<br>"+"<li>请选择您的性别。"
founderr=true
elseif request("sex")=0 or request("sex")=1 then
sex=request("sex")
else
errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
founderr=true
end if

if request("showRe")="" then
errmsg=errmsg+"<br>"+"<li>请选择您的帖子有回复时是否要提示您。"
founderr=true
elseif request("showRe")=0 or request("showRe")=1 then
showRe=request("showRe")
else
errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
founderr=true
end if

if request("psw")="" or strLength(request("psw"))>10 then
errmsg=errmsg+"<br>"+"<li>请输入您的密码(长度不能大于10)。"
founderr=true
else
pass1=request("psw")
end if
if request("pswc")="" or strLength(request("pswc"))>10 then
errmsg=errmsg+"<br>"+"<li>请输入确认密码(长度不能大于10)。"
founderr=true
else
pass2=request("pswc")
end if
if pass1<>pass2 then
errmsg=errmsg+"<br>"+"<li>您输入的密码和确认密码不一致。"
founderr=true
else
password=pass2
end if
if IsValidEmail(trim(request("e_mail")))=false then
errmsg=errmsg+"<br>"+"<li>您的Email有错误。"
founderr=true
else
useremail=trim(request("e_mail"))
end if
if request.form("myface")<>"" then
if request("width")="" or request("height")="" then
errmsg=errmsg+"<br>"+"<li>请输入图片的宽度和高度。"
founderr=true
elseif not isInteger(request("width")) or not isInteger(request("height")) then
errmsg=errmsg+"<br>"+"<li>您输入的字符不合法。"
founderr=true
elseif request("width")<20 or request("width")>80 then
errmsg=errmsg+"<br>"+"<li>您输入的图片宽度不符合标准。"
founderr=true
elseif request("height")<20 or request("height")>80 then
errmsg=errmsg+"<br>"+"<li>您输入的图片高度不符合标准。"
founderr=true
else
face=request("myface")
width=request("width")
height=request("height")
end if
else
if request("face")="" then
errmsg=errmsg+"<br>"+"<li>请选择您的个性头像。"
founderr=true
elseif Instr(request("face"),picurl)>0 then
face=request("face")
width=32
height=32
else
errmsg=errmsg+"<br>"+"<li>您选择了错误的头像。"
founderr=true
end if
end if
if request("oicq")<>"" then
if not isnumeric(request("oicq")) or len(request("oicq"))>10 then
errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-10位数字,您可以选择不输入。"
founderr=true
end if
end if
end sub

sub saveuserinfo()

set rs=server.createobject("adodb.recordset")
sql="select * from resu where username='"&username&"'"
rs.open sql,conn,3,3
if not rs.eof and not rs.bof or username="动网小精灵" then
errmsg=errmsg+"<br>"+"<li>对不起,您输入的用户名已经被注册,请重新输入。"
founderr=true
else
rs.addnew
rs("username")=username
rs("userpassword")=password
rs("useremail")=useremail
rs("userclass")=1

if request("Signature")<>"" then
rs("sign")=trim(request("Signature"))
end if
if request("oicq")<>"" then
rs("oicq")=request("oicq")
end if
Rs("article")=0
Rs("lockuser")=0
Rs("sex")=sex
Rs("showRe")=showRe
Rs("addDate")=NOW()
rs("face")=face
Rs("width")=width
Rs("height")=height
rs("logins")=1
Rs("lastlogin")=NOW()
rs("userWealth")=wealthReg
rs("userEP")=epReg
rs("usercP")=cpReg
rs.update
rs.close
set rs=nothing
conn.execute("update config set usernum=usernum+1,lastuser='"&username&"'")
conn.close
set conn=nothing
end if
end sub

if founderr=true then
call error()
else
call saveuserinfo()
if founderr=true then
call error()
else
%>
<br>
<TABLE border=0 width="95%" align=center>
<TBODY>
<TR>
<TD vAlign=top width=30%><a href="<%=HostURL%>"><img border="0" src="<%=logo%>"></a></TD>
<TD valign=middle align=top>   <img src="<%=picurl%>closedfold.gif" border=0>  <a href="index.asp"><%=ForumName%></a><br>
  <img src="<%=picurl%>bar.gif" border=0 width=15 height=15><img src="<%=picurl%>openfold.gif" border=0>  注册成功</a>
</TD>
</TR>
</TBODY>
</TABLE>
<br>
<table cellpadding=0 cellspacing=0 border=0 width=500 bgcolor=<%=aTablebackcolor%> align=center>
<tr>
<td>
<table cellpadding=3 cellspacing=1 border=0 width=500>
<TBODY>
<TR align=middle bgcolor=<%=aTabletitlecolor%>>
<TD colSpan=2 height=24><b>用户注册成功</b></TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD colspan=2><center><b>
<%
topic="您在"&ForumName&"注册的个人资料"
mailbody=mailbody &"<style>A:visited { TEXT-DECORATION: none }"
mailbody=mailbody &"A:active { TEXT-DECORATION: none }"
mailbody=mailbody &"A:hover { TEXT-DECORATION: underline overline }"
mailbody=mailbody &"A:link { text-decoration: none;}"
mailbody=mailbody &"A:visited { text-decoration: none;}"
mailbody=mailbody &"A:active { TEXT-DECORATION: none;}"
mailbody=mailbody &"A:hover { TEXT-DECORATION: underline overline}"
mailbody=mailbody &"BODY { FONT-FAMILY: 宋体; FONT-SIZE: 9pt;}"
mailbody=mailbody &"TD { FONT-FAMILY: 宋体; FONT-SIZE: 9pt }</style>"
mailbody=mailbody &"<TABLE border=0 width='95%' align=center><TBODY><TR><TD>"
mailbody=mailbody &""&htmlencode(username)&",您好:<br><br>"
mailbody=mailbody &"欢迎您注册本论坛,我们将提供给您最好的论坛服务!<br>"
mailbody=mailbody &"下面是您的注册信息:<br>"
mailbody=mailbody &"注册名:"&htmlencode(username)&"<br>"
mailbody=mailbody &"密 码:"&htmlencode(password)&"<br>"
mailbody=mailbody &"<br><br>"
mailbody=mailbody &"<center><font color=red>再次感谢您注册本系统,让我们一起来建设这个网上家园!</font>"
mailbody=mailbody &"<br><br><br>"
mailbody=mailbody &"<tr align=right><td><font size=3.5pt>ASPSKY.NET "&now()&"</font></td></tr>"
mailbody=mailbody &"<br><br><br><br><br>"
mailbody=mailbody &"***********************************************************************************************"
mailbody=mailbody &"动网先锋论坛为您及时解决任何学习当中的问题:<A HREF=HTTP://WWW.ASPSKY.NET/club/>动网论坛</a>"
mailbody=mailbody &"动网先锋教学为您提供最好的ASP在先学习文章:<A HREF=HTTP://WWW.ASPSKY.NET/ARTICLE/>动网网校</a>"
mailbody=mailbody &"动网先锋原码下载为您提供最好ASP原程序:<A HREF=HTTP://WWW.ASPSKY.NET/download/>动网下载</a>"
mailbody=mailbody &"***********************************************************************************************"
mailbody=mailbody &""©right&"  "&Version&""
mailbody=mailbody &"</TD></TR></TBODY></TABLE>"
on error resume next
%>
<%if EmailFlag=0 then%><center>
<b>欢迎使用本系统,有任何问题,请与网管(<a href=mailto:<%=systememail%>><%=systememail%></A>)联系!</b>
<%elseif EmailFlag=1 then
Response.Write "<center><b> 一封注册信已经发送到你您注册时填写的信箱,请查收!</b>"
email = useremail
call Jmail(email)
%>
<%elseif EmailFlag=2 then
Response.Write "<center><b> 一封注册信已经发送到你您注册时填写的信箱,请查收!</b>"
email = useremail
call Cdonts(email)
%>
<%elseif EmailFlag=3 then
Response.Write "<center><b> 一封注册信已经发送到你您注册时填写的信箱,请查收!</b>"
email = useremail
call Aspemail(email)
end if
%>
</TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD width=35% height="32">注 册 名**</TD>
<TD><%=htmlencode(username)%></TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">性 别</TD>
<TD>
<%if sex=1 then%>

<%else%>

<%end if%>
</TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">密    码**</TD>
<TD><%=htmlencode(password)%> </TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height=32 width="150">Email地址 **</TD>
<TD><%=useremail%></TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height=32 width="150">形象**</TD>
<TD><img src="<%=face%>">
</TR>
<% if groupFlag then %>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">门 派</TD>
<TD><%=request.form("userGroup")%>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">财 产</TD>
<TD><%=wealthReg%>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">经验值</TD>
<TD><%=EPReg%>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">魅力值</TD>
<TD><%=CPReg%>
</TR>
<tr bgcolor=<%=Tablebodycolor%>>
<td height="32" width="150">有回帖时是否提示</td>
<td>
<%if showRe=1 then
response.write "提示"
else
response.write "不提示"
end if
%>
</tr>
<% end if%>
<TR bgcolor=<%=Tablebodycolor%>>
<TD height="32" width="150">OICQ号码</TD>
<TD>
<%if request("oicq")="" then%>
未注册
<%else%>
<%=request("oicq")%>
<%end if%>
</TD>
</TR>
<TR bgcolor=<%=Tablebodycolor%>>
<TD width=150>签 名<BR>
<BR>
文字将出现在您发表的文章的结尾处。体现您的个性。 </TD>
<TD>
<%if trim(request("Signature"))="" then%>
未填写
<%else%>
<%=trim(request("Signature"))%>
<%end if%>
</TD>
</TR>
<TR align=middle bgcolor=<%=aTabletitlecolor%>>
<TD colSpan=2 align=center>
<a href=login.asp>请登陆论坛</a>
</TD>
</TR>
</TBODY>
</TABLE>
</td>
</tr>
</table>
<%
end if
end if
%>
<p align=center><%=ads2%> <%=Copyright%> <%=Version%> </p>
</body>
希偌 2001-12-29
  • 打赏
  • 举报
回复
写进数据库后再读出不好吗,cookies是针对某一客户端的,
这样的话
Response.Write "<html><body><center><font size=5>您的名字已经有人在使用。</font></center></body></html>"
就不可能执行了
julyclyde 2001-12-29
  • 打赏
  • 举报
回复
aspx正好用在这里
BrightEye 2001-12-28
  • 打赏
  • 举报
回复
对呀,为什么要用COOKIE?直接写不是很好吗?!
luket 2001-12-28
  • 打赏
  • 举报
回复
response.write request.cookies("name")是不对的,request.cookies("name")是得到COOKIE,如果你没有定义这样是写不出来的。直接写response.write NAME不行吗?奇怪的问题

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧