php -> basit session örneği
07 Nisan 2011 // 0 CommentsYukarıdaki şema da session mantığında çalışan dosyalarımızın ilişkisi anlatılmaktadır.
GirisForm.php
<form id="form1" name="form1" method="post" action="giris.php">
<p>
<label for="username"></label>
Kullanıcı adı
<input name="username" type="text" id="username"
value="" />
</p>
<p>
<label for="password"></label>
Şifresi
<input name="password" type="password" id="password"
value="" />
</p>
<p> </p>
<p>
<label for="button"></label>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
giris.php
<?php
session_start();
if(($_POST["username"]=="admin") and ($_POST["password"]=="1234"))
{
$user=$_POST["username"];
//session kayıt et
session_register("user");
//uye sayfasıbna gönder
header('Location:http://localhost/cookie/uye.php');
}
else
{
header('Location:http://localhost/cookie/hata.php');
}
?>
uye.php
<?php
session_start();
if (!isset($_SESSION["user"]))
{
//session yoksa GİRİŞ FORMUNA YÖNLENDİR
header('Location:http://localhost/cookie/GirisForm.php');
}
?>
<h3>burası üyelere özeldir</h3>
hata.php
giriş başarısız<a href="GirisForm.php"> Giriş </a>sayfasından tekrar deneyiniz
Similar posts
-
php -> session örneği
24 Şubat 2012 // 0 Comments<?php include("kontrol.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tra...
-
php -> oturum yönetimi, session nedir?
07 Nisan 2011 // 2 CommentsSession Nedir? Sunucu tabanlı olan php, asp.net vb gibi uygulamalarda kullanıcı girişi yapı...



