summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2014-09-21 13:05:26 +0100
committerLuke Bratch <l_bratch@yahoo.co.uk>2014-09-21 13:05:26 +0100
commit49ed286d02358864508109b11bec536570561da2 (patch)
tree064b1fa52367c356ce4d39c02ffba32ac0ddd3a3 /index.php
parent7e93f950eb21b5ba7ed073d81b5fa6e4f2cfe892 (diff)
Pass GET requests through the logon process if initially signed out
Diffstat (limited to 'index.php')
-rw-r--r--index.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/index.php b/index.php
index acd7de7..8a56c8d 100644
--- a/index.php
+++ b/index.php
@@ -3,6 +3,12 @@ include('config.php');
$signout = '<a href="' . basename($_SERVER['PHP_SELF']) . '?signout">Sign out</a>';
+if (isset($_GET) && count($_GET) > 0) {
+ $getstring = "?" . http_build_query($_GET);
+} else {
+ $getstring = "";
+}
+
if (isset($_GET['signout'])) {
if (isset($_COOKIE['password'])) {
unset($_COOKIE['password']);
@@ -20,7 +26,7 @@ if ($_POST && $pass) {
/* Cookie expires when browser closes */
setcookie('password', hash("sha256", $_POST['password']), false, '/', $_SERVER['SERVER_NAME'] );
}
- header('Location: ' . $url);
+ header('Location: ' . $url . $getstring);
} else {
header('Location: ' . $url);
exit();
@@ -40,7 +46,7 @@ if ($_POST && $pass) {
</head>
<body>
-<form name="form" method="post" action="./">
+<form name="form" method="post" action="./<?php echo $getstring ?>">
<p><input type="password" title="Enter your password" name="password" id="password">
<br><input type="checkbox" name="rememberme" value="rememberme">Remember me</p>
<p><input type="submit" name="Submit" value="Login"></p>