From 730c74bb1d3c965b3e3a89973bf271662fbe9d4a Mon Sep 17 00:00:00 2001 From: Quitta Date: Sun, 15 Sep 2013 19:15:17 +0200 Subject: [PATCH] added function that imports the users from the nel db into the ams/ticket_user --- .../ryzom_ams/www/html/sql/importusers.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php b/code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php new file mode 100644 index 000000000..af8715f5b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php @@ -0,0 +1,44 @@ +executeWithoutParams($sql); + $users = $statement->fetchAll(); + foreach($users as $user){ + //add user to web + $dbw = new DBLayer("web"); + if (! $dbw->execute("SELECT * FROM ams_user WHERE Login = :name",array('name' => $user['Login']))->rowCount()){ + $query = "INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)"; + global $DEFAULT_LANGUAGE; + $vars = array('name' => $user['Login'], 'pass' => $user['Password'], 'mail' => $user['Email'], 'lang' => $DEFAULT_LANGUAGE); + $id = $dbw->executeReturnId($query,$vars); + $dbl = new DBLayer("lib"); + $query = "INSERT INTO `ticket_user` (Permission, ExternId) VALUES (1, :id)"; + $vars = array('id' => $id); + $dbl->execute($query,$vars); + } + } + print "The users were imported! "; + }catch (PDOException $e){ + print "There was an error while creating the admin account! "; + } + + + \ No newline at end of file