Benim istediğim o değil usta sana
degisken mantigiyla daha basit bir yonetim paneli düşünüyorm ben session fln değil..
bu iş yalnızca session yardimiyla oluyorsa o başka
<?php
/* Config Section */
$pass = '123456';
$cookiename = 'sascookie';
$expirytime = time()+3600;
$msg = 'Hatalı Şifre.';
/* End Config */
/* Logout Stuff - Sept 5, 2005 */
if (isset($_REQUEST['logout'])) {
setcookie($cookiename,'',time() - 3600); // remove cookie/password
if (substr($_SERVER['REQUEST_URI'],-12)=='?logout=true') { // if there is '?logout=true' in the URL
$url=str_replace('?logout=true','',$_SERVER['REQUEST_URI']); // remove the string '?logout=true' from the URL
header('Location: '.$url); // redirect the browser to original URL
}
show_login_page('');
exit();
}
$logout_button='<form action="'.$_SERVER['REQUEST_URI'].'" method="post"><input type="submit" name="logout" value="Logout" /></form>';
$logout_text='<a href="'.$_SERVER['REQUEST_URI'].'?logout=true">Logout</a>';
$encrypt_pass=md5($pass);
function setmycookie() {
global $cookiename,$encrypt_pass,$expirytime;
setcookie($cookiename,$encrypt_pass,$expirytime);
}
function show_login_page($msg) {
?>
<!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>
<title>Yönetim</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9" />
</head>
<body>
<p> </p>
<p> </p>
<p> </p>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form action="" method="POST">
Şifre:
<input type="password" name="password" size="20">
<input type="submit" value="Giriş">
<input type="hidden" name="sub" value="sub">
</form><div class=error><?=$msg?></div></td>
</tr>
</table>
<div >
<div >
<div >
</div>
</div>
</div>
</body>
</html>
<? }
/* END FUNCTIONS */
$errormsg='';
if (isset($_POST['sub'])) { // if form has been submitted
$submitted_pass=md5($_POST['password']); // encrypt submitted password
if ($submitted_pass<>$encrypt_pass) { // if password is incorrect
$errormsg=$msg;
show_login_page($errormsg);
exit();
} else { // if password is correct
setmycookie();
}
} else {
if (isset($_COOKIE[$cookiename])) { // if cookie isset
if ($_COOKIE[$cookiename]==$encrypt_pass) { // if cookie is correct
// do nothing
} else { // if cookie is incorrect
show_login_page($errormsg);
exit();
}
} else { // if cookie is not set
show_login_page($errormsg);
exit();
}
}
?>Bu kod işini görür ozaman