|
@ -9,7 +9,7 @@ |
|
|
require 'inc/user.php'; |
|
|
require 'inc/user.php'; |
|
|
|
|
|
|
|
|
// If not logged in |
|
|
// If not logged in |
|
|
if(!$user) { |
|
|
if(!$mod) { |
|
|
if(isset($_POST['login'])) { |
|
|
if(isset($_POST['login'])) { |
|
|
// Check if inputs are set and not empty |
|
|
// Check if inputs are set and not empty |
|
|
if( !isset($_POST['username']) || |
|
|
if( !isset($_POST['username']) || |
|
@ -28,6 +28,9 @@ |
|
|
// Set cookies |
|
|
// Set cookies |
|
|
setCookies(); |
|
|
setCookies(); |
|
|
|
|
|
|
|
|
|
|
|
// Redirect |
|
|
|
|
|
header('Location: ?' . MOD_DEFAULT, true, 302); |
|
|
|
|
|
|
|
|
// Close connection |
|
|
// Close connection |
|
|
sql_close(); |
|
|
sql_close(); |
|
|
} else { |
|
|
} else { |
|
@ -36,21 +39,25 @@ |
|
|
} else { |
|
|
} else { |
|
|
$query = $_SERVER['QUERY_STRING']; |
|
|
$query = $_SERVER['QUERY_STRING']; |
|
|
$regex = Array( |
|
|
$regex = Array( |
|
|
'board' => str_replace('%s', '\w{1,8}', preg_quote(BOARD_PATH, '/')) |
|
|
'board' => str_replace('%s', '(\w{1,8})', preg_quote(BOARD_PATH, '/')) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// Dashboard |
|
|
|
|
|
if(preg_match('/^\/?$/', $query)) { |
|
|
if(preg_match('/^\/?$/', $query)) { |
|
|
|
|
|
// Dashboard |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} elseif(preg_match('/^\/' . $regex['board'] . '(' . preg_quote(FILE_INDEX, '/') . ')?$/', $query, $matches)) { |
|
|
|
|
|
// Board index |
|
|
|
|
|
|
|
|
// Board index |
|
|
$boardName = $matches[1]; |
|
|
} elseif(preg_match('/^\/' . $regex['board'] . '(' . preg_quote(FILE_INDEX, '/') . ')?$/', $query)) { |
|
|
// Open board |
|
|
|
|
|
openBoard($boardName); |
|
|
|
|
|
|
|
|
|
|
|
echo Element('index.html', index(1)); |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
error("Page not found."); |
|
|
error("Page not found."); |
|
|
} |
|
|
} |
|
|
// The rest is not done yet... |
|
|
|
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|