Pop Up Captcha on Timer?

Discussion in 'JavaScript' started by readezarchive, Aug 30, 2014.

  1. #1
    Hello, I'm trying to get a Pop-up captcha to work when a timer hits zero then redirect to a page. Any ideas?

     
    readezarchive, Aug 30, 2014 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    Such a vague question. Have you got any code to show us what the problem is?
     
    HuggyStudios, Sep 1, 2014 IP
  3. readezarchive

    readezarchive Active Member

    Messages:
    600
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Basically I have a Javascript timer that opens a bPopup window (This Works):

    var x = 31
    
    var y = 1
    
    function startClock(){
    
    if(x!=='Done'){
    
    x = x-y
    
    document.frm.clock.value = x
    
    setTimeout("startClock()", 1000)
    
    }
    
    if(x==0){
    
    $('#element_to_pop_up').bPopup();
    
    x='Done';
    
    }}
    Code (JavaScript):
    The problem is, the Solvemedia Captcha code is in PHP:

     <?php
        require_once("solvemedialib.php");
        if(isset($_POST) && !empty($_POST)){
            $privkey="your_private_key";
            $hashkey="your_hash_key";
            $solvemedia_response = solvemedia_check_answer($privkey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["adcopy_challenge"],
                                $_POST["adcopy_response"],
                                $hashkey);
            if (!$solvemedia_response->is_valid) {
                print "<div class='alert alert-danger'> Error: ".$solvemedia_response->error."</div>";
            }
            else {
                print "<div class='alert alert-success'> Successfully entered </div>";
            }
        }
       ?>
    PHP:
    How do I start the Timer only if the Captcha is not solved yet?
     
    Last edited: Sep 3, 2014
    readezarchive, Sep 3, 2014 IP
  4. ketting00

    ketting00 Well-Known Member

    Messages:
    782
    Likes Received:
    28
    Best Answers:
    3
    Trophy Points:
    128
    #4
    You can use ajax to achieve what you want. There are plenty of tutorial about this on the web. but first things first you need to retrieve captcha value from the server then validate the input.
     
    ketting00, Sep 12, 2014 IP