Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2. /* Tutorial Melindungi Form Dengan Key / Token ( Solusi Captcha ) - By gregetart.blogspot.com  */
  3. $char = array("A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y",
  4.                           "Z","a","b","c","d","e","f","g","h","j","k","l","m","n","p","q","r","s","t","u","v","w","x",
  5.                           "y","z","1","2","3","4","5","6","7","8","9");
  6. $keys = array();
  7. while(count($keys) <= 10) {
  8.     $x = mt_rand(0, count($char)-1);
  9.     if(!in_array($x, $keys)) {
  10.        $keys[] = $x;  
  11.     }          
  12. }
  13. $token = '';
  14. foreach($keys as $key => $val){
  15.    $token .= $char[$val];  
  16. }
  17. $_SESSION['token'] = $token;
  18. ?>