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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts

    Whats the best way to make a recaptcha

    I want to make a recapture script on my site, that show up every x ammount of clicks, ive already got my website to collect and update the users click ammount, when they are logged in, however Ive looked online for recapture scripts and not found many, and the ones i have found require a new session be implimented into the code inorder for it to show up, whereas I want to set mine to show the recapture box as an included file every x amount of clicks.

    If anyone could help me get in the right direction ect that would be great.

    Thanks

    Dan
    Last edited by Dan13071992; 01-08-2012 at 12:17 AM.
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    recapture ?

    Do you mean "captcha" or "recaptcha"?

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by mlseim View Post
    recapture ?

    Do you mean "captcha" or "recaptcha"?
    Yes sorry for the spelling mistake
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    First, you need to use PHP SESSION variable to keep track of their clicks.
    With SESSION, they have to close the browser to clear the click counts.
    Anyone could do that, but they would have to close and come back ...
    are you OK with them being able to do that?

    So you add 1 to the SESSION variable each time. If it gets to 5, you display
    the captcha and reset the SESSION variable to 1. If they close their browser,
    or open a different browser, that SESSION will start at 1. I have 4 browsers
    on my PC (IE, FF, Safari, Chrome). That means I could jump between them
    and do 4 times the number of clicks before the recaptcha appears.

    Now, about the "captcha" or "recaptcha" definition ...

    You said "recaptcha", which is a proprietary captcha method that you have to
    register with and get a key. It's free, but it's called "ReCaptcha". "Captcha" is
    the generic term of a captcha ... you can create your own if you wish and make it
    as simple or complex as you choose.

    Whether it appears or not, is as simple as checking the SESSION value to see if they
    have reached the limit. If so, make it show and reset the SESSION value.

    Not sure how much PHP experience you have, but everything described in this post is
    easily found using Google.

  • #5
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    i get where your coming from, however i was actually going to do it this way:

    i have in the users table a number of clicks feild called 'clicks' i was going to have the Captcha come up every x amount of clicks, but in my inc-userfunctions.php page it will update the clicks+1 each time they go to a new page, then if that page reaches the x amount of clicks, the Captcha is displayed and they cannot go to another page till they pass the Captcha, a bit like making someone accept the Terms of Service on your site, it wont let them do anything else until they have accepted. that was my general idea on it instead of using sessions
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    What are you using to keep track of their clicks ... if you're not using SESSION?

  • #7
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    my inc-userfunctions.php page, its included in every single page that a user is logged into, and i was going to do:

    PHP Code:

    $newclicks 
    $fetch->clicks 1;

    mysql_query(UPDATE users SET clicks='".dbSafe($newclicks)."' WHERE username='".dbSafe($fetch->username)."'"); 
    then in the pages that will need the recaptcha (which wont be all pages, it will be just the main pages) it will be as an include if their click are >= x amount of clicks
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    oh ....
    You have a database with the user's clicks ... that's a whole different story.

    In your main pages, where you need the captcha, display it if $newlinks is > 10 (or whatever).

    <?php if($newclicks > 10){
    // display the recaptcha and nothing else.
    }


    The ONLY thing that can reset the database count to 1 is a successful recaptcha.
    You do that right in the recaptcha script. Connect to database and UPDATE 'clicks'.
    They will be stuck on the recaptcha and nothing else until it's successful.

  • #9
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by mlseim View Post
    oh ....
    You have a database with the user's clicks ... that's a whole different story.

    In your main pages, where you need the captcha, display it if $newlinks is > 10 (or whatever).

    <?php if($newclicks > 10){
    // display the recaptcha and nothing else.
    }


    The ONLY thing that can reset the database count to 1 is a successful recaptcha.
    You do that right in the recaptcha script. Connect to database and UPDATE 'clicks'.
    They will be stuck on the recaptcha and nothing else until it's successful.
    Yes thats right, however I need to make the captcha, thats what this thread was all about as i dont know how to make a captcha, so i was asking to be point in the right direction to one that doesnt run off sessions, if that makes sense?
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #10
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    How sophisticated of a captcha?
    If you want to do the whole distorted image thing, that's going to be harder.
    If you want to give them a, "What's 2 + 3" and make them enter '5',
    that would be easy.

    Is the captcha supposed to delay the user (slow them down), or does it have
    to totally thwart all captcha recognition software? The more secure, the more
    scripting you need to do.

    In any event, I would add a new column to the database to store the captcha value.
    That would be doing it without SESSION.


    .

  • #11
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    i can do it with numbers, but maybe a bit more complex than 2+5, maybe along the lines of 2 + 5 + a then in the box they have to do it without entering the letter of the althabet, if that makes sense?

    or even just a box that looks like am image, that infact is just 3 or 4 letters inside it that they have to enter and submit?
    Last edited by Dan13071992; 01-08-2012 at 01:35 AM. Reason: updated
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #12
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    bump - can anyone direct me or help me to make a captcha?
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #13
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I don't know how you'll do it without SESSION or cookie. I suppose AJAX?
    Too much scripting for me ... as I don't have any free time now.

  • #14
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    ok thanks for the reply, if you do get a chance or some spare time do you think you could point me in the right direction?
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #15
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    I, personally, have never made a capcha because the recapcha library is so good. I use it all the time - VERY easy to implement and very easy to use. Also helps digitalise books!

    But, I do remember seeing some threads in this very forum about someone wanting to make their own capcha (as a learning exercise) - I would give the forum a search.
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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