Intermittant Javascript Issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bumble
    New Member
    • Jul 2008
    • 2

    Intermittant Javascript Issue

    Hi Everyone

    I have very little knowledge of Javascript or any other language and have built the basics of my website using Dreamweaver. I have built in extra functions just by trying to follow the logic of other scripts etc. However, for only the second time ever, I am posting to a forum with a problem I can't can't solve. The reason I can't solve it is because the problem only happens when run the script is run more than once within a few hours of the first time?? The problem...

    The 'Redirect if spambot answer wrong' section below will always return true if run more than once within a period of roughly a few hours. After which, the if statement seems to work perfectly. I appreciate it's probably not the if statement itself that is the problem but some outside factor. I created the section myself apart from declaring the MM_Flag variable which I got from another form validation section which performs a simlar function. I guess that part is evaluating if the the MM_Insert contains any data and if so, to perform the validation process otherwise...car ry on?? Is this some sort of sessions issue??

    The script:

    Code:
    <%
    // *** Select security question
    var rsSecurity_cmd = Server.CreateObject ("ADODB.Command");
    rsSecurity_cmd.ActiveConnection = MM_database_STRING;
    rsSecurity_cmd.CommandText = "SELECT TOP 1 Question, Answer FROM tbl_dir_security ORDER BY NEWID()";
    rsSecurity_cmd.Prepared = true;
    
    var rsSecurity = rsSecurity_cmd.Execute();
    var rsSecurity_numRows = 0;
    %>
    
    <%
    // *** Redirect if spambot answer wrong
    var MM_flag = "MM_insert";
    if (String(Request(MM_flag)) != "undefined") {
      var MM_dupkeySpambot_Answervalue = String(Request.Form("Spambot_Answer"));
    
      if (MM_dupkeySpambot_Answervalue != rsSecurity.Fields.Item("Answer").Value) {
        // wrong answer
        Response.Redirect("security.html");
      }
    }
    %>
    Any help you can offer would be very much appreciated!

    Many thanks if you've read this far!

    Lee
    Last edited by acoder; Feb 24 '09, 11:10 AM. Reason: Added [code] tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This doesn't look like a JavaScript problem. The code you've posted is ASP. Is there any JavaScript code involved?

    Comment

    Working...