session kontrolünde bir yerde takılıyorum ama sonuç elde edemedim. bir yardım rica edeceğim.
index sayfam
<?php session_start();
include("conf/baglanti.php");
include("kontrol.php");
include("header.php"); ?>
Hoşgeldin<br>
<a href="cikis.php">çıkış</a>
<br>
<?php include("footer.php"); ?>şeklindelogin formu giris.php ye yönlendiriyor ve kodları:
<?php include("conf/baglanti.php"); ?>
<?php
session_start();
$Kullanici_Adi = $_POST["Kullanici_Adi"];
$Sifre = $_POST["Sifre"];
$sorgu = mysql_query("select * from Kullanicilar where Kullanici_Adi = '$Kullanici_Adi' and Sifre='$Sifre'");
$uyevarmi = mysql_num_rows($sorgu);
if($uyevarmi == 0) {
echo "<script>location.href='hata.php';</script>". "";
}else{
$bilgi = mysql_fetch_assoc($sorgu);
$_SESSION["Giris"] = $bilgi['Kullanici_Adi'];
header('Location:./');
}
?>ve kontrol sayfam<?php
$giris_yapilmis = false;
$uye = false;
if( !empty($_SESSION["Giris"]) && !empty($_SESSION["Kullanici_Adi"]) ){
$sorgu = mysql_query("select * from Kullanicilar where Kullanici_Adi='".$_SESSION["Kullanici_Adi"]."'");
if( mysql_num_rows($sorgu) == 1 ){
$uye = mysql_fetch_assoc($sorgu);
if( $_SESSION["Giris"] = $uye["Kullanici_Adi"]){
$giris_yapilmis = true;
}else{
$uye = false;
}
}
}
?>son olarak da çıkış sayfam<?php session_start(); unset($_SESSION['Giris']); session_destroy(); echo "<script>location.href='login.php';</script>"; ?>şeklinde. index sayfamda çıkış linkine tıklayıp çıkış yapsam bile tekrar index sayfama giriş izni veriyor. yani bir şekilde session um çalışmıyor ama neden çalışmıyor bulamadım