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();
?>Burdaki kod session["guv"]; 'a atanıyor.Ben java kontrolünde güvenlik kodu doğrumu yanlışmı kontrol etmek istiyorum. Bunu nasıl yapabilirim. Fikir verirseniz sevinirim.
java kontrol kodu bu şekilde yaptım ancak olmadı
if ($("#guvenlik").val()!='<?php echo $_SESSION["guv"]; ?>') {
$("input.guvenlik").addClass("zorunlu");
alert("Güvenlik Kodu Hatalı! Kontrol Ediniz.");
return false;
}