Computer Forums

Go Back   Computer Forums > Internet > Website Development

Website Development HTML, traffic, hosting, and more... this is the forum for every webmaster.

Register Now for FREE!
Computer Forums

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Agree to forum rules 


Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-18-2007, 01:27 PM
Newbie
 
Join Date: 08 Mar 2007
Posts: 8
iorgutu1 will become famous soon enough
Default [SOLVED] PHP CAPTHA SCRIPT HELP

Hi,

I am Iorgutu, and i started this thread because need some help . I want to implement a PhP Captcha Script on my website and I don`t know where I found a good captcha, free or paid. If you have a sugestion, please let me know.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
  #2 (permalink)  
Old 05-18-2007, 03:13 PM
Ash's Avatar
Ash Ash is online now
CF owner
 
Join Date: 27 Jul 2005
Location: Devon, UK
Posts: 4,130
Ash has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond repute
Default

Hi there iorgutu1,
Firstly, welcome to CompuForums. I hope that you can visit our forum often in the future and post - rather than just receiving our help and advice, and then never visiting again. We provide our help for free, and all we ask in return is that you participate in our forum and refer your friends, or consider a premium membership.

Could you provide a link to your website or tell us if it's a prewritten script you are using or a custom one?
__________________
Thanks,
Ash
CF Founder

Great Webhosting. Shared starting at $2 per month. VPSes starting at $6 per month.
www.Centicero.com

Want to get in touch? Send me a PM | Do you want to continue receiving free help? Or do you want this site to close? Become a premium member.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3 (permalink)  
Old 05-18-2007, 06:08 PM
Tom Tom is offline
Gigabyte
 
Join Date: 16 Mar 2007
Posts: 409
Tom is a jewel in the roughTom is a jewel in the roughTom is a jewel in the roughTom is a jewel in the rough
Default

Try this:
In general the process of using CAPTCHA can be divided into two stages. First you have to query the user for the CAPTCHA, on that page you also usually let the user input the data, which has to be protected, e.g. blog entries.

The following script query.php implements this querying phase.
Code:
<?php

require 'CaptchasDotNet.php';

// Required Parameters
// Replace the values you receive upon registration at http://captchas.net.
//
//   client: 'demo'
//
//   secret: 'secret'
//
// Optional Parameters and defaults
//
//   repository_prefix: '/tmp/captchasnet-random-strings' path to repository
//   ATTENTION SAFE-MODE, YOU HAVE TO CHOOSE SOMETHING LIKE
//   '/writable/path/captchasnet-random-strings'
//
//   cleanup_time: '3600' (means max 1 hour between query and check)
//
//   alphabet: 'abcdefghijklmnopqrstuvwxyz' (Used characters in captcha)
//   We recommend alphabet without ijl: 'abcdefghkmnopqrstuvwxyz'
//
//   letters: '6' (Number of characters in captcha)
//
//   width: '240' (image width)
//
//   height: '80' (image height)
//
//   Usage
//   $captchas = new CaptchasDotNet (<client>, <secret>,
//                                   <repository_prefix>, <cleanup_time>,
//                                   <alphabet>,<letters>,
//                                   <height>,<width>);
//
// Don't forget same settings in check.asp

// Construct the captchas object.

$captchas = new CaptchasDotNet ('demo', 'secret',
                                '/tmp/captchasnet-random-strings','3600',
                                'abcdefghkmnopqrstuvwxyz','6',
                                '240','80');

?>

<html>
  <head>
    <title>Sample PHP CAPTCHA Query</title>
  </head>
  <h1>Sample PHP CAPTCHA Query</h1>
  <form method="get" action="check.php">
    <table>
      <tr>
        <td>
          <input type="hidden" name="random" value="<?= $captchas->random () ?>" />
            Your message:</td><td><input name="message" size="60" />
        </td>
      </tr>
      <tr>
        <td>
          The CAPTCHA password:
        </td>
        <td>
          <input name="password" size="6" />
        </td>
      </tr>
      <tr>
        <td>
        </td>
        <td>
          <?= $captchas->image () ?>
          <br> <a href="<?= $captchas->audio_url () ?>">Phonetic spelling (mp3)</a>
        </td>
      </tr>
      <tr>
        <td>
        </td>
        <td>
          <input type="submit" value="Submit" />
        </td>
      </tr>
    </table>
  </form>
</html>
Checking
The second part is to check, whether the user has input the correct letter sequence (as given by the CAPTCHA image or audio). If that is the case the protected operation can be performed. Otherwise the corresponding error message is to be output.

There are two ways, in which a CAPTCHA check can fail. The user can have simply input the wrong letters. But also the random string can have been used more than once. If you would allow a random string to be used multiple times, a human could find out the correct CAPTCHA letter sequence for one random string once and use that information to make a robot post non-human entries to your web application, which still would seem made by a human.

The following script check.php implements this checking phase.
Code:
<?php

require 'CaptchasDotNet.php';

// See query.php for documentation

$captchas = new CaptchasDotNet ('demo', 'secret',
                                '/tmp/captchasnet-random-strings','3600',
                                'abcdefghkmnopqrstuvwxyz','6',
                                '240','80');

// Read the form values
$message       = $_REQUEST['message'];
$password      = $_REQUEST['password'];
$random_string = $_REQUEST['random'];
?>

<html>
  <head>
    <title>Sample PHP CAPTCHA Query</title>
  </head>
  <h1>Sample PHP CAPTCHA Query</h1>

<?php
  // Check the random string to be valid and return an error message
  // otherwise.
  if (!$captchas->validate ($random_string))
  {
    echo 'Every CAPTCHA can only be used once. The current CAPTCHA has already been used. Try again.';
  }
  // Check, that the right CAPTCHA password has been entered and
  // return an error message otherwise.
  elseif (!$captchas->verify ($password))
  {
    echo 'You entered the wrong password. Aren\'t you human? Please use back button and reload.';
  }
  // Return a success message
  else
  {
    echo 'Your message was verified to be entered by a human and is "' . $message . '"';
  }
?>

</html>
Problems with Safe Mode
If your webserver starts PHP-scripts in the safe mode, you will not be able to leave the default path to the random string repository unchanged. Instead use a name in a directory, which the owner of the PHP-script owns:

Code:
.
.
.

require 'CaptchasDotNet.php';

$captchas = new CaptchasDotNet ('demo', 'secret', 
                                '/writable/path/captchasnet-random-strings');

.
.
.
This code can be found on captchas.net
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4 (permalink)  
Old 05-20-2007, 06:26 PM
Newbie
 
Join Date: 08 Mar 2007
Posts: 8
iorgutu1 will become famous soon enough
Default

Thank you very much for your recomandation, seems very good, I hope don`t require links back. I will try it. I will still check a few other before I decide which one I will use on the long term.
________________________
This user added the following:
________________________
I searched on Hotscripts.com :: The net's largest PHP, CGI, Perl, JavaScript and ASP script collection and resource web portal com and I also found I also found Captcha Creator Captcha Creator - PHP Script Package which seems easy to install and works nice.

Last edited by iorgutu1; 05-20-2007 at 06:29 PM. Reason: Double Post
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5 (permalink)  
Old 05-20-2007, 06:34 PM
Ash's Avatar
Ash Ash is online now
CF owner
 
Join Date: 27 Jul 2005
Location: Devon, UK
Posts: 4,130
Ash has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond reputeAsh has a reputation beyond repute
Default

I hope you could link back to us for our help, or just keep visiting us and telling your friends about CompuForums
__________________
Thanks,
Ash
CF Founder

Great Webhosting. Shared starting at $2 per month. VPSes starting at $6 per month.
www.Centicero.com

Want to get in touch? Send me a PM | Do you want to continue receiving free help? Or do you want this site to close? Become a premium member.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #6 (permalink)  
Old 05-20-2007, 06:59 PM
Newbie
 
Join Date: 08 Mar 2007
Posts: 8
iorgutu1 will become famous soon enough
Default

Quote:
Originally Posted by Ash View Post
I hope you could link back to us for our help, or just keep visiting us and telling your friends about CompuForums
Sure, thanks again for your help, I tell my friends about this forum, and when I starts my website I will put a link back for you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #7 (permalink)  
Old 06-26-2007, 03:54 AM
Tom Tom is offline
Gigabyte
 
Join Date: 16 Mar 2007
Posts: 409
Tom is a jewel in the roughTom is a jewel in the roughTom is a jewel in the roughTom is a jewel in the rough
Default

THREAD SOLVED. Nice!!! Positive reputation points to all.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:59 AM.



Powered by: vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Content © Copyright 2005-2008 CompuForums. All Rights Reserved. Some content © Copyright of the respective owners.
Cheap Electricity - Credit Cards - Mobile Phones - Credit Cards

Content Relevant URLs by vBSEO 3.2.0 RC5