PDA

View Full Version : Logout Button



loserWILL
02-02-2008, 01:55 PM
I have a file called liindex.php - and at the bottom of all the content is my 'logout' button. At the moment, it isn't showing.


<?php
include "config.php";
if ($_GET ["action"] == "submit") {
$notes1 = $_POST["notes"];
mysql_query ("UPDATE notes SET notes='$notes1'");
echo "The notes have been succesfully edited.<br />";
}
?>
<form action="?action=submit" method="post"><textarea name="notes"
cols="40" rows="6">
<?php
$sql = mysql_query ( "SELECT * FROM notes" );
while ( $fetch = mysql_fetch_array ( $sql ) ) {
?> <?php
echo $fetch["notes"];
?>

<?php }
?>
</textarea> <br />
<input type="submit" value="Edit Notes" /></form>

<?php
include "config.php";

if ($action == "liindex.php") {
if ($_SESSION ["session_username"] == "") {
echo "You're not logged in.";
exit ();
}
echo "<a href=\"login.php?action=logout\">Logout</a>";
}

if ($action == "logout") {
if ($_SESSION ["session_username"]) {
session_unset ();
session_destroy ();
echo "<meta http-equiv=\"refresh\" content=\"2;url=index.php\">";
exit ();
} else {
echo "<meta http-equiv=\"refresh\" content=\"2;url=index.php\">";
}
}
?>

Thread moved from website design by --ss-- (Forum Super Moderator): Please post in the correct section ;).

Want to hide these adverts? Register an account for free!