diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php index 2712e0aee..bedd1e2b8 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php @@ -60,7 +60,7 @@ class Helpers{ global $SITEBASE; $arr = array( $AMS_LIB . '/ingame_templates/', $AMS_LIB . '/configs', - $AMS_LIB . '/cache', + //$AMS_LIB . '/cache', $SITEBASE . '/cache/', $SITEBASE . '/templates/', $SITEBASE . '/templates_c/', @@ -68,7 +68,8 @@ class Helpers{ ); foreach ( $arr as & $value ){ if ( !file_exists( $value ) ){ - mkdir( $value ); + echo $value; + mkdir( $value); } } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php index 2bd042f74..c0d956d46 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php @@ -312,6 +312,42 @@ class Users{ } } + + 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!"); + 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; + } + } } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php index eada82bb2..e63155170 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php @@ -10,11 +10,6 @@ $page = 'login'; if ( isset( $_POST["function"] ) ){ require( "inc/" . $_POST["function"] . ".php" ); $tempReturn = $_POST["function"](); - /*$functionReturn = array_merge($tempReturn,$_POST); - if ( isset($_POST["callBack"])){ - $page = $_POST["callBack"]; - - }*/ } function loadpage ( $page ){ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/login.php b/code/ryzom/tools/server/ryzom_ams/www/html/login.php deleted file mode 100644 index 9bb640c2c..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/login.php +++ /dev/null @@ -1,44 +0,0 @@ - - -