ok raga da solo dopo ore ore di girare su internet e leggere un paio di guide sono riuscito a risolvere in pratica i punti 2-3-4 .. ho aggiunto il codice di protetta.php dentro ogni pagina html presente sul mio sito ho fatto qualche modifica al codice di login.php per il rendirizzamento a tempo ecc il codice ora si presenta cosi:
codice:
<?php
session_start();
$password="giulio8"; /* 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";
$newpage = 'http://miosito.it/sito/index.htm';
header('Refresh: 3; url=' . $newpage);
$messaggio = "Accesso effettuato.Tra 3 secondi verrai reindirizzato alla home del sito.";
} else {
$messaggio = "Errore: password non corretta!";
}
}
}
?>
<html>
<head>
<style type="text/css">
table
{
*border-collapse: collapse; /* IE7 and lower */
border-spacing: 0;
width: 20%;
background:#dddddd !important; /* For IE*/
}
.bordered {
border: solid #ff0000 1px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
behavior: url(border-radius.htc);
-webkit-box-shadow: 0 1px 1px #ccc;
-moz-box-shadow: 0 1px 1px #ccc;
box-shadow: 0 1px 1px #ccc;
}
.bordered tr:hover {
background: #dddddd;
-o-transition: all 0.1s ease-in-out;
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-ms-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.bordered td, .bordered th {
border-left: 1px solid #ccc;
border-top: 1px solid #ccc;
padding: 10px;
text-align: left;
}
.bordered th {
background-color: #dce9f9;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
background-image: -moz-linear-gradient(top, #ebf3fc, #dce9f9);
background-image: -ms-linear-gradient(top, #ebf3fc, #dce9f9);
background-image: -o-linear-gradient(top, #ebf3fc, #dce9f9);
background-image: linear-gradient(top, #ebf3fc, #dce9f9);
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
-moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
border-top: none;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.bordered td:first-child, .bordered th:first-child {
border-left: none;
}
.bordered th:first-child {
-moz-border-radius: 6px 0 0 0;
-webkit-border-radius: 6px 0 0 0;
border-radius: 6px 0 0 0;
behavior: url(border-radius.htc);
}
.bordered th:last-child {
-moz-border-radius: 0 6px 0 0;
-webkit-border-radius: 0 6px 0 0;
border-radius: 0 6px 0 0;
behavior: url(border-radius.htc);
}
.bordered th:only-child{
-moz-border-radius: 6px 6px 0 0;
-webkit-border-radius: 6px 6px 0 0;
border-radius: 6px 6px 0 0;
behavior: url(border-radius.htc);
}
.bordered tr:last-child td:first-child {
-moz-border-radius: 0 0 0 6px;
-webkit-border-radius: 0 0 0 6px;
border-radius: 0 0 0 6px;
}
.bordered tr:last-child td:last-child {
-moz-border-radius: 0 0 6px 0;
-webkit-border-radius: 0 0 6px 0;
border-radius: 0 0 6px 0;
behavior: url(border-radius.htc);
}
</style>
</head>
<body>
<table class="bordered" style="margin:200px auto;">
<tr>
<td>
<center>
<img src="http://i.imgur.com/hxvbojK.png" width="300" height="50">
<br><br>
<form name="login" action="login.php" method="post">Password :
<input type="password" name="password" value=""/> <input type="submit" value="Entra"/> <!---- form login ----->
<br><br>
<?php
if(isset($messaggio)) {
echo $messaggio;
unset($messaggio);
}
?>
</form>
</center>
</td>
</tr>
</table>
</p>
</body>
</html>
mi manca soltanto il punto 1, ovvero voglio che durante il login oltre la password mi si chiede l'usurname ... non riesco a fare quell annidamento sull IF ... qualcuno puo darmi na mano ?
grazie