Remove invalid behaviour with ring databases

This commit is contained in:
kaetemi 2014-09-02 19:56:37 +02:00
parent 6a8e2f314e
commit 57781ca616
3 changed files with 148 additions and 140 deletions

View file

@ -198,29 +198,33 @@ return parse_ini_file( $AMS_TRANS . '/' . $_SESSION['Language'] . '.ini', true )
} }
/** /**
* Time output function for handling the time display. * Time output function for handling the time display.
* *
* @return returns the time in the format specified in the $TIME_FORMAT global variable. * @return returns the time in the format specified in the $TIME_FORMAT global variable.
*/ */
static public function outputTime( $time, $str = 1 ) { static public function outputTime($time, $str = 1) {
global $TIME_FORMAT; global $TIME_FORMAT;
if ( $str ) { if ($str) {
return date( $TIME_FORMAT, strtotime( $time ) ); return date($TIME_FORMAT, strtotime($time));
} else { } else {
return date( $TIME_FORMAT, $time ); return date($TIME_FORMAT, $time);
}
} }
}
/** /**
* Auto login function for ingame use. * Auto login function for ingame use.
* This function will allow users who access the website ingame, to log in without entering the username and password. It uses the COOKIE entry in the open_ring db. * This function will allow users who access the website ingame, to log in without entering the username and password. It uses the COOKIE entry in the open_ring db.
* it checks if the cookie sent by the http request matches the one in the db. This cookie in the db is changed everytime the user relogs. * it checks if the cookie sent by the http request matches the one in the db. This cookie in the db is changed everytime the user relogs.
* *
* @return returns "FALSE" if the cookies didn't match, else it returns an array with the user's id and name. * @return returns "FALSE" if the cookies didn't match, else it returns an array with the user's id and name.
*/ */
static public function check_login_ingame() { static public function check_login_ingame() {
if ( helpers :: check_if_game_client () or $forcelibrender = false ) { return NULL;
// FIXME
/*
if ( helpers :: check_if_game_client () or $forcelibrender = false ) {
$dbr = new DBLayer( "ring" ); $dbr = new DBLayer( "ring" );
if ( isset( $_GET['UserId'] ) && isset( $_COOKIE['ryzomId'] ) ) { if ( isset( $_GET['UserId'] ) && isset( $_COOKIE['ryzomId'] ) ) {
$id = $_GET['UserId']; $id = $_GET['UserId'];
@ -242,5 +246,8 @@ if ( helpers :: check_if_game_client () or $forcelibrender = false ) {
} else { } else {
return "FALSE"; return "FALSE";
} }
} }
*/
}
} }

View file

@ -291,11 +291,13 @@ class Users{
//make connection with and put into shard db //make connection with and put into shard db
$dbs = new DBLayer("shard"); $dbs = new DBLayer("shard");
$dbs->insert("user", $values); $dbs->insert("user", $values);
/*
$dbr = new DBLayer("ring"); $dbr = new DBLayer("ring");
$valuesRing['user_id'] =$user_id; $valuesRing['user_id'] =$user_id;
$valuesRing['user_name'] = $values['Login']; $valuesRing['user_name'] = $values['Login'];
$valuesRing['user_type'] = 'ut_pioneer'; $valuesRing['user_type'] = 'ut_pioneer';
$dbr->insert("ring_users", $valuesRing); $dbr->insert("ring_users", $valuesRing);
*/
ticket_user::createTicketUser( $user_id, 1); ticket_user::createTicketUser( $user_id, 1);
return "ok"; return "ok";
} }

View file

@ -5,35 +5,34 @@
* We will compare the values and if they match, the user will be automatically logged in! * We will compare the values and if they match, the user will be automatically logged in!
* @author Daan Janssens, mentored by Matthew Lagoe * @author Daan Janssens, mentored by Matthew Lagoe
*/ */
function login(){ function login() {
global $INGAME_WEBPATH; global $INGAME_WEBPATH;
global $WEBPATH; global $WEBPATH;
if ( helpers :: check_if_game_client () ){ if (helpers::check_if_game_client()) {
//check if you are logged in ingame, this should auto login //check if you are logged in ingame, this should auto login
$result = Helpers::check_login_ingame(); $result = Helpers::check_login_ingame();
if( $result != "FALSE"){ if ($result) {
//handle successful login //handle successful login
$_SESSION['user'] = $result['name']; $_SESSION['user'] = $result['name'];
$_SESSION['id'] = WebUsers::getId($result['name']); $_SESSION['id'] = WebUsers::getId($result['name']);
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id'])); $_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
//go back to the index page. //go back to the index page.
if (Helpers::check_if_game_client()) { if (Helpers::check_if_game_client()) {
header( 'Location: '.$INGAME_WEBPATH ); header('Location: ' . $INGAME_WEBPATH);
}else{ } else {
header( 'Location: '.$WEBPATH ); header('Location: ' . $WEBPATH);
} }
exit; exit;
} }
} }
$pageElements['ingame_webpath'] = $INGAME_WEBPATH; $pageElements['ingame_webpath'] = $INGAME_WEBPATH;
$GETString = ""; $GETString = "";
foreach($_GET as $key => $value){ foreach ($_GET as $key => $value) {
$GETString = $GETString . $key . '=' . $value . "&"; $GETString = $GETString . $key . '=' . $value . "&";
} }
if($GETString != ""){ if ($GETString != "") {
$GETString = '?'.$GETString; $GETString = '?' . $GETString;
} }
$pageElements['getstring'] = $GETString; $pageElements['getstring'] = $GETString;
return $pageElements; return $pageElements;
} }