Scusa ma sto impazzendo -.-'
Ho provato a rifarlo da capo ed ecco cosa ho fatto:
index.php
Codice PHP:
<?php
session_start();
if(isset($_SESSION['autorizzato']) && $_SESSION['autorizzato'] == TRUE){
?>
<html>
<head>
<title>Amministrazione</title>
</head>
<body>
Amministrazione
</body>
</html>
<?php
}else{
include 'login.php';
}
?>
login.php:
Codice PHP:
<html>
<head>
<title>Login</title>
</head>
<body>
<div>
<form action="access.php" method="post">
<label>Username:
<input type="text" name="username" >
</label>
<label>Password:
<input type="password" name="password" >
</label>
<input type="submit" value="Log In">
</form>
</div>
</body>
</html>
access.php:
Codice PHP:
<?
session_start();
require_once 'config.inc.php';
if(isset($_POST['username'])){
if($_POST['username'] == ADMIN_USER and $_POST['password'] == ADMIN_PASS){
$_SESSION['autorizzato'] == TRUE;
}
header('Location: index.php');
}
?>
config.php
Codice PHP:
<?php
define('ADMIN_USER', 'admin');
define('ADMIN_PASS','admin');
?>
non riesco a capire mi sembra corretto ma continuo a non vedere la index.php dopo aver effettuato il login -.-'
E' come se in access.php non mi facesse $_SESSION['autorizzato'] == TRUE;