mase
____ ___ ____ __
- Reaction score
- 154
For those who don't know, captcha is the image that has random numbers/letters in it when you register on most sites.
HTML:
PHP:
HTML/PHP/Images in a zip attached.
HTML:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mase tests Register</title>
</head>
<script type="text/javascript">
var caps = new Array;
caps[1] = "side1.gif";
caps[2] = "side2.gif";
caps[3] = "side3.gif";
caps[4] = "side4.gif";
caps[5] = "side5.gif";
caps[6] = "side6.gif";
function setCap(){
var form = document.getElementById('capval');
var rnd = Math.floor(Math.random()*6)+1;
var img = document.getElementById("capimg");
img.src = caps[rnd];
form.value = rnd;
}
</script>
<body onload="setCap()">
<img id="capimg" alt="" src="" />
<form action="process.php" method="POST" name="registerform" id="registerform">
<input type="hidden" name="capval" id="capval" value="" />
<select name="cap">
<option value="0" selected="selected">Choose One</option>
<option value="1">Side 1</option>
<option value="2">Side 2</option>
<option value="3">Side 3</option>
<option value="4">Side 4</option>
<option value="5">Side 5</option>
<option value="6">Side 6</option>
</select>
<input type="submit" value="OK" />
<input type="hidden" value="reg" name="action" />
</form>
</body>
</html>
PHP:
PHP:
<?
$caprealanswer = $_POST["capval"];
$capanswer = $_POST["cap"];
if ($capanswer == $caprealanswer){
echo "Correct!<br />";
} else {
echo "Incorrect!<br />";
}
echo $capanswer . "<br />";
echo $caprealanswer
?>
HTML/PHP/Images in a zip attached.