Merhaba arkadaşlar ben formda resimli güvenlik kodu kullanmak istiyorum. Resim üzerine sayı ve rakamları yazdırıyorum. Ancak formda güvenli kodu bölümüne girilen kod ile resimdeki kodun uyuşup uyuşmadığını nasıl kontrol edicem bi türlü yapamadım..Kodlar aşağıda yardımcı olursanız sevinirim...
guvenlik.php
<?php
function olustur () {
$sifre = substr(md5(rand(0,999999999999)),-6);
if ($sifre) {
session_start();
$_SESSION["guv"] = $sifre;
$width = 100;
$height = 30;
$resim = ImageCreate($width,$height);
$beyaz = ImageColorAllocate($resim, 255, 255, 255);
$rand = ImageColorAllocate($resim, rand(0,255), rand(0,255), rand(0,255));
ImageFill($resim, 0, 0, $rand);
ImageString($resim, 5, 24, 7, $_SESSION["guv"], $beyaz);
ImageLine($resim, 100, 19, 0, 19, $beyaz);
header("Content,type: image/png");
ImagePng($resim);
ImageDestroy($resim);
}
}
olustur();
?>form.php
<?php session_start(); ?>
<form method="POST" action="kontrol.php">
<img src="guvenlik.php"><br>
Güvenlik Kodu:
<label>
<input type="text" name="kod" id="kod" />
</label>
<br>
<label>
<input type="submit" name="button" id="button" value="Gonder" />
</label>
</FORM>