Ragazzi quello è solo un esempio nel file index.php c'è solo html, non faccio nessun controllo, quindi c'è sempre il form di login, ma se lo volete togliere quando siete loggati fate come segue!

il file logout.php fallo diventare così

<?php
include 'config.php';
//distruggo le sessioni per fare il logout
session_destroy();
echo "Logout effettuato";
echo "<script>
window.location = "index.php"
</script>";
?>

mentre il file index.php deve essere così

<html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="author" content="Skyline"> <title>Login</title> </head> <body> <?php if(isset($_SESSION['username'])) echo 'risulti loggato effettua il logout <a href="logout.php">qua</a>'; else{?> <form action="login.php" method="post" enctype="application/x-www-form-urlencoded" name="login"> <input type="text" value="Username" size="20" maxlength="20" name="username" /><br /> <input type="password" value="Password" size="20" maxlength="20" name="password" /><br /> <input type="submit" value="Login" name="Submit" /> </form> <?php } ?> </body> </html>