cfg.php
<?php
define('DB_HOST','***'); // Host bazy danych define('DB_USER','***'); // Nazwa użytkownika bazy danych define('DB_PASS','***'); // Hasło użytkownika bazy danych define('DB_DB','***'); // Nazwa bazy danych
mysql_query('SET collation_connection = utf8_polish_ci');
?>
<?php
$nick = $_SESSION['username'];
$haslo = $_SESSION['password'];
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) {
echo 'Takie konto nie istnieje, lub podano złe hasło.'; }
else {
$_SESSION['username'] = $nick;
$_SESSION['password'] = $haslo;
echo 'Zalogowano pomyślnie <a href="edit.php">Powróć do strony głównej</a>'; }
}
else {
echo 'Musisz wypełnić wszystkie pola'; }
?>
edit.php
<?php
include "cfg.php" ;
if ($Logged) {
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.
Ten post edytował Gitrix 18.10.2014, 13:14:32