<?php
if (!isset($_GET['quit'])) { ?>
<h4>To complete your log out, please click "OK" then "Cancel" in
this <a href="logout.php?quit=y">log in box</a>. Do not fill in a
password. This should clear your ID and password from the cache of your
browser.
<blockquote>Note: Logging in from this particular box is
disabled!</blockquote>
<p>Go <a href="/">back to the site</a>.</h4>
<?php
} else {
header('WWW-Authenticate: Basic realm="admin section"');
header('HTTP/1.0 401 Unauthorized');
// if a session was running, clear and destroy it
session_start();
session_unset();
session_destroy();
echo "<h3>Logged out!</h3><h4>Go <a href=\"/\">back to the site</a>.</h4>";
}
?>
Ik kan het zelf niet controleren... maar hij haalt die GET uit de link waarop je moet klikken, en als je dat niet hebt gedaan... laat ie de tekst zien.
<h4>To complete your log out, please click "OK" then "Cancel" in
this <a href="logout.php?quit=y">log in box</a>. Do not fill in a
password. This should clear your ID and password from the cache of your
browser.
<blockquote>Note: Logging in from this particular box is
disabled!</blockquote>
<p>Go <a href="/">back to the site</a>.</h4>
Hij kijkt na of je de link <a href="logout.php?quit=y">log in box</a> hebt geklikt daar, zo nee laat ie de tekst eronder zien... Heb je die wel aan geklikt dan logged ie uit. Je moet wel je pagina logout.php laten heten.
hmm, inderdaad, de link en alles werkt wel met GET. maar als ik dan op ok klik en vervolgens op annuleren, dan kom ik bij de;
You are not authorized to view this page
The URL you attempted to reach has an ISAPI or CGI application installed that verifies user credentials before proceeding. This application cannot verify your credentials.
Ik vermoed dat je een bepaalde header moet sturen, aangezien bij iedere aanvraag de browser een header verstuurt ipv sessions.
Misschien dat header('HTTP/1.0 401 Unauthorized'); werkt als remblok. dus idd <?php if(isset($_GET['logout'])){
header('HTTP/1.0 401 Unauthorized');
}
?>
en dan gewoon aanvragen met pagina.php?logout=true
Kan ook een andere header zijn, maar dan moet je even in de documentatie van HTTP1.1 protocol zoeken.