<?php
session_start();
$en=100;
$boy=100;
$sayi = mt_rand(900000,1000000);
$_SESSION['code'] = $sayi;
$tuval = imagecreatetruecolor($en,$boy);
$beyaz = imagecolorallocate($tuval,255,255,255);
$siyah = imagecolorallocate($tuval,0,0,64);
imagefill($tuval,0,0,$siyah);
imageline($tuval,20,50,$en,$boy,$beyaz);
imagestring($tuval,3,20,30,$sayi,$beyaz);
Header("content-type:image/gif");
imagegif($tuval);
imagedestroy($tuval);
?><?php
echo "<img src='guvenlik.php'>";
?>
<html>
<form action="gelen.php" method="post">
<input type="text" name="girilen"><br>
<input type="submit" value="gönder">
</form>
</html>
<?php
session_start();
$girilen = $_REQUEST["girilen"];
if($_SESSION['code'] == $girilen){
echo "Başarılı";
}else{
echo "Başarısız";
}
?>$sayi değişkenini sayfalar arası taşımak için SESSION kullanman gerekir.