ceviz.net te bir kod buldum.resmin üzerine tıklanınca değişiyor.
<?php
session_start();
function show_image()
{
$Rastgele=rand(0,999999999);
$Kod=md5($Rastgele);
$Guvenlik=substr($Kod,-10);
$_SESSION['Guvenlik']=$Guvenlik;
$Width=100;$Height=25;
$Resim=imagecreate($Width,$Height);
$Beyaz=imagecolorallocate($Resim,255,255,255);
$Siyah=imagecolorallocate($Resim,0,0,0);
imagefill($Resim,0,0,$Siyah);
imagestring($Resim,5,5,5,$_SESSION[Guvenlik],$Beyaz);
header("Content-Type:image/png");
imagepng($Resim);
imagedestroy($Resim);
exit;
}
if (isset($_GET['show_image']) OR isset($_REQUEST['show_image']))
{
show_image();
}
elseif ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$code = trim($_POST['code']);
$error = false;
if (empty($code) OR $code != $_SESSION['Guvenlik'])
{
$error = true;
}
else
{
echo '<script type="text/javascript">alert("Dogru kod.. yonlendirileceksiniz...");</script>';
//header("Location: xxxx.php");
exit;
}
}
echo '
<script type="text/javascript">
function reload ()
{
document.getElementById(\'guvenlikkodu\').src = "'.$_SERVER['SCRIPT_NAME'].'?" + (new Date()).getTime() + "&show_image=1";
return;
};
</script>
<br><img src="https://www.r10.net/php/'.$_SERVER['SCRIPT_NAME'].'?show_image=1" border="0" id="guvenlikkodu" style="cursor:pointer" onclick="javascript:reload()" alt="okumakta zorluk cekiyorsaniz buraya tiklayin" title="okumakta zorluk cekiyorsaniz buraya tiklayin"><br>';
echo '<form method="POST" action="'.$_SERVER['SCRIPT_NAME'].'">
Guvenlik kodunu girin: <input type="text" name="code" value="">
<input type="submit" value="dogrula"></form>'.($error ? '<br><br><b>Hatali kod.</b>' : '');
?>