| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 406 人关注过本帖
标题:[求助]ASP达人请进,助我解决此代码的问题!~~
只看楼主 加入收藏
郁闷的我
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-2-10
收藏
 问题点数:0 回复次数:1 
[求助]ASP达人请进,助我解决此代码的问题!~~

问题出现在用户注册页面的最后一步,输入完信息点提交以后只出现了调用的HEAD.ASP的内容,下面什么也没有...注册成功消息没有提示,数据库也没有写入数据.代码如下:
<!--#include file="Head.asp" -->
<%sub navigation()%>
&gt;&gt; 用户注册申请表
<%end sub%>
<%
If Request("Action")="Save" Then
Call zf11_RegSave()
response.End()
End if
If Request("Reply")<>"OK" Then
Response.Redirect("User_Reg.asp")
Response.End()
End if
%>
<script language="JavaScript">
<!--
function CheckForm()
{
if (document.zf11Sys_Reg.UserName.value.length == 0)
{
alert("请输入用户名.");
document.zf11Sys_Reg.UserName.focus();
return false;
}
if (document.zf11Sys_Reg.UserName.value.indexOf("<")!=-1 || document.zf11Sys_Reg.UserName.value.indexOf(">")!=-1 || document.zf11Sys_Reg.UserName.value.indexOf("$")!=-1)
{
alert("用户名中包含非法字符 (<,>,$) ");
document.zf11Sys_Reg.UserName.focus();
return false;
}
if (document.zf11Sys_Reg.UserName.value.indexOf("'")!=-1 || document.zf11Sys_Reg.UserName.value.indexOf("%")!=-1 || document.zf11Sys_Reg.UserName.value.indexOf("&")!=-1)
{
alert("用户名中包含非法字符 (',%,&) ");
document.zf11Sys_Reg.UserName.focus();
return false;
}
if (document.zf11Sys_Reg.UserPassword.value.length <= 5)
{
alert("\n请输入六位以上的密码!\n");
document.zf11Sys_Reg.UserPassword.focus();
return false;
}
if (document.zf11Sys_Reg.ReUserPassword.value.length == 0)
{
alert("请输入密码确认!");
document.zf11Sys_Reg.ReUserPassword.focus();
return false;
}
if (document.zf11Sys_Reg.ReUserPassword.value!= document.zf11Sys_Reg.UserPassword.value)
{
alert("两次输入密码不一样!");
document.zf11Sys_Reg.ReUserPassword.focus();
return false;
}
if (document.zf11Sys_Reg.UserCheckCode.value.length == 0)
{
alert("请输入验证码!");
document.zf11Sys_Reg.UserCheckCode.focus();
return false;
}
if (document.zf11Sys_Reg.UserEmail.value.length == 0)
{
alert("请输入Email!");
document.zf11Sys_Reg.UserEmail.focus();
return false;
}
if (document.zf11Sys_Reg.UserEmail.value.charAt(0)=="." ||
document.zf11Sys_Reg.UserEmail.value.charAt(0)=="@"||
document.zf11Sys_Reg.UserEmail.value.indexOf('@', 0) == -1 ||
document.zf11Sys_Reg.UserEmail.value.indexOf('.', 0) == -1 ||
document.zf11Sys_Reg.UserEmail.value.lastIndexOf("@")==document.zf11Sys_Reg.UserEmail.value.length-1 ||
document.zf11Sys_Reg.UserEmail.value.lastIndexOf(".")==document.zf11Sys_Reg.UserEmail.value.length-1)
{
alert("Email的格式不正确!");
document.zf11Sys_Reg.UserEmail.focus();
return false;
}
if (document.zf11Sys_Reg.UserQuesion.value.length == 0)
{
alert("请输入你的密码提示问题!");
document.zf11Sys_Reg.UserQuesion.focus();
return false;
}
if (document.zf11Sys_Reg.UserAnswer.value.length == 0)
{
alert("请输入你的密码提示答案!");
document.zf11Sys_Reg.UserAnswer.focus();
return false;
}
return true;
}
///onSubmit="return CheckForm();"
//-->
</script>
<SCRIPT language=JavaScript type=text/javascript>
<!--
function zf11Sys_RegAgree(AgreeSet){
AgreeSet.style.display=(AgreeSet.style.display=="none")?"":"none";
}
//-->
</SCRIPT>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="778" height="20" bgcolor="#EFEFE7">
<tr>
<td>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="768" height="20" background="images/zf11_userxieyi.gif">
<tr>
<td> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="778" height="5" bgcolor="#EFEFE7">
<tr>
<td></td>
</tr>
</table>
</div>
<TABLE cellSpacing=0 cellPadding=0 width=768 align=center border=0 style="border: 1px solid #CECFCE">
<TBODY>
<TR>
<TD bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=0 width=778 align=center border=0>
<TBODY>
<TR>
<TD vAlign=top >
<FORM id="zf11Sys_Reg" name="zf11Sys_Reg" action="?Action=Save" method="post" onSubmit="return CheckForm();">
<TABLE cellSpacing=0 cellPadding=3 width=778 align=center
bgColor=#ffffff>
<TBODY>
<TR>
<TD
height=38 colspan="3" align=center> <strong>===基本资料===</strong></TD>
</TR>
<TR>
<TD align=right width=200
height=25>用户昵称: </TD>
<TD width=112><INPUT id=UserName maxLength=16 size=16 name=UserName>
</TD>
<TD width="428"><FONT color=#ff0000>*</FONT>-<FONT
color=#999999>最大10个字符.不能使用特殊字符</FONT></TD>
</TR>
<TR>
<TD align=right
height=25>用户密码:</TD>
<TD><INPUT id=UserPassword type=password maxLength=16 size=16 name=UserPassword></TD>
<TD><FONT color=#ff0000>*</FONT>-<FONT
color=#999999>大于6小于14个字符.</FONT><FONT
color=#999999>不能使用特殊字符</FONT></TD>
</TR>
<TR>
<TD align=right
height=25>确认密码:</TD>
<TD><INPUT id=ReUserPassword type=password maxLength=16 size=16 name=ReUserPassword></TD>
<TD><FONT color=#ff0000>*</FONT>-<FONT
color=#999999>确认一遍您输入的密码</FONT></TD>
</TR>
<TR>
<TD align=right height=25
name="up">性别:</TD>
<TD> 男
<INPUT type=radio CHECKED value=1 name=UserSex style="Border:0Px">

<INPUT type=radio value=0 name=UserSex style="Border:0Px"></TD>
<TD><FONT color=#ff0000>*</FONT>-<font color="#999999">请选择您的性别</font></TD>
</TR>
<TR>
<TD align=right
height=25>电子信箱:</TD>
<TD><INPUT id=UserEmail maxLength=30 size=16 name=UserEmail>
</TD>
<TD><FONT color=#ff0000>*</FONT>-<FONT
color=#999999>必须是有效的电子信箱,当你忘记密码时要用到它</FONT></TD>
</TR>
<TR>
<TD align=right
height=25>密码问题:</TD>
<TD><INPUT id=UserQuesion maxLength=20 size=16 name=UserQuesion></TD>
<TD><FONT color=#ff0000>*</FONT>-<font color="#999999">忘记密码的提示问题</font></TD>
</TR>
<TR>
<TD align=right
height=25>密码答案:</TD>
<TD><INPUT id=UserAnswer maxLength=20 size=16 name=UserAnswer></TD>
<TD><FONT color=#ff0000>*</FONT>-<font color="#999999">忘记密码的提示问题答案,用于取回密码</font></TD>
</TR>
<TR>
<TD align=right height=25>详细资料: </TD>
<TD colspan="2">&nbsp; <INPUT onclick=zf11Sys_RegAgree(others) type=checkbox value=1 name=otherselect style="Border:0Px">
<font color="#999999">开启高级选项</font></TD>
</TR>
</TBODY>
</TABLE>
<DIV id=others style="DISPLAY: none">
<TABLE cellSpacing=0 cellPadding=3 width=760 align=center
bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD
height=32 colspan="3" align=center> <strong>===详细资料===</strong></TD>
</TR>
<TR>
<TD align=right width=200
height=24>主页地址:</TD>
<TD colSpan=2> <INPUT id=HomePage maxLength=50 size=35 name=HomePage></TD>
</TR>
<TR>
<TD align=right height=25>OICQ号码:</TD>
<TD colSpan=2> <INPUT id=OICQ maxLength=20 size=15 name=OICQ></TD>
</TR>
<TR>
<TD align=right height=25>真实姓名:</TD>
<TD colSpan=2> <INPUT id=TrueName maxLength=20 size=15 name=TrueName>
</TD>
</TR>
<TR>
<TD align=right height=22>出生日期:</TD>
<TD colSpan=2><input name="UserBirthday" type="text" id="UserBirthday"></TD>
</TR>
<TR>
<TD align=right height=25>联系地址:</TD>
<TD colSpan=2> <INPUT id=UserAddress maxLength=30 size=30 name=UserAddress>
邮政编码:
<input name="PostCode" type="text" id="PostCode" size="15" maxlength="15"></TD>
</TR>
<TR>
<TD align=right height=25>签名/简介:<br> </TD>
<TD colSpan=2> 体现您的个性!你的爱好等!<br> <textarea name="UserSign" cols="50" rows="5" id="UserSign"></textarea>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<table width="100%" height="44" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><input type="submit" name="zf11Sys_Submit" value="提交申请">
&nbsp;&nbsp; <input name="zf11Sys_Reset" type="Reset" value="重设表单">
</td>
</tr>
</table>
</FORM>
</TD>
</TR></TBODY></TABLE>
</TD></TR></TBODY></TABLE>
<!--#include File="foot.asp"-->
</BODY></HTML>
<%
'保存注册的信息----------------------------------
Sub zf11_RegSave()
Dim UserName,UserPassword,ReUserPassword,UserCheckCode,UserEmail,UserQuesion,UserAnswer
Dim HomePage,OICQ,TrueName,UserBirthday,UserAddress,PostCode,UserSign
'一定要写的资料----------------------------------
UserName = Request("UserName")
UserPassword = Request("UserPassword")
ReUserPassword = Trim(Request("ReUserPassword"))
UserCheckCode = Trim(Request("UserCheckCode"))
UserSex = Request("UserSex")
UserEmail = Request("UserEmail")
UserQuesion = Trim(Request("UserQuesion"))
UserAnswer = Trim(Request("UserAnswer"))
'可以不填的资料----------------------------------
HomePage = Request("HomePage")
OICQ = Request("OICQ")
TrueName = Request("TrueName")
UserBirthday = Request("UserBirthday")
UserAddress = Request("UserAddress")
PostCode = Request("PostCode")
UserSign = Request("UserSign")

If IsEmpty(Request("UserName")) OR IsEmpty(Request("UserEmail")) Then
'Response.write UserName & UserEmail
Response.write"<script>alert(""信息填写不完整!"");location.href=""javascript:history.back()"";</script>"
Response.End
End if
If IsEmpty(UserQuesion) OR IsEmpty(UserAnswer) Then
Response.write"<script>alert(""问题答案填写不完整!"");location.href=""javascript:history.back()"";</script>"
Response.End
End if

If UserPassword <> ReUserPassword then
response.write"<script>alert(""两次输入密码不一样!\n\n请重新输入!"");location.href=""javascript:history.back()"";</script>"
response.End
End if
set rs=server.createobject("adodb.recordset")
sql="select * from "&zf11_DBTable&" where "&zf11_UserName&"='"&UserName&"'"
rs.open sql,conn_user,1,3
if (rs.eof and rs.bof) then
Rs.addnew
'一定要写的资料----------------------------------

Rs(zf11_UserName)=UserName
UserPassword=Md5(UserPassword) 'MD5()
Rs(zf11_UserPassword)=UserPassword
Rs(zf11_UserSex)=UserSex
Rs(zf11_UserEmail)=UserEmail
Rs(zf11_UserQuesion)=UserQuesion
UserAnswer=Md5(UserAnswer) 'MD5()
Rs(zf11_UserAnswer)=UserAnswer
'可以不填的资料----------------------------------
Rs("HomePage")=HomePage 'W
Rs("OICQ")=OICQ 'W
Rs("TrueName")=TrueName 'W
Rs(zf11_UserBirthday)=UserBirthday
Rs("UserAddress")=UserAddress 'W
Rs("PostCode")=PostCode 'W
Rs(zf11_UserSign)=UserSign
Rs(zf11_UserGrade)=0 'UserGrade
Rs(zf11_UserMoney)=100 'UserMoney
Rs(zf11_UserIP)=Request.ServerVariables("REMOTE_ADDR")
if NeedCheck=1 then
Rs("IsActive")=False
else
Rs("IsActive")=True
end if
rs.update
if NeedCheck=1 then
response.write"<script>alert(""恭喜你 "&UserName&" 已注册成功!\n管理员会尽快通过验证的!"");location.replace(""index.asp"");</script>"
response.end
else
'Call DealCookie_zf11Sys()
'Session("Pw_UserID")=rs("UserID")
'Session("Pw_Sys_User")=rs("Username")
'Session("Grade")=rs("Grade")
'Session("Pw_Money")=rs("Money")
end if
rs.close
set rs=nothing
Response.write"<script>alert("" 恭喜你 "&UserName&" 注册成功!\n "");location.href=""index.asp"";</script>"
Else
Response.write"<script>alert("" 用户名 "&UserName&" 已被注册!\n "");location.href=""javascript:history.back()"";</script>"
End if
End Sub
Sub DealCookie_zf11Sys()
Response.Cookies(zf11Sys)("UserID")=rs(zf11_UserID)
Response.Cookies(zf11Sys)("Username")=rs(zf11_Username)
Response.Cookies(zf11Sys)("Grade") =rs(zf11_UserGrade)
Response.Cookies(zf11Sys)("Money")=rs(zf11_UserMoney)
Response.Cookies(zf11Sys)("UserEmail")=rs(zf11_UserEmail)

If CookieDate<>"" Then
CookieDate=0
End If

Response.Cookies(zf11Sys)("CookieDate") = CookieDate
Select case CookieDate
case 0
'Not Save
case 1
Response.Cookies(zf11Sys).Expires=Date+1
case 2
Response.Cookies(zf11Sys).Expires=Date+31
case 3
Response.Cookies(zf11Sys).Expires=Date+365
End select
End sub
%>

[此贴子已经被作者于2007-2-10 2:19:43编辑过]

搜索更多相关主题的帖子: ASP 代码 
2007-02-10 02:19
郁闷的我
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-2-10
收藏
得分:0 
注:是四通政府的程序!~~
2007-02-10 02:20
快速回复:[求助]ASP达人请进,助我解决此代码的问题!~~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018151 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved