khanat-opennel-code/code/ryzom/tools/server/ryzom_ams/www/html/inc/login.php

32 lines
1.1 KiB
PHP
Raw Normal View History

<?php
/**
* This function is beign used to load info that's needed for the login page.
* 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
*/
function login(){
global $INGAME_WEBPATH;
global $WEBPATH;
if ( helpers :: check_if_game_client () ){
//check if you are logged in ingame, this should auto login
$result = Helpers::check_login_ingame();
if( $result != "FALSE"){
//handle successful login
$_SESSION['user'] = $result['name'];
2013-07-31 22:08:35 +00:00
$_SESSION['id'] = WebUsers::getId($result['name']);
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
//go back to the index page.
if (Helpers::check_if_game_client()) {
header( 'Location: '.$INGAME_WEBPATH );
}else{
header( 'Location: '.$WEBPATH );
}
exit;
}
}
$pageElements['ingame_webpath'] = $INGAME_WEBPATH;
return $pageElements;
2013-07-31 22:08:35 +00:00
}