PHP expert |
|
heb nu dit voor een logout script, maar kan zo vaak als ik wil op logout rammen, er verschijnt altijd de tekst:
You are succesfully logged out
maar ik wil dat als je bent uitgelogd de button verdwijnt en de text:
you can not log out, if your not logged in komt, wat doe ik fout
<?php
include("config.php");
if(!isset($_COOKIE['hash']) AND ($_COOKIE['username']) AND ($_COOKIE['password'])) {
echo "You can not log out, when you are not logged in";
}
else
{
?>
<form method="post">
<input type="submit" name="logout" value="Logout">
</form>
<br />
<?php
if(isset($_POST['logout'])) {
echo "Succesfully logged out";
setcookie("username", "", time(), "/");
setcookie("hash", "", time(), "/");
setcookie('password', "", time(), "/");
}
}
?>
<?php include("config.php"); if(!isset($_COOKIE['hash']) AND ($_COOKIE['username']) AND ($_COOKIE['password'])) { echo "You can not log out, when you are not logged in"; } else { ?> <form method="post"> <input type="submit" name="logout" value="Logout"> </form> <br /> <?php if(isset($_POST['logout'])) { echo "Succesfully logged out"; } } ?>
**
de coockies worden wel gereset
en op de andere pagina's doet dit het wel gewoon
**
if(isset($_COOKIE['hash']) AND ($_COOKIE['username']) AND ($_COOKIE['password'])) {
echo "You are already logged in";
}
else
{
?>
if(isset($_COOKIE['hash']) AND ($_COOKIE['username']) AND ($_COOKIE['password'])) { echo "You are already logged in"; } else { ?>
|