diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php index ff2412b16..62461e33f 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php @@ -1,5 +1,4 @@ db); $statement = $dbl->execute("SELECT * FROM ticket_category WHERE TCategoryId=:id", array('id' => $id)); $row = $statement->fetch(); - $instance->tCategoryId = $row['TCategoryId']; - $instance->name = $row['Name']; - return $instance; + $this->tCategoryId = $row['TCategoryId']; + $this->name = $row['Name']; } //update private data to DB. diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php index 544f047b9..7e1e95c5c 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php @@ -1,6 +1,4 @@ db); + $dbl = new DBLayer($instance->db); $statement = $dbl->execute("SELECT * FROM ticket_user WHERE ExternId=:id", array('id' => $id)); $row = $statement->fetch(); $instance->tUserId = $row['TUserId']; diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index 1006594c3..3a6fb4b7a 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -20,6 +20,9 @@ name = "Name" email = "Email" action = "Action" + +[createticket] + [error] title404 = "Not
Found!" title403 = "Forbidden!" diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index ebf862450..fc42425b8 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -20,6 +20,9 @@ name = "Nom" email = "Email" action = "Action" +[createticket] + + [error] title404 = "Pas
trouvez!" title403 = "Interdit!" diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/autoload/webusers.php b/code/ryzom/tools/server/ryzom_ams/www/html/autoload/webusers.php index c94d6386e..6c22c57f8 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/autoload/webusers.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/autoload/webusers.php @@ -50,7 +50,15 @@ class WebUsers extends Users{ } } - + public function getId($username){ + global $cfg; + + $dbw = new DBLayer($cfg['db']['web']); + $statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username)); + $row = $statement->fetch(); + return $row['UId']; + } + public function getUsername($id){ global $cfg; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php index 1f8d5ce22..e4b43da45 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php @@ -36,7 +36,7 @@ function add_user(){ function write_user($newUser){ - + //create salt here, because we want it to be the same on the web/server $hashpass = crypt($newUser["pass"], WebUsers::generateSALT()); @@ -49,12 +49,14 @@ function write_user($newUser){ //Create the user on the shard + in case shard is offline put copy of query in query db //returns: ok, shardoffline or liboffline $result = WebUsers::createUser($params); + try{ - //make connection with web db and put it in there global $cfg; + //make connection with web db and put it in there $dbw = new DBLayer($cfg['db']['web']); $dbw->execute("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params); + ticket_user::createTicketUser( WebUsers::getId($newUser["name"]), 1, $cfg['db']['lib'] ); }catch (PDOException $e) { //go to error page or something, because can't access website db diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php index 3a4d8a489..eb9be221f 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php @@ -11,8 +11,8 @@ function login(){ $_SESSION['user'] = $_POST["Username"]; $_SESSION['permission'] = $result['Permission']; $_SESSION['id'] = $result['UId']; - print('id='); - print($_SESSION['id']); + $_SESSION['ticket_user'] = Ticket_User::constr_ExternId($result['UId'],$cfg['db']['lib']); + //go back to the index page. header( 'Location: index.php' ); exit; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php index 52c7b445d..90bafbefc 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php @@ -24,7 +24,7 @@ function settings(){ //Sanitize Data $result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL); - $result['Login'] = filter_var($result['Login'], FILTER_SANITIZE_STRING); + //$result['Login'] = filter_var($result['Login'], FILTER_SANITIZE_STRING); $result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING); $result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING); $result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING);