Avance Zone

PHP Javascript Free Capcha

<div id="AvanceZone">
<?php
session_start();
if( isset($_POST['submit']))
 {
  $number1=rand(2,10);
  $number2=rand(3,10);
  $sum = $number1+$number2;
 
// For Debug  For Debug For Debug For Debug For Debug For Debug
//
//echo "Session value  is  <b> ". $_SESSION['val'] . " </b>But Typed AS : <b>" . $_POST['security_code'] . ".</b><br />";
//
// For Debug For Debug For Debug For Debug For Debug For Debug
 
  if( $_SESSION['val'] == $_POST['security_code'] )
  {
  echo 'Thank you. We Will Contact you Shortly';
    }
    else {
  echo 'Sorry, you have provided an Invalid security code';
       }
       session_destroy();
}
else
{
?>
 
 <form action="2.php" method="post">
  <label for="security_code">
  <?php
  $number1=rand(2,10);
  $number2=rand(3,7);
  $sum = $number1+$number2;
  $_SESSION['val']=$sum;
  echo "Please Enter The Sum Of <b> ". $number1 . " </b>And <b>" . $number2 . ".</b><br />";
  ?>
  </label>
  <input id="security_code" name="security_code" type="text" /><br />
  <input type="submit" name="submit" value="Submit" />
 </form>
 
<?php
 }
?>
</div>

Php Free Captch . Randowm Number generator to avoid spam

Use the below code with cache control to generate a random number to avod spam in form submissions

<div id="AvanceZone">
<?php
Header("Cache-Control: must-revalidate");
 
$offset = 60 * 60 * 24 * 3;
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
Header($ExpStr);
?>
<script type="text/javascript">
function check()
{
var string1=document.capcha_sum.sum.value
if (string1.==$sum){
alert("Try Again !")
document.capcha_sum.email.focus()
}
}
</script>
<?php
$number1=rand(2,10);
$number2=rand(3,7);
//echo "$number1";
//echo "$number2";
$sum = $number1+$number2;
//echo "$sum";
echo "Please Enter The Sum Of <b> ". $number1 . " </b>And <b>" . $number2 . ".</b><br />";
?>
<form name="capcha_sum">
<input type="text" size="10" name="sum">
<input type="submit" name="B1" value="Submit" onclick="check()">
</form>
</div>

Avance Zone