beni hatırla yı işaretlemeden veya herhangi bir süre belirtmeden 10 sn.lik cookie atıyor.
süre belirlediği zaman belirlediği sn.lik cookie atıyor
eğer beni hatırla seçiliyse sınırsız süreli bi cookie atıyor
hepsini denedim çalışıyor
fakat şöyle bir sorunum var
örneğin beni hatırlayı seçerek girdim
süre sınırsız diyor
ama adres satırına imleci getirip enter a bastığımda geri 10sn.ye dönüyor
aynı durum süre belirlemede de geçerli
örnek site:
Company Life v1.0
kullanıcı adı: halilkaya
şifre: 123456
bu sitenin tüm kodları da aşağıdaki gibidir:
<?php ob_start(); ?>
<html>
<head>
<title> Company Life v1.0 </title>
</head>
<body>
<?php
$s = $_GET["s"];
switch($s) {
case "logout":
?>
<?php
setcookie("id", $id, time()-9999);
setcookie("kullaniciadi", $kullaniciadi, time()-9999);
setcookie("sifre", $girilen_sifre, time()-9999);
setcookie("ad", $ad, time()-9999);
setcookie("soyad", $soyad, time()-9999);
setcookie("eposta", $eposta, time()-9999);
setcookie("kayittarihi", $kayittarihi, time()-9999);
header("Location:index.php");
?>
<?php
break;
case "index":
?>
<?php
include("config.php");
if (($_COOKIE["kullaniciadi"]) and ($_COOKIE["sifre"])) {
$kullaniciadi = $_COOKIE["kullaniciadi"];
$girilen_sifre = $_COOKIE["sifre"];
} else {
$kullaniciadi = $_POST[kullaniciadi];
$girilen_sifre = $_POST[sifre];
}
$benihatirla = $_POST[benihatirla];
$suredk = $_POST[suredk];
$sifre = sha1($girilen_sifre);
$sql = "SELECT * FROM Giris WHERE KullaniciAdi='$kullaniciadi' AND Sifre='$sifre'";
$sorgu = mysql_query($sql);
$i = mysql_fetch_row($sorgu);
$id = $i[0];
$db_kullaniciadi = $i[1];
$db_sifre = $i[2];
$ad = $i[3];
$soyad = $i[4];
$eposta = $i[5];
$kayittarihi = $i[6];
if ($kullaniciadi=="") {
echo "<font color='red'><b><small>Kullanıcı adını giriniz!</b></font> <a href='javascript:history.back()'>Tekrar Dene</a></small>";
} elseif ($girilen_sifre=="") {
echo "<font color='red'><b><small>Şifreyi giriniz!</b></font> <a href='javascript:history.back()'>Tekrar Dene</a></small>";
} elseif (($kullaniciadi==$db_kullaniciadi) and ($sifre==$db_sifre)) {
if (!($suredk=="")) {
$suree = $suredk;
$zamanlama = "var";
} elseif ($benihatirla=="on") {
$suree = "99999";
$zamanlama = "yok";
} else {
$suree = "10";
$zamanlama = "var";
}
setcookie("id", $id, time()+$suree);
setcookie("kullaniciadi", $kullaniciadi, time()+$suree);
setcookie("sifre", $girilen_sifre, time()+$suree);
setcookie("ad", $ad, time()+$suree);
setcookie("soyad", $soyad, time()+$suree);
setcookie("eposta", $eposta, time()+$suree);
setcookie("kayittarihi", $kayittarihi, time()+$suree);
if ($zamanlama="var") {
?><meta http-equiv=refresh content=<?=$suree;?>;url=index.php><?php
}
if ($suree=="99999") {
$bhdurum = "Sınırsız";
} else {
$bhdurum = $suree." dk.";
}
echo "<font color='green'><small>Hoşgeldin, <b>".$ad." ".$soyad."</b>. Sisteme bağlı kalma süreniz: <b>".$bhdurum."</b>. <a href='?s=logout' name='logoutb' style='text-decoration:none; color:blue'>Çıkış Yap</a></font></small>";
} elseif (!($suredk=="")) {
if (!(is_numeric($suredk))) {
echo "<font color='red'><b><small>Bağlı kalmak istediğiniz süreye <u>sayısal</u> bir değer giriniz!</b></font> <a href='javascript:history.back()'>Tekrar Dene</a></small>";
}
} else {
echo "<font color='red'><b><small>Hatalı bilgiler girdiniz!</b></font> <a href='javascript:history.back()'>Tekrar Dene</a></small>";
}
?>
<?php
break;
default:
?>
<?php
if (($_COOKIE["kullaniciadi"]) and ($_COOKIE["sifre"])) {
header("Location:?s=index");
} else {
?>
<center>
<br><br><br>
<form action="?s=index" method="post" name="yetkili_giris_formu">
<table bordercolor="gray" style="border-collapse:collapse; border-top:1px solid gray; border-left:1px solid gray; border-right:1px solid black; border-bottom:1px solid black">
<tr>
<td>
<table border="0" cellspacing="5" cellpadding="5" style="border-collapse:collapse">
<tr style="border-bottom:1px solid black; background:lightblue">
<td colspan="2" align="center">
<b> Yetkili Giriş Formu </b>
</td>
</tr>
<tr bgcolor="#F0F0F0">
<td align="left">
<small><b>Kullanıcı Adı</b></small>
</td>
<td align="center">
<input type="text" name="kullaniciadi">
</td>
</tr>
<tr bgcolor="#F0F0F0">
<td align="left">
<small><b>Şifre</b></small>
</td>
<td align="center">
<input type="password" name="sifre">
</td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="2" align="left">
<input type="checkbox" name="benihatirla"><small><b>Beni hatırla</b></small>
<hr color="gray" size="1" width="95%">
<script type="text/javascript">
function SureBelirle1() {
document.getElementById("sure").style.visibility="visible";
document.getElementById("sure").style.position="relative";
document.getElementById("sblink").innerHTML="<a href='#' onClick='SureBelirle2()' style='text-decoration:none'><font color='black'><small>Süre belirle <img src='icons/yukari.gif' border='0'></small></font></a>";
}
function SureBelirle2() {
document.getElementById("sure").style.visibility="hidden";
document.getElementById("sure").style.position="absolute";
document.getElementById("sblink").innerHTML="<a href='#' onClick='SureBelirle1()' style='text-decoration:none'><font color='black'><small>Süre belirle <img src='icons/asagi.gif' border='0'></small></font></a>";
}
</script>
<div id="sblink"><a href="#" onClick="SureBelirle1()" style='text-decoration:none'><font color='black'><small>Süre belirle <img src='icons/asagi.gif' border='0'></small></font></a></div>
<div id="sure" style="visibility:hidden; position:absolute">
<small>
<input type="text" name="suredk" size="2" style="font-size:11px; border:1px solid black"> dk. bağlı kalmak istiyorum.
</small>
</div>
</td>
</tr>
<tr style="border-top:1px solid black; background:lightblue">
<td colspan="2" align="right">
<button type="submit" name="login"><table border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse"><tr><td><img src="icons/gir.gif"></td><td> <b><small>Güvenli Giriş</small></b></td></tr></table></button>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</center>
<?php
}
?>
<?php
break;
}
?>lütfen acil yardımlarınızı bekliyorum.şimdiden teşekkürler...
. Mesela bilgiler post ile gönderildi ve beni hatırla seçeneği işaretlendi ve $benihatirla='on' oldu. Ama sayfa tekrar çağrıldığı zaman yani adres satırında entere bastığın zaman bu sefer post ile bilgi gönderilmiyor ama sen yinede $benihatirla=$_POST[benihatirla] yapmışsın. Tabi $_POST[benihatirla] değişkeni NULL olduğu için kodun şu kısmı işleniyor