| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1176 人关注过本帖
标题:斑斑.帮我看看这段JS代码那里出错了.急救中~~~
只看楼主 加入收藏
fzying
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2007-11-9
结帖率:100%
收藏
 问题点数:0 回复次数:4 
斑斑.帮我看看这段JS代码那里出错了.急救中~~~
If Trim(Request.Form("validatecode"))=Empty Or Trim(Session("))<>Trim(Request.Form("validatecode"))Then
Response.Redirect("erro2.asp")
response.end
end if

大家帮看看这段代码.为什么判断验证码时老是转到错误页面.而不到正码页面的.


下面是全文代码?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="md5.asp" -->

<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If Trim(Request.Form("validatecode"))=Empty Or Trim(Session("))<>Trim(Request.Form("validatecode"))Then
Response.Redirect("erro2.asp")
response.end
end if
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject (")
    MM_editCmd.ActiveConnection = MM_conn_STRING
    MM_ = "INSERT INTO dbo.usertable (username, password, xingbie, nianlin, Email, mmbhwt, mmbhda, IP) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("username")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 10, md5(Request.Form("password"))) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(Request.Form("RadioGroup1"), Request.Form("RadioGroup1"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 5, 1, -1, MM_IIF(Request.Form("nianlin"), Request.Form("nianlin"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 50, Request.Form("Email")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 50, Request.Form("mmbhwt")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 50, Request.Form("mmbhda")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 50, Request.Form("ip")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "zccg.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="Scripts/AC_ActiveX.js" type="text/javascript"></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<script language="javascript" src="reg.js"></script>
<script>
function BeforeSubmit()
  {
   if(document.getElementById('mmbhwt').value=='0')
 {
  alert("请选择密码保护问题!");
  form1.mmbhwt.focus();
  return false;
  }
  if(form1.checkbox.checked==false) {
     alert("你必须接受注册协议!");
     form1.checkbox.focus();
     return false;
     }

  if (document.form1.username.value=='')
   {
     alert("请填写你的用户名!");
     form1.username.focus();
     return false;
     }
     if( form1.username.value.length<6||form1.username.value.length>20)
    {
      alert("您的用户名长度应该在6-20个字符之间");
    form1.username.focus();
    return false;
   }
    if(document.form1.password.value!=document.form1.password2.value)
      {
       alert("两次密码填写不相同");
       form1.password2.focus();
       return false;
       }
       if (document.form1.Email.value=="") {
       alert("请填写你的电子邮件地址!")
       form1.Email.focus()
       return false
       }
      var email = document.form1.Email.value
      var is_error = false
      var pn_0 = email.index0f("@")
      var pn_1 = email.index0f(".",pn_0)
      var pn_2 = email.length
      if (pn_0<1 || pn_1<pn_0+2 || pn_1+2>pn_2) is_error=true
      if(is_error) {
      alert("请输入正确的邮件地址,密码丢失后可用此找回!")
      document.form1.Email.focus()
      return false
     }
     if(form1.RadioGroup1[0].checked==false&&form1.RadioGroup1[1].checked==false)
    {
     alert("请选择你的性别");
     form1.RadioGroup1[0].focus();
       return false;
      }
      return true;
    }

</script>

<body>
会员注册
<form action="<%=MM_editAction%>" method="POST" name="form1" id="form1" onsubmit="return BeforeSubmit()">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">用户名:</td>
      <td><input type="text" name="username" value="" size="32" />      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">密 码:</td>
      <td><input type="password" name="password" value="" size="32" onchange="chkpwd(this)"/><div id="chkResult"></div></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">重复密码</td>
      <td><input type="password" name="password2" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">性 别:</td>
      <td><p>
        <label>
          <input type="radio" name="RadioGroup1" value="0" id="RadioGroup1_0" />
          男</label>
        <label>
          <input type="radio" name="RadioGroup1" value="1" id="RadioGroup1_1" />
          女</label>
        <br />
      </p></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">年 龄:</td>
      <td><input type="text" name="nianlin" value="" size="32" />      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">邮 箱:</td>
      <td><input type="text" name="Email" value="" size="32" />      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">密码保护问题:</td>
      <td><label>
        <select name="mmbhwt" id="mmbhwt">
          <option value="0">请选择</option>
          <option value="1">你喜欢什么运动</option>
          <option value="2">你最爱的人</option>
                </select>
      </label></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">密码保护回答:</td>
      <td><input type="text" name="mmbhda" value="" size="32" />      </td>
    </tr>
   
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><label>
        <input type="checkbox" name="checkbox" id="checkbox" />
      </label>
      接受注册协义</td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">验证码</td>
      <td><label>
        <input name="validatecode" type="text" id="validatecode" size="5" />
      </label>
        <img src="safecode.asp" name="safecode" id="safecode"/>
 [<a href="#" onclick="getcode();" title="点击刷新验证码">刷新</a>][语音]
      <script type="text/javascript">
AC_AX_RunContent( 'classid','CLSID:22d6f321-b0f6-11d0-94ab-0080c74c7e95','class','OBJECT','id','voices','style','display:none;','filename','value' ); //end AC code
</script><noscript><object classid="CLSID:22d6f321-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="voices" style="display:none;"><param name="Filename" value""></object></noscript></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"><input name="ip" type="hidden" id="ip" value="<%= Request.ServerVariables("REMOTE_ADDR")
 %>" /></td>
      <td><input type="submit" value="注册" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
</body>
</html>


这是JS代码
function getcode()
 {
   document.getElementById("safecode").src="safecode.asp?"+Math.
   random();
  }
   function voice()
  {
   if(document.all&&!window.opera)
       document.getElementById("voices").Filename="voice.asp?"+Math.random();
    else
         alert("暂时只有IE浏览器支持");

[[it] 本帖最后由 fzying 于 2008-12-10 13:26 编辑 [/it]]
搜索更多相关主题的帖子: 代码 ASP 
2008-12-09 20:21
xpowoow
Rank: 2
等 级:论坛游民
威 望:1
帖 子:63
专家分:22
注 册:2007-10-3
收藏
得分:0 
看一下
可能错在这里:Trim(Request.Form("validatecode"))=Empty
2008-12-10 08:55
fzying
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2007-11-9
收藏
得分:0 
那改成什么呢
2008-12-10 12:28
anlige
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:401
专家分:0
注 册:2006-11-3
收藏
得分:0 
isEmpty()

http://www.
zhanghuiguoanlige@
2008-12-10 15:52
fzying
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2007-11-9
收藏
得分:0 
楼上.我按你那样.不行.出错的.
2008-12-10 19:26
快速回复:斑斑.帮我看看这段JS代码那里出错了.急救中~~~
数据加载中...
 
   



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

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