January 14, 2008

Captchamatika

Filed under: catatan harian, php

hehehe… isneg-iseng bikin security code buat form yang ntar-nya bisa di-aplikasi-in di macem2 form, entah form login, form registrasi, atopun form buku tamu… security code ini biasanya lebih dikenal dengan nama CAPTCHA, captcha sendiri bisa diartiin :

A CAPTCHA (IPA: /ˈkæptʃə/) is a type of challenge-response test used in computing to determine whether the user is human. The process involves one computer (a server) asking a user to complete a simple test which the computer is able to generate and grade, but not able to solve on its own. Because computers are unable to solve the CAPTCHA, any user entering a correct solution is presumed to be human.

Sumber : http://en.wikipedia.org/wiki/Captcha 

nah… captcha yang aku bikin ini emang berbasis Image, tapi ga pake tambahan titik atau garis dibelakangnya, en ga pake ngrubah pola en posisi karakter per karakter, klo captcha biasa user tinggal menuliskan apa yang diliat digambar, klo captcha yang ini user harus sedikit menggunakan kemampunannya berhitung, alias matematika…

jadi bisa dibilang captcha ini menggabungkan gambar dan matematika, makanya sama Pakdhe dikasih nama CapTchaMatika, hehehe…

fungsi imagenya diambil dari contoh fungsi dasar imagecreate-nya PHP.

(start PHP here)

header("Content-type: image/png");
$im = @imagecreate(110, 20)
    or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);

(end PHP here)

nah perubahannya di

"A Simple Text String"

yang diubah jadi variabel yang di-generate pake fungsi rand().

untuk versi lengkap dari captchamatika 0.1 bisa diambil

disini

Selamat Mencoba…. :D :D :D , and mohon kritik plus sarannya yah…


1 Comment »

  1. 0647 wrote :
    January 14, 2008 @ 3:56 pm

    simple… tapi kurang meriah. kasih gambar dikit napa lit !!

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>





Anti-spam measure: please retype the above text into the box provided.

< Most Popular Posts />