forked from leftypol/leftypol
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
This commit is contained in:
commit
b4efebae55
3 changed files with 8 additions and 5 deletions
|
@ -49,7 +49,7 @@ function login($username, $password, $makehash=true) {
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'hash' => mkhash($username, $password),
|
'hash' => mkhash($username, $password),
|
||||||
'boards' => explode(',', $user['boards'])
|
'boards' => explode(',', $user['boards'])
|
||||||
);
|
);
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ if (isset($_COOKIE[$config['cookies']['mod']])) {
|
||||||
$user = $query->fetch();
|
$user = $query->fetch();
|
||||||
|
|
||||||
// validate password hash
|
// 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
|
// Malformed cookies
|
||||||
destroyCookies();
|
destroyCookies();
|
||||||
error($config['error']['malformed']);
|
error($config['error']['malformed']);
|
||||||
|
|
|
@ -28,7 +28,7 @@ function mod_page($title, $template, $args, $subtitle = false) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mod_login() {
|
function mod_login($redirect = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$args = array();
|
$args = array();
|
||||||
|
@ -49,7 +49,10 @@ function mod_login() {
|
||||||
// Set cookies
|
// Set cookies
|
||||||
setCookies();
|
setCookies();
|
||||||
|
|
||||||
header('Location: ?/', true, $config['redirect_http']);
|
if ($redirect)
|
||||||
|
header('Location: ?' . $redirect, true, $config['redirect_http']);
|
||||||
|
else
|
||||||
|
header('Location: ?/', true, $config['redirect_http']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
mod.php
2
mod.php
|
@ -91,7 +91,7 @@ $pages = array(
|
||||||
|
|
||||||
|
|
||||||
if (!$mod) {
|
if (!$mod) {
|
||||||
$pages = array('!!' => 'login');
|
$pages = array('!^(.+)?$!' => 'login');
|
||||||
} elseif (isset($_GET['status'], $_GET['r'])) {
|
} elseif (isset($_GET['status'], $_GET['r'])) {
|
||||||
header('Location: ' . $_GET['r'], true, (int)$_GET['status']);
|
header('Location: ' . $_GET['r'], true, (int)$_GET['status']);
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue