i need to make Registration code to prevent from automated registrations in my site but im having problem with this code :
[PHP]<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<?php
$codeID=addslashes($_POST['Code']);
$number=rand(1,3);
if($codeID==""){
echo "Please enter the code shown";
}else{
if($codeID==$CodeKEY){
echo "Right";
}else{
echo "Please enter the code shown";
}
}
switch($number){
case 1:
$CodeKEY="a2je9";
break;
case 2:
$CodeKEY="b1hk5";
break;
case 3:
$CodeKEY="c2589";
break;
}
?>
<?php
echo "<br /><img src='IMGS/Code_$number.gif' border='1'/>";
?>
<br />
<form id="form1" name="form1" method="post" action="">
<input name="Code" type="text" id="Code" maxlength="5" />
<input name="register" type="submit" class="btn" id="register" value="Signup"/>
</form>
<?php echo "Image Key :".$CodeKEY."<br />"."Input Code:".$codeID; ?>
</body>
</html>[/PHP]
any one will test this code need this images: