diff options
author | Luke Bratch <luke@bratch.co.uk> | 2015-11-22 21:56:53 +0000 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2015-11-22 21:56:53 +0000 |
commit | 2dafdedfe29aee7ed19d141bbe0953e94b4a499b (patch) | |
tree | 5727aa8961128ca5a478250a86c9e1dd07108490 /index.php | |
parent | d0de376dd93c4f8d308f023e6a388628b755b9d8 (diff) |
Various code cleanups
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -1,5 +1,5 @@ <?php -include('config.php'); +include("config.php"); $signout = '<a href="' . basename($_SERVER['PHP_SELF']) . '?signout">Sign out</a>'; @@ -19,8 +19,8 @@ if (isset($_GET) && count($_GET) > 0) { if (isset($_GET['signout'])) { if (isset($_COOKIE['password'])) { unset($_COOKIE['password']); - setcookie('password', null, -1, '/', $_SERVER['SERVER_NAME']); - header('Location: ' . $url); + setcookie("password", null, -1, "/", $_SERVER['SERVER_NAME']); + header("Location: " . $url); } } @@ -28,14 +28,14 @@ if ($_POST && $pass) { if ((hash("sha256", $_POST['password']) == $pass)) { if (isset($_POST['rememberme'])) { /* Set cookie to last 1 year */ - setcookie('password', hash("sha256", $_POST['password']), time()+60*60*24*365, '/', $_SERVER['SERVER_NAME'] ); + setcookie("password", hash("sha256", $_POST['password']), time()+60*60*24*365, "/", $_SERVER['SERVER_NAME'] ); } else { /* Cookie expires when browser closes */ - setcookie('password', hash("sha256", $_POST['password']), false, '/', $_SERVER['SERVER_NAME'] ); + setcookie("password", hash("sha256", $_POST['password']), false, "/", $_SERVER['SERVER_NAME'] ); } - header('Location: ' . $url . $getstring); + header("Location: " . $url . $getstring); } else { - header('Location: ' . $url); + header("Location: " . $url); exit(); } } else if ($pass) { @@ -46,7 +46,7 @@ if ($_POST && $pass) { <title><?php echo $logontitle ?></title> <script type="text/javascript"> function formfocus() { - document.getElementById('password').focus(); + document.getElementById("password").focus(); } window.onload = formfocus; </script> @@ -67,7 +67,7 @@ if ($_POST && $pass) { $signout = ""; } -function size_readable($size, $max = null, $system = 'si', $retstring = '%01.2f %s') { +function size_readable($size, $max = null, $system = "si", $retstring = "%01.2f %s") { // Pick units $systems['si']['prefix'] = array('B', 'K', 'MB', 'GB', 'TB', 'PB'); $systems['si']['size'] = 1000; @@ -200,7 +200,7 @@ while ($this_array = each($ordered_array)) { } } - $fileparts = explode('.', strtolower($value)); + $fileparts = explode(".", strtolower($value)); $icon = "unknown"; switch ($fileparts[count($fileparts)-1]) { @@ -297,7 +297,7 @@ while ($this_array = each($ordered_array)) { $icon="unknown"; break; } - + $listing[$listsize]['filename'] = utf8_encode($value); $listing[$listsize]['type'] = $icon; $listing[$listsize]['modified'] = $key; @@ -337,7 +337,7 @@ for ($i = 0; $i < count($listing); $i++) { $spaces = $spaces . " "; } - echo '<img src="/icons/' . $listing[$i]['type'] . '.gif" alt="[IMG]"> <a href="' . rawurlencode($listing[$i]['filename']) . '">' . $preview . '</a>' . $spaces . date("d-M-Y H:i", $listing[$i]['modified']) . ' ' . size_readable($listing[$i]['size'], null, "bi") . ' ' . "\n"; + echo '<img src="/icons/' . $listing[$i]['type'] . '.gif" alt="[IMG]"> <a href="' . rawurlencode($listing[$i]['filename']) . '">' . $preview . "</a>" . $spaces . date("d-M-Y H:i", $listing[$i]['modified']) . " " . size_readable($listing[$i]['size'], null, "bi") . " " . "\n"; } ?> <hr></pre> |