43 lines
904 B
PHP
43 lines
904 B
PHP
<?php
|
|
session_start();
|
|
$password="xxxxxx"; /* inserire su questa riga la password voluta */
|
|
if (isset($_SESSION['login'])) {
|
|
if (isset($_POST['logout'])) {
|
|
unset($_SESSION['login']);
|
|
$messaggio = "Logout effettuato con successo! Arrivederci!";
|
|
} else {
|
|
header("Location: protetta.php");
|
|
}
|
|
} else {
|
|
if (isset($_POST['password'])) {
|
|
if ($_POST['password'] == $password) {
|
|
$_SESSION['login'] = "verificata";
|
|
header("Location: protetta.php");
|
|
} else {
|
|
$messaggio = "Errore: password non corretta!";
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
</head>
|
|
<body>
|
|
|
|
|
|
<form name="login" action="login.php" method="post">
|
|
<input type="password" name="password" value=""/> <input type="submit" value="Entra"/>
|
|
</form>
|
|
|
|
|
|
<?php
|
|
if(isset($messaggio)) {
|
|
echo $messaggio;
|
|
unset($messaggio);
|
|
}
|
|
?>
|
|
|
|
|
|
</body>
|
|
</html>
|