| 1 |
<?php |
| 2 |
|
| 3 |
// Make the page validate |
| 4 |
ini_set('session.use_trans_sid', '0'); |
| 5 |
|
| 6 |
// Include the random string file |
| 7 |
require 'rand.php'; |
| 8 |
|
| 9 |
// Begin the session |
| 10 |
session_start(); |
| 11 |
|
| 12 |
// Set the session contents |
| 13 |
$_SESSION['captcha_id'] = $str; |
| 14 |
|
| 15 |
?> |
| 16 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 17 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 18 |
|
| 19 |
<head> |
| 20 |
<title>AJAX CAPTCHA</title> |
| 21 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> |
| 22 |
<meta name="keywords" content="AJAX,JHR,PHP,CAPTCHA,download,PHP CAPTCHA,AJAX CAPTCHA,AJAX PHP CAPTCHA,download AJAX CAPTCHA,download AJAX PHP CAPTCHA" /> |
| 23 |
<meta name="description" content="An AJAX CAPTCHA script, written in PHP" /> |
| 24 |
|
| 25 |
<script type="text/javascript" src="../../lib/jquery.js"></script> |
| 26 |
<script type="text/javascript" src="../../jquery.validate.js"></script> |
| 27 |
<script type="text/javascript" src="captcha.js"></script> |
| 28 |
|
| 29 |
<link rel="stylesheet" type="text/css" href="style.css" /> |
| 30 |
<style type="text/css"> |
| 31 |
img { border: 1px solid #eee; } |
| 32 |
p#statusgreen { font-size: 1.2em; background-color: #fff; color: #0a0; } |
| 33 |
p#statusred { font-size: 1.2em; background-color: #fff; color: #a00; } |
| 34 |
fieldset label { display: block; } |
| 35 |
fieldset div#captchaimage { float: left; margin-right: 15px; } |
| 36 |
fieldset input#captcha { width: 25%; border: 1px solid #ddd; padding: 2px; } |
| 37 |
fieldset input#submit { display: block; margin: 2% 0% 0% 0%; } |
| 38 |
#captcha.success { |
| 39 |
border: 1px solid #49c24f; |
| 40 |
background: #bcffbf; |
| 41 |
} |
| 42 |
#captcha.error { |
| 43 |
border: 1px solid #c24949; |
| 44 |
background: #ffbcbc; |
| 45 |
} |
| 46 |
</style> |
| 47 |
</head> |
| 48 |
|
| 49 |
<body> |
| 50 |
|
| 51 |
<h1><acronym title="Asynchronous JavaScript And XML">AJAX</acronym> <acronym title="Completely Automated Public Turing test to tell Computers and Humans Apart">CAPTCHA</acronym>, based on <a href="http://psyrens.com/captcha/">http://psyrens.com/captcha/</a></h1> |
| 52 |
|
| 53 |
<form id="captchaform" action=""> |
| 54 |
<fieldset> |
| 55 |
<div id="captchaimage"><a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="refreshimg" title="Click to refresh image"><img src="images/image.php?<?php echo time(); ?>" width="132" height="46" alt="Captcha image" /></a></div> |
| 56 |
<label for="captcha">Enter the characters as seen on the image above (case insensitive):</label> |
| 57 |
<input type="text" maxlength="6" name="captcha" id="captcha" /> |
| 58 |
<input type="submit" name="submit" id="submit" value="Check" /> |
| 59 |
</fieldset> |
| 60 |
</form> |
| 61 |
|
| 62 |
<p>If you can't decipher the text on the image, click it to dynamically generate a new one.</p> |
| 63 |
|
| 64 |
</body> |
| 65 |
|
| 66 |
</html> |