mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 17:29:10 +00:00
Remove invalid behaviour with ring databases
This commit is contained in:
parent
f0d994edd4
commit
3e06bf376f
3 changed files with 148 additions and 140 deletions
|
@ -198,49 +198,56 @@ 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;
|
||||||
$dbr = new DBLayer( "ring" );
|
|
||||||
if ( isset( $_GET['UserId'] ) && isset( $_COOKIE['ryzomId'] ) ) {
|
// FIXME
|
||||||
$id = $_GET['UserId'];
|
/*
|
||||||
|
if ( helpers :: check_if_game_client () or $forcelibrender = false ) {
|
||||||
$statement = $dbr -> select( "ring_users", array( 'id' => $id, 'cookie' => $_COOKIE['ryzomId'] ), "user_id=:id AND cookie =:cookie" );
|
$dbr = new DBLayer( "ring" );
|
||||||
|
if ( isset( $_GET['UserId'] ) && isset( $_COOKIE['ryzomId'] ) ) {
|
||||||
// $statement = $dbr->execute("SELECT * FROM ring_users WHERE user_id=:id AND cookie =:cookie", array('id' => $id, 'cookie' => $_COOKIE['ryzomId']));
|
$id = $_GET['UserId'];
|
||||||
|
|
||||||
if ( $statement -> rowCount() ) {
|
$statement = $dbr -> select( "ring_users", array( 'id' => $id, 'cookie' => $_COOKIE['ryzomId'] ), "user_id=:id AND cookie =:cookie" );
|
||||||
$entry = $statement -> fetch();
|
|
||||||
// print_r($entry);
|
// $statement = $dbr->execute("SELECT * FROM ring_users WHERE user_id=:id AND cookie =:cookie", array('id' => $id, 'cookie' => $_COOKIE['ryzomId']));
|
||||||
return array( 'id' => $entry['user_id'], 'name' => $entry['user_name'] );
|
|
||||||
} else {
|
if ( $statement -> rowCount() ) {
|
||||||
return "FALSE";
|
$entry = $statement -> fetch();
|
||||||
}
|
// print_r($entry);
|
||||||
} else {
|
return array( 'id' => $entry['user_id'], 'name' => $entry['user_name'] );
|
||||||
return "FALSE";
|
} else {
|
||||||
}
|
return "FALSE";
|
||||||
} else {
|
}
|
||||||
return "FALSE";
|
} else {
|
||||||
}
|
return "FALSE";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return "FALSE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue