Image text

Discussion in 'Customization & add-ons' started by annivas, Jan 8, 2006.

  1. annivas

    annivas New Member

    Joined:
    Oct 26, 2005
    Messages:
    6
    I am trying to customize my signup page by adding another field which is the "Image text" for extra security purposes. User is asked to input the image text being displayed. If he/she fails to provide correct text, an error is displayed.

    The problem is that although I got it working all the way to the agreement page, I got stuck after that. After user hits the agree button, he gets back to the signup page and gets the "Wrong text" error. Needless to say that the image changes on each reloading of the page. So, I am trying to figure out how to do the check only once, and then skip the procedure.

    Here is the code snippet:

    PHP:
        $img = new securimage();
        
    $valid $img->check($_POST['imagetext']);
        if(!
    $valid) {
          
    $error[] = "The text you entered is not correct!";
        }
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    do something like this:

    PHP:
    $img = new securimage();
    if (!
    $_SESSION['img_check_ok']){
      
    $valid $img->check($_POST['imagetext']);
      if(!
    $valid) {
           
    $error[] = "The text you entered is not correct!";
      } else { 
    // if valid
          
    $_SESSION['img_check_ok'] = true;
      }
    }

Share This Page