summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Łabanowski <marcin@6irc.net>2013-01-29 14:31:35 +0100
committerMarcin Łabanowski <marcin@6irc.net>2013-01-29 14:31:35 +0100
commitb4efebae5551c8d8046a6755412104247a37c1bd (patch)
tree91b86874c6a6adb7437eae42ac1f850ce495f62d
parentcac9b868244345d6ab7e097aadfb083da98233b5 (diff)
parent45f9b51ad85e087bafaa83ddb3d6a3547cafe315 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
-rw-r--r--inc/mod/auth.php4
-rw-r--r--inc/mod/pages.php7
-rw-r--r--mod.php2
3 files changed, 8 insertions, 5 deletions
diff --git a/inc/mod/auth.php b/inc/mod/auth.php
index f594af4b..8fb01ecb 100644
--- a/inc/mod/auth.php
+++ b/inc/mod/auth.php
@@ -49,7 +49,7 @@ function login($username, $password, $makehash=true) {
'username' => $username,
'hash' => mkhash($username, $password),
'boards' => explode(',', $user['boards'])
- );
+ );
} else return false;
}
@@ -108,7 +108,7 @@ if (isset($_COOKIE[$config['cookies']['mod']])) {
$user = $query->fetch();
// validate password hash
- if ($cookie[1] != mkhash($cookie[0], $user['password'], $cookie[2])) {
+ if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) {
// Malformed cookies
destroyCookies();
error($config['error']['malformed']);
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index 34945b08..8d215efb 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -28,7 +28,7 @@ function mod_page($title, $template, $args, $subtitle = false) {
);
}
-function mod_login() {
+function mod_login($redirect = false) {
global $config;
$args = array();
@@ -49,7 +49,10 @@ function mod_login() {
// Set cookies
setCookies();
- header('Location: ?/', true, $config['redirect_http']);
+ if ($redirect)
+ header('Location: ?' . $redirect, true, $config['redirect_http']);
+ else
+ header('Location: ?/', true, $config['redirect_http']);
}
}
diff --git a/mod.php b/mod.php
index bb839715..c0614754 100644
--- a/mod.php
+++ b/mod.php
@@ -91,7 +91,7 @@ $pages = array(
if (!$mod) {
- $pages = array('!!' => 'login');
+ $pages = array('!^(.+)?$!' => 'login');
} elseif (isset($_GET['status'], $_GET['r'])) {
header('Location: ' . $_GET['r'], true, (int)$_GET['status']);
exit;