U-This39s CAPTCHA
U-This39, 18.09.2007 02:14
<?php
 /* U-This39's CAPTCHA*/

 session_start();

 
 function GetRandChar($rN = 0)
 {
  $rT = rand(0, $rN);
  if($rT==0)
  {
   $rC = rand(48, 57);
  }
  elseif($rT==1)
  {
   $rC = rand(97, 122);
  }
  elseif($rT==2)
  {
   $rC = rand(65, 90);
  }
  
  return chr($rC);
 }
 
 $w = 120; //image width
 $h = 40; //image height
 $nC = 5; //num of char
 $tC[0]=0; //main text color
 $tC[1]=180; //back text color 1
 $tC[2]=200; //back text color 2
 $tC[3]=220; //back text color 3
 $image = imagecreate($w, $h);
 $bgColor = imagecolorallocate($image, 245, 245, 245); //background color
 $textColor[0] = imagecolorallocate($image, $tC[0], $tC[0], $tC[0]);
 $textColor[1] = imagecolorallocate($image, $tC[1], $tC[1], $tC[1]);
 $textColor[2] = imagecolorallocate($image, $tC[2], $tC[2], $tC[2]);
 $textColor[3] = imagecolorallocate($image, $tC[3], $tC[3], $tC[3]);
 $font = 5; //imageloadfont("font.gdf");
 $randFull = '';
 for($i=0;$i<$nC;$i++)
 {
  for($k=0;$k<10;$k++)
  {
   $bC = GetRandChar(2);
   $x = (($w / $nC) * $i) + rand(-5, 15);
   $y = rand(-5, 25);
   imagestring($image, $font, $x, $y, $bC, $textColor[rand(1, 3)]);
  }
  $rand[$i] = GetRandChar(); //fill with number 0 to 3 to specify the chars to be randomized
  $randFull .= $rand[$i];
  $x = (($w / $nC) * $i) + rand(0, 10);
  $y = rand(0, 20);
  imagestring($image, $font, $x, $y, $rand[$i], $textColor[0]);
 }
 $_SESSION['ImgVerVal'] = md5($randFull);
 
 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 header("Cache-Control: no-store, no-cache, must-revalidate");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");
 header('Content-type: image/png');
 imagepng($image);
 imagedestroy($image);
?>
read 1635 times 6 comments

andyan, 20.11.2008 15:23
hemm..
tu kode buat apa ya..
hmm.. liat form pengisian komen itu, kan ada isian untuk masukin angka yang ada di gambar itu kan? nah, ini adalah kode untuk men-generate (membuat) gambar itu..
Tysa, 20.11.2008 15:33
eh ada Andyan juga ya disini hore
kyaa.. pingu.. malah reuni wehee
addiehf, 07.01.2009 04:25
naronya di comment.php kah?

pluginnya jg dah ada ya?
penggunaannya sangat simple, untuk contoh cara penggunaan bisa download di [url]http://blog.yudhist39.com/files/captcha.rar[/url]
d\'anz, 29.01.2009 14:54
tuh kode di paste di coment.php atau di upload di cpanel
ada ga tutorial bikin themes kaya punya situ,
code ini masukin k dalam suatu file, lalu d'upload ke host. nanti pada saat verifikasi komentar, baca inputan dari user, beri function md5() pada inputan itu, lalu disamakan dengan $_SESSION['ImgVerVal']. jika sama maka valid, jika tidak sama maka tidak valid dan harus mengulang untuk mengisi inputan lagi..

themes yang kupake ini ak bikin sendiri. tutorial pembuatannya sih ga ada untuk themes yang kupake..
arvernester, 26.03.2009 19:52
coba ah..,,
contohnya kayak capcay yang do bawah comment bos ini bukan? humm
yo'i. bener banget... hehe
starboard, 31.03.2009 08:31
jotosjotosjotosjotos wes di perpanjang tapi rak tau di apdet hahahahahahahahaha
ho'o kie. wes males blog2an. luwih seru neng forum... wehee

give your comment
Name
URL
broken ckckck cuek dunno gotit haah haha hahaha heehee hehe hemm
heyy hore huff humm huuh jotos keren love marah muah nangis
nonono peluk piss sedih siul smile tepuk ting wehee wekk what
Comment
allowed tags : <a>, <b>, <i>, <u>, <s>
U-This39's CAPTCHA
fill the box below with the black colored number shown above