Ekrana sadece 3 harf bastıran oldukça basit bir güvenlik kodu (capthca) scripti. Aşağıdaki kodları capthca.php ismiyle kaydedin ve kullanmak istediğiniz formdan <img src="capthca.php" alt="" /> şeklinde çağırın.
Script güvenlik kodunu $_SESSION[‘capthca’] ismiyle sessiona kaydeder ve kullanıcının formdan girdiği kodu bu veriyle karşılaştırarak güvenlik kontrolü sağlayabilirsiniz.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?php session_start(); $karakter = "3"; // kaç karakter? $harfler = str_split('ABCDEFGHJKLMNPRSTUVXYZ'); shuffle($harfler); $metin = implode(' ', array_slice($harfler, 0, $karakter)); $font = "fonts/Harabara.ttf"; $_SESSION['capthca'] = str_replace(' ','',$metin); header("Content-type: image/png"); $im = @imagecreate(56, 22) or die ("Guvenlik kodu resmi olusturulamadi!"); imagecolorallocate($im, 13, 13, 13); $color1 = imagecolorallocate($im, 235, 231, 63); //metin rengi $color2 = imagecolorallocate($im, 240, 240, 240); $color3 = imagecolorallocate($im, 153, 23, 79); imageline($im, mt_rand(0,55), mt_rand(0,20), mt_rand(0,55), mt_rand(0,20), $color2); imageline($im, mt_rand(5,55), mt_rand(9,20), mt_rand(3,55), mt_rand(8,30), $color3); imageline($im, mt_rand(0,55), mt_rand(0,40), mt_rand(1,15), mt_rand(1,50), $color3); imagettftext($im, 16, 2, 2, 19, $color1, $font, $metin); imagepng($im); imagedestroy($im); ?> |
bende ümitlendm hani bunun giriş kutucuqu kontrol formu sadece güvenlik resmi çıkıyor o kadarı her yerde var