You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
PHTML
40 lines
1.3 KiB
PHTML
11 years ago
|
<?php
|
||
11 years ago
|
/**
|
||
9 years ago
|
* This function is being used to load info that's needed for the login page.
|
||
11 years ago
|
* it will try to auto-login, this can only be used while ingame, the web browser sends additional cookie information that's also stored in the open_ring db.
|
||
|
* We will compare the values and if they match, the user will be automatically logged in!
|
||
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||
|
*/
|
||
10 years ago
|
function login() {
|
||
11 years ago
|
global $INGAME_WEBPATH;
|
||
|
global $WEBPATH;
|
||
10 years ago
|
if (helpers::check_if_game_client()) {
|
||
11 years ago
|
//check if you are logged in ingame, this should auto login
|
||
11 years ago
|
$result = Helpers::check_login_ingame();
|
||
10 years ago
|
if ($result) {
|
||
11 years ago
|
//handle successful login
|
||
|
$_SESSION['user'] = $result['name'];
|
||
11 years ago
|
$_SESSION['id'] = WebUsers::getId($result['name']);
|
||
11 years ago
|
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
|
||
11 years ago
|
//go back to the index page.
|
||
10 years ago
|
header("Cache-Control: max-age=1");
|
||
11 years ago
|
if (Helpers::check_if_game_client()) {
|
||
10 years ago
|
header('Location: ' . $INGAME_WEBPATH);
|
||
|
} else {
|
||
|
header('Location: ' . $WEBPATH);
|
||
11 years ago
|
}
|
||
10 years ago
|
throw new SystemExit();
|
||
11 years ago
|
}
|
||
|
}
|
||
11 years ago
|
$pageElements['ingame_webpath'] = $INGAME_WEBPATH;
|
||
11 years ago
|
$GETString = "";
|
||
10 years ago
|
foreach ($_GET as $key => $value) {
|
||
11 years ago
|
$GETString = $GETString . $key . '=' . $value . "&";
|
||
10 years ago
|
}
|
||
|
if ($GETString != "") {
|
||
|
$GETString = '?' . $GETString;
|
||
11 years ago
|
}
|
||
|
$pageElements['getstring'] = $GETString;
|
||
11 years ago
|
return $pageElements;
|
||
11 years ago
|
}
|