Merge with quitta-gsoc-2013
This commit is contained in:
commit
cf6fc2711c
14 changed files with 375 additions and 148 deletions
|
@ -257,15 +257,12 @@ class Users{
|
||||||
}
|
}
|
||||||
|
|
||||||
function createUser($values){
|
function createUser($values){
|
||||||
$login = $values["name"];
|
|
||||||
$pass = $values["pass"];
|
|
||||||
$email = $values["mail"];
|
|
||||||
|
|
||||||
$webhost = $values["webhost"];
|
$libhost = $values["libhost"];
|
||||||
$webport = $values["webport"];
|
$libport = $values["libport"];
|
||||||
$webdbname = $values["webdbname"];
|
$libdbname = $values["libdbname"];
|
||||||
$webusername = $values["webusername"];
|
$libusername = $values["libusername"];
|
||||||
$webpassword = $values["webpassword"];
|
$libpassword = $values["libpassword"];
|
||||||
|
|
||||||
$shardhost = $values["shardhost"];
|
$shardhost = $values["shardhost"];
|
||||||
$shardport = $values["shardport"];
|
$shardport = $values["shardport"];
|
||||||
|
@ -273,84 +270,31 @@ class Users{
|
||||||
$shardusername = $values["shardusername"];
|
$shardusername = $values["shardusername"];
|
||||||
$shardpassword = $values["shardpassword"];
|
$shardpassword = $values["shardpassword"];
|
||||||
|
|
||||||
$salt = Users::generateSALT();
|
try {
|
||||||
$hashpass = crypt($pass, $salt);
|
//make connection with and put into shard db
|
||||||
|
$dbs = new PDO("mysql:host=$shardhost;port=$shardport;dbname=$sharddbname", $shardusername, $shardpassword);
|
||||||
$params = array(
|
$dbs->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$login,
|
$statement = $dbs->prepare("INSERT INTO user (Login, Password, Email) VALUES (:name, :pass, :mail)");
|
||||||
$hashpass,
|
$statement->execute($values["params"]);
|
||||||
$email
|
return "ok";
|
||||||
);
|
|
||||||
|
|
||||||
try{
|
|
||||||
//make connection with web db
|
|
||||||
$dbw = new PDO("mysql:host=$webhost;port=$webport;dbname=$webdbname", $webusername, $webpassword);
|
|
||||||
$dbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
|
|
||||||
//put into web db
|
|
||||||
$statement = $dbw->prepare("INSERT INTO ams_user (Login, Password, Email) VALUES (?, ?, ?)");
|
|
||||||
$statement->execute($params);
|
|
||||||
try {
|
|
||||||
//make connection with and put into shard db
|
|
||||||
$dbs = new PDO("mysql:host=$shardhost;port=$shardport;dbname=$sharddbname", $shardusername, $shardpassword);
|
|
||||||
$dbs->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
$statement = $dbs->prepare("INSERT INTO user (Login, Password, Email) VALUES (?, ?, ?)");
|
|
||||||
$statement->execute($params);
|
|
||||||
}
|
|
||||||
catch (PDOException $e) {
|
|
||||||
//print_r($e);
|
|
||||||
//oh noooz, the shard is offline! Put in query queue at web db!
|
|
||||||
$params = array("type" => "createUser","query" => json_encode(array($login,$pass,$email)));
|
|
||||||
$statement = $dbw->prepare("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)");
|
|
||||||
$statement->execute($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch (PDOException $e) {
|
|
||||||
//go to error page or something, because can't access website db
|
|
||||||
print_r($e);
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
catch (PDOException $e) {
|
||||||
|
//oh noooz, the shard is offline! Put in query queue at ams_lib db!
|
||||||
|
try {
|
||||||
|
$dbl = new PDO("mysql:host=$libhost;port=$libport;dbname=$libdbname", $libusername, $libpassword);
|
||||||
|
$dbl->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$params = array("type" => "createUser","query" => json_encode(array($values["params"]["name"],$values["params"]["pass"],$values["params"]["mail"])));
|
||||||
|
$statement = $dbl->prepare("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)");
|
||||||
|
$statement->execute($params);
|
||||||
|
return "shardoffline";
|
||||||
|
}catch (PDOException $e) {
|
||||||
|
print_r($e);
|
||||||
|
return "liboffline";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login($params){
|
|
||||||
$webhost = $params["webhost"];
|
|
||||||
$webport = $params["webport"];
|
|
||||||
$webdbname = $params["webdbname"];
|
|
||||||
$webusername = $params["webusername"];
|
|
||||||
$webpassword = $params["webpassword"];
|
|
||||||
|
|
||||||
try{
|
|
||||||
$dbw = new PDO("mysql:host=$webhost;port=$webport;dbname=$webdbname", $webusername, $webpassword);
|
|
||||||
$dbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
|
|
||||||
$statement = $dbw->prepare("SELECT * FROM ams_user WHERE Login=:user");
|
|
||||||
$statement->execute(array('user' => $params['name']));
|
|
||||||
$count = $statement->rowCount();
|
|
||||||
|
|
||||||
if ($count==1) {
|
|
||||||
$row = $statement->fetch();
|
|
||||||
$salt = substr($row['Password'],0,2);
|
|
||||||
$hashed_input_pass = crypt($params["pass"], $salt);
|
|
||||||
if($hashed_input_pass == $row['Password']){
|
|
||||||
//handle successful login
|
|
||||||
print("nice welcome!");
|
|
||||||
$_SESSION['user'] = $params['name'];
|
|
||||||
$_SESSION['permission'] = $row['Permission'];
|
|
||||||
print( $_SESSION['user']);
|
|
||||||
return "success";
|
|
||||||
}else{
|
|
||||||
//handle login failure
|
|
||||||
print("Login failed");
|
|
||||||
return "failure";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (PDOException $e) {
|
|
||||||
//go to error page or something, because can't access website db
|
|
||||||
print_r($e);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,22 @@
|
||||||
[home]
|
[home]
|
||||||
|
|
||||||
[login]
|
[login]
|
||||||
|
login_info = "Please login with your Username and Password."
|
||||||
|
login_error_message = "The filled in username/password were not correct!"
|
||||||
|
|
||||||
|
[logout]
|
||||||
|
logout_message = "You've been logged out successfully!"
|
||||||
|
login_title = "Login"
|
||||||
|
login_timer = "You will be redirected to the login page in "
|
||||||
|
login_text = "Or click here if you don't want to wait!"
|
||||||
|
|
||||||
|
[register_feedback]
|
||||||
|
status_ok = "You registered like a baws!"
|
||||||
|
status_shardoffline = "It seems the shard is offline, you can use the web-account, but you will need to wait for the shard."
|
||||||
|
status_liboffline = "You can't register an account at this time"
|
||||||
|
login_title = "Login"
|
||||||
|
login_timer = "You will be redirected to the login page in "
|
||||||
|
login_text = "Or click here if you don't want to wait!"
|
||||||
|
|
||||||
[register]
|
[register]
|
||||||
title = "RYZOM CORE INGAME REGISTRATION"
|
title = "RYZOM CORE INGAME REGISTRATION"
|
||||||
|
|
|
@ -5,21 +5,30 @@
|
||||||
// Variables for database access
|
// Variables for database access
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
// where we can find the mysql database
|
// where we can find the mysql database
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//the www db
|
||||||
$WEBDBHOST = 'localhost';
|
$WEBDBHOST = 'localhost';
|
||||||
$WEBDBPORT = '3306';
|
$WEBDBPORT = '3306';
|
||||||
$WEBDBNAME = 'ryzom_ams';
|
$WEBDBNAME = 'ryzom_ams';
|
||||||
$WEBDBUSERNAME = 'shard';
|
$WEBDBUSERNAME = 'root';
|
||||||
$WEBDBPASSWORD = '' ;
|
$WEBDBPASSWORD = 'lol123' ;
|
||||||
|
|
||||||
|
//the ams_lib db
|
||||||
|
$LIBDBHOST = 'localhost';
|
||||||
|
$LIBDBPORT = '3306';
|
||||||
|
$LIBDBNAME = 'ryzom_ams_lib';
|
||||||
|
$LIBDBUSERNAME = 'root';
|
||||||
|
$LIBDBPASSWORD = 'lol123' ;
|
||||||
|
|
||||||
|
//the shard db
|
||||||
$SHARDDBHOST = 'localhost' ;
|
$SHARDDBHOST = 'localhost' ;
|
||||||
$SHARDDBPORT = '3306';
|
$SHARDDBPORT = '3306';
|
||||||
$SHARDDBNAME = 'nel' ;
|
$SHARDDBNAME = 'nel' ;
|
||||||
$SHARDDBUSERNAME = 'shard' ;
|
$SHARDDBUSERNAME = 'shard' ;
|
||||||
$SHARDDBPASSWORD = '' ;
|
$SHARDDBPASSWORD = '' ;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// If true= the server will add automatically unknown user in the database
|
// If true= the server will add automatically unknown user in the database
|
||||||
// (in nel.user= nel.permission= ring.ring_user and ring.characters
|
// (in nel.user= nel.permission= ring.ring_user and ring.characters
|
||||||
$ALLOW_UNKNOWN = true ;
|
$ALLOW_UNKNOWN = true ;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
$pageElements['no_visible_elements'] = 'TRUE';
|
||||||
|
helpers :: loadtemplate( 'logout', $pageElements);
|
||||||
|
exit();
|
|
@ -15,7 +15,11 @@ function add_user(){
|
||||||
'access' => $_SERVER['REQUEST_TIME']
|
'access' => $_SERVER['REQUEST_TIME']
|
||||||
);
|
);
|
||||||
//header( 'Location: email_sent.php' );
|
//header( 'Location: email_sent.php' );
|
||||||
write_user( $edit );
|
$status = write_user( $edit );
|
||||||
|
$pageElements['status'] = $status;
|
||||||
|
//TODO: perhaps send email!
|
||||||
|
$pageElements['no_visible_elements'] = 'TRUE';
|
||||||
|
helpers :: loadtemplate( 'register_feedback', $pageElements);
|
||||||
exit;
|
exit;
|
||||||
}else{
|
}else{
|
||||||
// pass error
|
// pass error
|
||||||
|
@ -31,26 +35,43 @@ function add_user(){
|
||||||
|
|
||||||
|
|
||||||
function write_user($newUser){
|
function write_user($newUser){
|
||||||
|
|
||||||
|
//get the db specifics out of the config file
|
||||||
global $WEBDBHOST;
|
global $WEBDBHOST;
|
||||||
global $WEBDBPORT;
|
global $WEBDBPORT;
|
||||||
global $WEBDBNAME;
|
global $WEBDBNAME;
|
||||||
global $WEBDBUSERNAME;
|
global $WEBDBUSERNAME;
|
||||||
global $WEBDBPASSWORD;
|
global $WEBDBPASSWORD;
|
||||||
|
|
||||||
|
global $LIBDBHOST;
|
||||||
|
global $LIBDBPORT;
|
||||||
|
global $LIBDBNAME;
|
||||||
|
global $LIBDBUSERNAME;
|
||||||
|
global $LIBDBPASSWORD;
|
||||||
|
|
||||||
global $SHARDDBHOST;
|
global $SHARDDBHOST;
|
||||||
global $SHARDDBPORT;
|
global $SHARDDBPORT;
|
||||||
global $SHARDDBNAME;
|
global $SHARDDBNAME;
|
||||||
global $SHARDDBUSERNAME;
|
global $SHARDDBUSERNAME;
|
||||||
global $SHARDDBPASSWORD;
|
global $SHARDDBPASSWORD;
|
||||||
|
|
||||||
$values["name"] = $newUser["name"];
|
//create salt here, because we want it to be the same on the web/server
|
||||||
$values["pass"] = $newUser["pass"];
|
$hashpass = crypt($newUser["pass"], Users::generateSALT());
|
||||||
$values["mail"] = $newUser["mail"];
|
|
||||||
|
|
||||||
$values["webhost"] = $WEBDBHOST;
|
$params = array(
|
||||||
$values["webport"] = $WEBDBPORT;
|
'name' => $newUser["name"],
|
||||||
$values["webdbname"] = $WEBDBNAME;
|
'pass' => $hashpass,
|
||||||
$values["webusername"] = $WEBDBUSERNAME;
|
'mail' => $newUser["mail"]
|
||||||
$values["webpassword"] = $WEBDBPASSWORD ;
|
);
|
||||||
|
|
||||||
|
//print_r($params);
|
||||||
|
//make a $values array for passing all data to the Users::createUser() function.
|
||||||
|
$values["params"] = $params;
|
||||||
|
$values["libhost"] = $LIBDBHOST;
|
||||||
|
$values["libport"] = $LIBDBPORT;
|
||||||
|
$values["libdbname"] = $LIBDBNAME;
|
||||||
|
$values["libusername"] = $LIBDBUSERNAME;
|
||||||
|
$values["libpassword"] = $LIBDBPASSWORD ;
|
||||||
|
|
||||||
$values["shardhost"] = $SHARDDBHOST;
|
$values["shardhost"] = $SHARDDBHOST;
|
||||||
$values["shardport"] = $SHARDDBPORT;
|
$values["shardport"] = $SHARDDBPORT;
|
||||||
|
@ -59,8 +80,23 @@ function write_user($newUser){
|
||||||
$values["shardpassword"] = $SHARDDBPASSWORD;
|
$values["shardpassword"] = $SHARDDBPASSWORD;
|
||||||
|
|
||||||
|
|
||||||
|
//Create the user on the shard + in case shard is offline put copy of query in query db
|
||||||
|
//returns ok, shardoffline or liboffline
|
||||||
$result = Users :: createUser($values);
|
$result = Users :: createUser($values);
|
||||||
|
|
||||||
print('Awesome');
|
try{
|
||||||
|
//make connection with web db and put it in there
|
||||||
|
$dbw = new PDO("mysql:host=$WEBDBHOST;port=$WEBDBPORT;dbname=$WEBDBNAME", $WEBDBUSERNAME, $WEBDBPASSWORD);
|
||||||
|
$dbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$statement = $dbw->prepare("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)");
|
||||||
|
$statement->execute($params);
|
||||||
|
|
||||||
|
}catch (PDOException $e) {
|
||||||
|
//go to error page or something, because can't access website db
|
||||||
|
print_r($e);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
43
code/ryzom/tools/server/ryzom_ams/www/html/inc/login.php
Normal file
43
code/ryzom/tools/server/ryzom_ams/www/html/inc/login.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function login(){
|
||||||
|
|
||||||
|
global $WEBDBHOST;
|
||||||
|
global $WEBDBPORT;
|
||||||
|
global $WEBDBNAME;
|
||||||
|
global $WEBDBUSERNAME;
|
||||||
|
global $WEBDBPASSWORD;
|
||||||
|
|
||||||
|
try{
|
||||||
|
$dbw = new PDO("mysql:host=$WEBDBHOST;port=$WEBDBPORT;dbname=$WEBDBNAME", $WEBDBUSERNAME, $WEBDBPASSWORD);
|
||||||
|
$dbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
$statement = $dbw->prepare("SELECT * FROM ams_user WHERE Login=:user");
|
||||||
|
$statement->execute(array('user' => $_POST['Username']));
|
||||||
|
|
||||||
|
$row = $statement->fetch();
|
||||||
|
$salt = substr($row['Password'],0,2);
|
||||||
|
$hashed_input_pass = crypt($_POST["Password"], $salt);
|
||||||
|
if($hashed_input_pass == $row['Password']){
|
||||||
|
//handle successful login
|
||||||
|
$_SESSION['user'] = $_POST["Username"];
|
||||||
|
$_SESSION['permission'] = $row['Permission'];
|
||||||
|
//go back to the index page.
|
||||||
|
header( 'Location: index.php' );
|
||||||
|
exit;
|
||||||
|
}else{
|
||||||
|
//handle login failure
|
||||||
|
$result['login_error'] = 'TRUE';
|
||||||
|
$result['no_visible_elements'] = 'TRUE';
|
||||||
|
helpers :: loadtemplate( 'login', $result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}catch (PDOException $e) {
|
||||||
|
//go to error page or something, because can't access website db
|
||||||
|
print_r($e);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,11 +5,18 @@ require( '../config.php' );
|
||||||
require( '../../ams_lib/libinclude.php' );
|
require( '../../ams_lib/libinclude.php' );
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
print("[" . $_SESSION['user'] . "] ");
|
//print_r($_SESSION);
|
||||||
|
|
||||||
|
//perform an action in case one is specified
|
||||||
|
if ( isset( $_POST["function"] ) ){
|
||||||
|
require( "inc/" . $_POST["function"] . ".php" );
|
||||||
|
$return = $_POST["function"]();
|
||||||
|
}
|
||||||
|
|
||||||
//Decide what page to load
|
//Decide what page to load
|
||||||
if(isset($_SESSION['user'])){
|
if(isset($_SESSION['user'])){
|
||||||
$page = 'home';
|
$page = 'home';
|
||||||
|
$return['username'] = $_SESSION['user'];
|
||||||
}else{
|
}else{
|
||||||
//default page
|
//default page
|
||||||
$page = 'login';
|
$page = 'login';
|
||||||
|
@ -19,20 +26,18 @@ if ( isset( $_GET["page"] ) ){
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
}
|
}
|
||||||
|
|
||||||
//perform an action in case one is specified
|
|
||||||
if ( isset( $_POST["function"] ) ){
|
|
||||||
require( "inc/" . $_POST["function"] . ".php" );
|
|
||||||
$return = $_POST["function"]();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function loadpage ( $page ){
|
function loadpage ( $page ){
|
||||||
require_once( 'autoload/' . $page . '.php' );
|
$filename = 'autoload/' . $page . '.php';
|
||||||
|
if(is_file($filename)){
|
||||||
|
require_once($filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadpage($page);
|
||||||
|
|
||||||
//Set permission
|
//Set permission
|
||||||
if(isset($_SESSION['Permission'])){
|
if(isset($_SESSION['permission'])){
|
||||||
$return['permission'] = $_SESSION['Permission'];
|
$return['permission'] = $_SESSION['permission'];
|
||||||
}else{
|
}else{
|
||||||
//default permission
|
//default permission
|
||||||
$return['permission'] = 0;
|
$return['permission'] = 0;
|
||||||
|
@ -40,12 +45,10 @@ if(isset($_SESSION['Permission'])){
|
||||||
|
|
||||||
|
|
||||||
//hide sidebar + topbar in case of login/register
|
//hide sidebar + topbar in case of login/register
|
||||||
if($page == 'login' || $page == 'register'){
|
if($page == 'login' || $page == 'register' || $page == 'logout'){
|
||||||
$return['no_visible_elements'] = 'TRUE';
|
$return['no_visible_elements'] = 'TRUE';
|
||||||
}else{
|
}else{
|
||||||
$return['no_visible_elements'] = 'FALSE';
|
$return['no_visible_elements'] = 'FALSE';
|
||||||
}
|
}
|
||||||
|
//print_r($return);
|
||||||
helpers :: loadTemplate( $page , $return );
|
helpers :: loadTemplate( $page , $return );
|
||||||
|
|
||||||
session_destroy();
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
CREATE DATABASE IF NOT EXISTS `ryzom_ams`;
|
CREATE DATABASE IF NOT EXISTS `ryzom_ams`;
|
||||||
USE `ryzom_ams`;
|
USE `ryzom_ams`;
|
||||||
DROP TABLE IF EXISTS ams_user;
|
DROP TABLE IF EXISTS ams_user;
|
||||||
DROP TABLE IF EXISTS ams_querycache;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `ams_user` (
|
CREATE TABLE IF NOT EXISTS `ams_user` (
|
||||||
`UId` int(10) NOT NULL AUTO_INCREMENT,
|
`UId` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
@ -12,6 +11,12 @@ CREATE TABLE IF NOT EXISTS `ams_user` (
|
||||||
PRIMARY KEY (`UId`)
|
PRIMARY KEY (`UId`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users information for ryzom_ams';
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users information for ryzom_ams';
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS `ryzom_ams_lib`;
|
||||||
|
USE `ryzom_ams_lib`;
|
||||||
|
DROP TABLE IF EXISTS ams_querycache;
|
||||||
|
|
||||||
CREATE TABLE ams_querycache (
|
CREATE TABLE ams_querycache (
|
||||||
`SID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
`SID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||||
`type` VARCHAR( 64 ) NOT NULL ,
|
`type` VARCHAR( 64 ) NOT NULL ,
|
||||||
|
|
65
code/ryzom/tools/server/ryzom_ams/www/html/sql/install.php
Normal file
65
code/ryzom/tools/server/ryzom_ams/www/html/sql/install.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
require( '../../config.php' );
|
||||||
|
ini_set( "display_errors", true );
|
||||||
|
error_reporting( E_ALL );
|
||||||
|
|
||||||
|
global $WEBDBHOST;
|
||||||
|
global $WEBDBUSERNAME;
|
||||||
|
global $WEBDBPASSWORD;
|
||||||
|
|
||||||
|
global $LIBDBHOST;
|
||||||
|
global $LIBDBUSERNAME;
|
||||||
|
global $LIBDBPASSWORD;
|
||||||
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
//SETUP THE WWW DB
|
||||||
|
$dbw = new PDO("mysql:host=$WEBDBHOST;", $WEBDBUSERNAME, $WEBDBPASSWORD);
|
||||||
|
$dbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$sql = "
|
||||||
|
CREATE DATABASE IF NOT EXISTS `ryzom_ams`;
|
||||||
|
USE `ryzom_ams`;
|
||||||
|
DROP TABLE IF EXISTS ams_user;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `ams_user` (
|
||||||
|
`UId` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`Login` varchar(64) NOT NULL DEFAULT '',
|
||||||
|
`Password` varchar(13) DEFAULT NULL,
|
||||||
|
`Email` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`Permission` int(3) NOT NULL DEFAULT 1,
|
||||||
|
PRIMARY KEY (`UId`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users information for ryzom_ams';
|
||||||
|
|
||||||
|
);
|
||||||
|
";
|
||||||
|
$statement = $dbw->prepare($sql);
|
||||||
|
$statement->execute();
|
||||||
|
|
||||||
|
//SETUP THE AMS_LIB DB
|
||||||
|
$dbl = new PDO("mysql:host=$LIBDBHOST;", $LIBDBUSERNAME, $LIBDBPASSWORD);
|
||||||
|
$dbl->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$sql = "
|
||||||
|
CREATE DATABASE IF NOT EXISTS `ryzom_ams_lib`;
|
||||||
|
USE `ryzom_ams_lib`;
|
||||||
|
DROP TABLE IF EXISTS ams_querycache;
|
||||||
|
|
||||||
|
CREATE TABLE ams_querycache (
|
||||||
|
`SID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||||
|
`type` VARCHAR( 64 ) NOT NULL ,
|
||||||
|
`query` VARCHAR( 512 ) NOT NULL
|
||||||
|
);
|
||||||
|
";
|
||||||
|
$statement = $dbl->prepare($sql);
|
||||||
|
$statement->execute();
|
||||||
|
print('Install completed successful!');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}catch (PDOException $e) {
|
||||||
|
//go to error page or something, because can't access website db
|
||||||
|
print('There was an error while installing');
|
||||||
|
print_r($e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,17 +89,19 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- theme selector ends -->
|
<!-- theme selector ends -->
|
||||||
<!-- user dropdown starts -->
|
<!-- user dropdown starts -->
|
||||||
|
{if isset($username)}
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||||
<i class="icon-user"></i><span class="hidden-phone"> admin</span>
|
<i class="icon-user"></i><span class="hidden-phone">{$username}</span>
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="#">Profile</a></li>
|
<li><a href="#">Profile</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="login.php">Logout</a></li>
|
<li><a href="index.php?page=logout">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
<!-- user dropdown ends -->
|
<!-- user dropdown ends -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
<li style="margin-left: -2px;" class="active"><a class="ajax-link" href="?page=home"><i class="icon-home"></i><span class="hidden-tablet"> Dashboard</span></a></li>
|
<li style="margin-left: -2px;" class="active"><a class="ajax-link" href="?page=home"><i class="icon-home"></i><span class="hidden-tablet"> Dashboard</span></a></li>
|
||||||
<li class="nav-header hidden-tablet">Sample Section</li>
|
<li class="nav-header hidden-tablet">Sample Section</li>
|
||||||
<li style="margin-left: -2px;"><a href="?page=login"><i class="icon-lock"></i><span class="hidden-tablet"> Login Page</span></a></li>
|
<li style="margin-left: -2px;"><a href="?page=login"><i class="icon-lock"></i><span class="hidden-tablet"> Login Page</span></a></li>
|
||||||
|
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
|
|
@ -8,38 +8,45 @@
|
||||||
</div><!--/row-->
|
</div><!--/row-->
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="well span5 center login-box">
|
<div class="well span5 center login-box">
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
Please login with your Username and Password.
|
{$login_info}
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="index.php" class="form-horizontal">
|
<form method="post" action="index.php" class="form-horizontal">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div data-rel="tooltip" class="input-prepend" data-original-title="Username">
|
<div data-rel="tooltip" class="input-prepend" data-original-title="Username">
|
||||||
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="Username" name="Username" class="input-large span10" autofocus="">
|
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="Username" name="Username" class="input-large span10" placeholder="Username">
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
<div data-rel="tooltip" class="input-prepend" data-original-title="Password">
|
<div data-rel="tooltip" class="input-prepend" data-original-title="Password">
|
||||||
<span class="add-on"><i class="icon-lock"></i></span><input type="password" value="" id="Password" name="Password" class="input-large span10">
|
<span class="add-on"><i class="icon-lock"></i></span><input type="password" value="" id="Password" name="Password" class="input-large span10" placeholder="Password">
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<label for="remember" class="remember"><div class="checker" id="uniform-remember"><span><input type="checkbox" id="remember" style="opacity: 0;"></span></div>Remember me</label>
|
<label for="remember" class="remember"><div class="checker" id="uniform-remember"><span><input type="checkbox" id="remember" style="opacity: 0;"></span></div>Remember me</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
<p class="center span5">
|
<p class="center span5">
|
||||||
<input type="hidden" name="function" value="login">
|
<input type="hidden" name="function" value="login">
|
||||||
<button class="btn btn-primary" type="submit">Login</button>
|
<button class="btn btn-primary" type="submit">Login</button>
|
||||||
</p>
|
</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<div class="alert alert-info">
|
|
||||||
<strong>Register</strong>
|
{if isset($login_error) and $login_error eq "TRUE"}
|
||||||
If you dont have an account yet, create one <a href="?page=register">here</a>!
|
<div class="alert alert-error">
|
||||||
</div>
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||||
</div><!--/span-->
|
<strong>{$login_error_message}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<strong>Register</strong>
|
||||||
|
If you dont have an account yet, create one <a href="?page=register">here</a>!
|
||||||
|
</div>
|
||||||
|
</div><!--/span-->
|
||||||
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
{extends file="layout.tpl"}
|
||||||
|
{block name=content}
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12 center login-header">
|
||||||
|
<img src="img/mainlogo.png"/>
|
||||||
|
</div><!--/span-->
|
||||||
|
</div><!--/row-->
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="well span5 center login-box">
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{$logout_message}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<strong>{$login_title}</strong>
|
||||||
|
<p>{$login_timer}<span id="seconds">5</span></p>
|
||||||
|
<p><a href="index.php">{$login_text}</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var seconds = 5;
|
||||||
|
setInterval(
|
||||||
|
function(){
|
||||||
|
if (seconds <= 1) {
|
||||||
|
window.location = 'index.php';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById('seconds').innerHTML = --seconds;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1000
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
</div><!--/span-->
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
{extends file="layout.tpl"}
|
||||||
|
{block name=content}
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12 center login-header">
|
||||||
|
<img src="img/mainlogo.png"/>
|
||||||
|
</div><!--/span-->
|
||||||
|
</div><!--/row-->
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="well span5 center login-box">
|
||||||
|
{if isset($status) and $status eq "ok"}
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{$status_ok}
|
||||||
|
</div>
|
||||||
|
{else if isset($status) and $status eq "shardoffline"}
|
||||||
|
<div class="alert alert-error">
|
||||||
|
{$status_shardoffline}
|
||||||
|
</div>
|
||||||
|
{else if isset($status) and $status eq "liboffline"}
|
||||||
|
<div class="alert alert-error">
|
||||||
|
{$status_liboffline}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<strong>{$login_title}</strong>
|
||||||
|
<p>{$login_timer}<span id="seconds">5</span></p>
|
||||||
|
<p><a href="index.php">{$login_text}</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var seconds = 5;
|
||||||
|
setInterval(
|
||||||
|
function(){
|
||||||
|
if (seconds <= 1) {
|
||||||
|
window.location = 'index.php';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById('seconds').innerHTML = --seconds;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1000
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
</div><!--/span-->
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
Loading…
Reference in a new issue