<?php ?> <?php $nick = $_SESSION['username']; $haslo = $_SESSION['password']; $u = mysql_query("SELECT * FROM users WHERE nick='$nick' AND haslo='$haslo'") or die(mysql_error()); if($u['username'] && $u['password']) { $Loggged = true; } else { $Logged = False; } ?>
check.php
<?php include "cfg.php"; if($Logged) $nick = $_POST['username']; $haslo = $_POST['password']; if($nick && $haslo) { if($sel==0) { } else { $_SESSION['username'] = $nick; $_SESSION['password'] = $haslo; } } else { } ?>
edit.php
<?php include "cfg.php" ; if ($Logged) { echo '<br> Zalogowano jako: <font color="red"><?php echo $_SESSION["user"]; ?></f <a href="wyloguj.php">Wyloguj</a> '; } ?>
admin.php
<html> <head> <link rel="stylesheet" type="text/css" href="admin.css" /> <title>Panel Admina</title> <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-2"> </head> <div id="panel"> <form action="check.php" method="post"> <label for="username">Nazwa użytkownika:</label> <input type="text" id="username" name="username"> <label for="password">Hasło:</label> <input type="password" id="password" name="password"> <div id="lower"> <input type="submit" value="Login"> </div> </form> </div>
problem polega na tym,ze plik edit.php nie jest zabezpieczony sesją,sesje nie przechodzą pomiedzy stronami.