summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/index.php b/index.php
index b8eadfc..acd7de7 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,16 @@
<?php
include('config.php');
+$signout = '<a href="' . basename($_SERVER['PHP_SELF']) . '?signout">Sign out</a>';
+
+if (isset($_GET['signout'])) {
+ if (isset($_COOKIE['password'])) {
+ unset($_COOKIE['password']);
+ setcookie('password', null, -1, '/', $_SERVER['SERVER_NAME']);
+ header('Location: ' . $url);
+ }
+}
+
if ($_POST && $pass) {
if ((hash("sha256", $_POST['password']) == $pass)) {
if (isset($_POST['rememberme'])) {
@@ -40,6 +50,8 @@ if ($_POST && $pass) {
<?php
exit();
}
+} else {
+ $signout = "";
}
function size_readable($size, $max = null, $system = 'si', $retstring = '%01.2f %s') {
@@ -284,7 +296,7 @@ if ($headerfile) {
echo file_get_contents($headerfile);
}
?>
-<pre><img src="/icons/blank.gif" alt="Icon "> <a href="<?php echo $nameurl; ?>">Name</a> <a href="<?php echo $modifiedurl; ?>">Last modified</a> <a href="<?php echo $sizeurl; ?>">Size</a>
+<pre><img src="/icons/blank.gif" alt="Icon "> <a href="<?php echo $nameurl; ?>">Name</a> <a href="<?php echo $modifiedurl; ?>">Last modified</a> <a href="<?php echo $sizeurl; ?>">Size</a> <?php echo $signout; ?>
<hr><?php
for ($i = 0; $i < count($listing); $i++) {
if (strlen($listing[$i]['filename']) > 23) {