Login Uygulaması2 (Veri Tabanı Kullanmadan)
OturumGirisi.php
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if (!empty($_POST)) {
if ($_POST['kullanici_adi'] == "ali" && $_POST['sifre'] == "1") {
$_SESSION['oturum_sifresi'] = 120;
header('Location: yonetim.php');
} else {
$mesaj = "Kullanıcı adı yada şifre yanlış";
}
}
?>
<form id="form1" name="form1" method="post" action="">
<div>
Kullanıcı Adını Giriniz...:
<input type="text" name="kullanici_adi" id="textfield" />
<div>Şifrenizi Giriniz............ :
<input name="sifre" type="password" id="sifre" />
</div>
<div>
<input type="submit" name="button" id="button" value="Tamam" style="margin-left:250px;" />
</div>
<p> </p>
</div>
</form>
<?php
echo $mesaj;
?>
</body>
</html>
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if (!empty($_POST)) {
if ($_POST['kullanici_adi'] == "ali" && $_POST['sifre'] == "1") {
$_SESSION['oturum_sifresi'] = 120;
header('Location: yonetim.php');
} else {
$mesaj = "Kullanıcı adı yada şifre yanlış";
}
}
?>
<form id="form1" name="form1" method="post" action="">
<div>
Kullanıcı Adını Giriniz...:
<input type="text" name="kullanici_adi" id="textfield" />
<div>Şifrenizi Giriniz............ :
<input name="sifre" type="password" id="sifre" />
</div>
<div>
<input type="submit" name="button" id="button" value="Tamam" style="margin-left:250px;" />
</div>
<p> </p>
</div>
</form>
<?php
echo $mesaj;
?>
</body>
</html>
yonetim.php
<?php
session_start();
if (!$_SESSION['oturum_sifresi'] == 120) {
header('Location: yetkisiz_kullanici.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="517" border="1" style="background-color: #900; color: #FFF;">
<tr>
<td>İçerik Ekle</td>
<td>Fotoğraf Ekle</td>
<td>Ayarlar</td>
<td>Kullanıcı Tanımla</td>
<td><a href="oturumkapat.php">Çıkış</a></td>
</tr>
</table>
</body>
</html>
session_start();
if (!$_SESSION['oturum_sifresi'] == 120) {
header('Location: yetkisiz_kullanici.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="517" border="1" style="background-color: #900; color: #FFF;">
<tr>
<td>İçerik Ekle</td>
<td>Fotoğraf Ekle</td>
<td>Ayarlar</td>
<td>Kullanıcı Tanımla</td>
<td><a href="oturumkapat.php">Çıkış</a></td>
</tr>
</table>
</body>
</html>
yetkisiz_kullanici.php
<?php
header('refresh:3; url=OturumGirisi.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div style="color: #F00;">Bu Sayfayı Kullanmaya Yetkili Değilsiniz..</div>
</body>
</html>
header('refresh:3; url=OturumGirisi.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div style="color: #F00;">Bu Sayfayı Kullanmaya Yetkili Değilsiniz..</div>
</body>
</html>
oturumkapat.php
<?php
session_start();
session_destroy();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body style="color:#F00">
Oturum Kapatılmıştır..
</body>
</html>
session_start();
session_destroy();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body style="color:#F00">
Oturum Kapatılmıştır..
</body>
</html>
Yorumunuzu Ekleyin