summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2014-09-21 12:42:46 +0100
committerLuke Bratch <l_bratch@yahoo.co.uk>2014-09-21 12:42:46 +0100
commit7e93f950eb21b5ba7ed073d81b5fa6e4f2cfe892 (patch)
treedb4803958289afb352a0f4ae0107cbb91bba812d
parent7ffc77710590d6b9dec685aa94160b10e7dcb0d8 (diff)
Add a sign out function
-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) {