Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Yay
    Yay is offline
    Regular Coder Yay's Avatar
    Join Date
    Oct 2008
    Location
    54° North, 1° West
    Posts
    102
    Thanks
    9
    Thanked 1 Time in 1 Post

    Adding CAPTCHA for first-time use of my site's shoutbox.

    Hi,

    I was wondering if it was possible to include a CAPTCHA field on my sites Shoutbox, but, the CAPTCHA would disappear once the user has entered in a code once.

    Is it possible?
    If yes, how could I do this?

    Regards

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    238
    Thanks
    3
    Thanked 37 Times in 37 Posts
    You could set some session variable after the CAPTCHA is entered. E.g. like this:
    PHP Code:
    $_SESSION['captcha_entered'] = 1
    If the variable is not empty or is set (could be checked with isset()), you would not show the CAPTCHA ever again.
    PHP Code:
    if(empty($_SESSION['captcha_entered']))
    {
     
    // Show your CAPTCHA here

    PHP Code:
    if(!isset($_SESSION['captcha_entered']))
    {
     
    // Show your CAPTCHA here

    Please notice that it is possible to make an attack when an attacker enters the CAPTCHA for the first time manually. And then uses a script to send as much spam to your shoutbox as he wishes...

  • #3
    Regular Coder
    Join Date
    Aug 2009
    Posts
    131
    Thanks
    28
    Thanked 7 Times in 7 Posts
    If you use sessions, they'd expire and the user has to type in the captcha code again.

    Or you could log it in the database - which if they have posted a captcha code and input it in a table, and then check if the user has posted a captcha code.

    But as the person above me said, it could be dangerous.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •