Share this topic on Del.icio.usShare this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on SlashdotShare this topic on StumbleUponShare this topic on TechnoratiShare this topic on TwitterShare this topic on YahooShare this topic on Google buzz

Author Topic: Captcha Image Penjumlahan  (Read 1879 times)

0 Members and 2 Guests are viewing this topic.

Offline ainkdast

  • Bibit IF
  • *
  • Posts: 26
  • Reputasi: 1

  • Aktivitas bulan ini
    0%
Captcha Image Penjumlahan
« on: 14 March 2009, 19:26:46 »
Quote
    Captcha merupakan singkatan dari ?Completely Automated Public Turing test to tell Computers and Humans Apart? ( Wikipedia ). dan dibuat untuk membedakan antara mesin ( bot ) dan manusia dengan cara mem-validasi sebuah inputan.
    Kenapa harus divalidasi? soalnya banyak banget program2 SPAM COmment yang bisa aja menyerang situs kita. Kebayang kan klo kita bikin website, terus isi dari Comment/guestbook di website kita itu isinya Link2 ad ato penawaran tentang produk ato ga link gak jelas. Jadi gak sedap dipandang. Biasanya yg ngisi Comment adalah program yang secara otomatis melakukan submit ke buku tamu / halaman comment website/blog kita.. Nah, klo pernah kejadian kayak gitu ato ga ngeliat yang kayak gitu, sebaiknya lengkapi websitenya dengan Captcha.
    Captcha = Gambar Samar2
    Simpelnya, Captcha merupakan sebuah gambar (image) yang berisi Angka / Teks atau kombinasi Angka & teks yang disamar2kan bentuk & rupanya sehingga memerlukan ketelitian dari pengunjung / orang yang ingin melakukan inputan data disebuah website???.

by ainkdast
Code: [Select]
http://ainkdast.web.id/2009/03/chaptcha-image-penjumlahan/
Mungkin kamu-kamu semua udah tau cara bikin chaptcha kaya gambar ini

kamu-kamu tinggal include file captchasecurityimages.php yang berkeliaran di mbah google??hehe??..

Nah di sini ipank mo ngasih tau ( yang udah tau jangan marah y?hehe? ) klo captchasecurityimages.php itu bisa di modif lho jadi bukan cuma kombinasi huruf ma angka doank tapi bisa juga buat Chaptcha Penjumlahan kaya gini

Nih Kode hasil modifikasi file captchasecurityimages.php  :
Quote
Code: [Select]
<?php session_start();
class 
CaptchaSecurityImages {
var 
$font 'monofont.ttf';
function 
CaptchaSecurityImages($width='220',$height='40',$characters='4') {
$possible '123456789';
$op1 =substr($possiblemt_rand(0strlen($possible)-1), 1);
$op2 =substr($possiblemt_rand(0strlen($possible)-1), 1);
$code '';
$jawab $op1+$op2;
$code .= $op1."+".$op2."=";
/* font size will be 75% of the image height */
$font_size $height 0.75;
$image = @imagecreate($width$height) or die('Cannot Initialize new GD image stream');
/* set the colours */
$background_color imagecolorallocate($image255255255);
$text_color imagecolorallocate($image2040100);
$noise_color imagecolorallocate($image100120180);
/* generate random dots in background */
for( $i=0$i<($width*$height)/3$i++ ) {
imagefilledellipse($imagemt_rand(0,$width), mt_rand(0,$height), 11$noise_color);
}
/* generate random lines in background */
for( $i=0$i<($width*$height)/150$i++ ) {
imageline($imagemt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox imagettfbbox($font_size0$this->font$code);
$x = ($width $textbox[4])/2;
$y = ($height $textbox[5])/2;
imagettftext($image$font_size0$x$y$text_color$this->font $code);
/* output captcha image to browser */
imagejpeg($image);
imagedestroy($image);
$_SESSION['jawab'] = $jawab;
}
}
$width = isset($_GET['width']) ? $_GET['width'] : ?120&#8242;;
$height = isset($_GET['height']) ? $_GET['height'] : ?40&#8242;;
$characters = isset($_GET['characters']) ? $_GET['characters'] : ?6&#8242;;
header(?Content-Typeimage/jpeg?);
$captcha = new captchasecurityimages($width,$height,$characters);
?>

ini kode yang manggil (index.php)
Quote
Code: [Select]
<?php session_start(); ?>
<!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>
<title>Captcha Penjumlahan</title>
</head>

<body>
<?php
if(isset($_POST['aksi'])){//1
     if ($_SESSION[jawab] == $_POST[jawab] && !empty($_SESSION[jawab]))

 {//3
$msg "Kode Validasi Anda Benar........";
}
                else {//7
                 $error 'Kode Validasi Yang Anda Masukkan Salah...';
                     }//7
}
        
?>

<?php if(isset($error)){?><font color="#FF0000" size="+2"><?php echo $error;}?><br><br></font>
<?php if(isset($msg)){ echo $msg;} else {
?>

<h3>Masukkan Kode Validasi</h3>
<form method="post" action="">
<table border="0">
<tr><td>kode Validasi : <br /><img src="./captchasecurityimages.php?width=100&height=40&character=5" /></td></tr>
<tr><td><input name="jawab" type="text" class="input" size="11" /></td></tr>
            <tr><td><input name="aksi" type="submit" class="tombol" value="Simpan" /></td></tr>
          </table>
</form>
 <?php }
 
?>

</body>
</html>
    Dan Klo Yang Mo Script lengkap ama file monofont.ttf nya  yang ada di
Code: [Select]
http://ainkdast.web.id/chaptcha/

« Last Edit: 25 March 2009, 23:25:05 by ainkdast »

Forum Informatika

Captcha Image Penjumlahan
« on: 14 March 2009, 19:26:46 »
Sponsored Links:


Offline 1nf0rm4t1c5

  • Administrator
  • *
  • Posts: 1090
  • Reputasi: 15
  • Informatics Developer

  • Aktivitas bulan ini
    4%
    • Forum Informatika
  • Lokasi: Indonesia
  • Jenis Kelamin: Laki-laki
Re: Captcha Image Penjumlahan
« Reply #1 on: 14 March 2009, 22:09:12 »
thanx... jangan lupa link-nya di CODE
Full access for guest [REGISTER]
Please read the rule [RULES]
Promosi?  [STEP-BY-STEP]

RAR PASSWORD : http://if.web.id --> buat buka file rar

Offline ainkdast

  • Bibit IF
  • *
  • Posts: 26
  • Reputasi: 1

  • Aktivitas bulan ini
    0%
Re: Captcha Image Penjumlahan
« Reply #2 on: 15 March 2009, 08:51:48 »
thanx... jangan lupa link-nya di CODE
:D :D :D :D :D :D :D :D :D :D :D :D
sory bozzz lupa.........

Offline lumine

  • Developer IF
  • *
  • Posts: 519
  • Reputasi: 9

  • Aktivitas bulan ini
    0%
Re: Captcha Image Penjumlahan
« Reply #3 on: 16 March 2009, 09:25:27 »
liat gan

Offline ranotea

  • Siswa IF
  • *
  • Posts: 136
  • Reputasi: 9

  • Aktivitas bulan ini
    0%
    • Ranotea's Weblog
  • Lokasi: Bandung
Re: Captcha Image Penjumlahan
« Reply #4 on: 05 April 2009, 10:05:17 »
bagus  :yes:

Offline bayuhades

  • Newbie
  • *
  • Posts: 10
  • Reputasi: 0
  • Bukan Malaikat

  • Aktivitas bulan ini
    0%
  • Lokasi: Bali
  • Jenis Kelamin: Laki-laki
Re: Captcha Image Penjumlahan
« Reply #5 on: 20 April 2011, 12:16:39 »
http://ainkdast.web.id/chaptcha/ dWeb ini koq gak ada apa" y???? :D