diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2014-09-21 12:42:46 +0100 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2014-09-21 12:42:46 +0100 |
commit | 7e93f950eb21b5ba7ed073d81b5fa6e4f2cfe892 (patch) | |
tree | db4803958289afb352a0f4ae0107cbb91bba812d | |
parent | 7ffc77710590d6b9dec685aa94160b10e7dcb0d8 (diff) |
Add a sign out function
-rw-r--r-- | index.php | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) { |