3 * This function is being used to load info that's needed for the login page.
4 * 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.
5 * We will compare the values and if they match, the user will be automatically logged in!
6 * @author Daan Janssens, mentored by Matthew Lagoe
9 global $INGAME_WEBPATH;
11 if (helpers
::check_if_game_client()) {
12 //check if you are logged in ingame, this should auto login
13 $result = Helpers
::check_login_ingame();
15 //handle successful login
16 $_SESSION['user'] = $result['name'];
17 $_SESSION['id'] = WebUsers
::getId($result['name']);
18 $_SESSION['ticket_user'] = serialize(Ticket_User
::constr_ExternId($_SESSION['id']));
19 //go back to the index page.
20 header("Cache-Control: max-age=1");
21 if (Helpers
::check_if_game_client()) {
22 header('Location: ' . $INGAME_WEBPATH);
24 header('Location: ' . $WEBPATH);
26 throw new SystemExit();
29 $pageElements['ingame_webpath'] = $INGAME_WEBPATH;
31 foreach ($_GET as $key => $value) {
32 $GETString = $GETString . $key . '=' . $value . "&";
34 if ($GETString != "") {
35 $GETString = '?' . $GETString;
37 $pageElements['getstring'] = $GETString;