Loging in match searching seems to work :)
This commit is contained in:
parent
b0889ebc4b
commit
fa7afa87fd
6 changed files with 42 additions and 54 deletions
|
@ -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,6 +68,7 @@ class Helpers{
|
|||
);
|
||||
foreach ( $arr as & $value ){
|
||||
if ( !file_exists( $value ) ){
|
||||
echo $value;
|
||||
mkdir( $value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 ){
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
$no_visible_elements=true;
|
||||
include('header.php'); ?>
|
||||
|
||||
<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-info">
|
||||
Please login with your Username and Password.
|
||||
</div>
|
||||
<form class="form-horizontal" action="index.php" method="post">
|
||||
<fieldset>
|
||||
<div class="input-prepend" title="Username" data-rel="tooltip">
|
||||
<span class="add-on"><i class="icon-user"></i></span><input autofocus class="input-large span10" name="username" id="username" type="text" value="" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="input-prepend" title="Password" data-rel="tooltip">
|
||||
<span class="add-on"><i class="icon-lock"></i></span><input class="input-large span10" name="password" id="password" type="password" value="" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="input-prepend">
|
||||
<label class="remember" for="remember"><input type="checkbox" id="remember" />Remember me</label>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<p class="center span5">
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="alert alert-info">
|
||||
<strong>Register</strong>
|
||||
If you dont have an account yet, create one <a href="register.php">here</a>!
|
||||
</div>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
<?php include('footer.php'); ?>
|
|
@ -15,12 +15,12 @@
|
|||
<form method="post" action="index.php" class="form-horizontal">
|
||||
<fieldset>
|
||||
<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" autofocus="">
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<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">
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
|||
<div class="clearfix"></div>
|
||||
|
||||
<p class="center span5">
|
||||
<input type="hidden" name="function" value="login">
|
||||
<button class="btn btn-primary" type="submit">Login</button>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
{/if}
|
||||
|
||||
<input type="hidden" name="function" value="add_user">
|
||||
<input type="hidden" name="callBack" value="register">
|
||||
<div class="control-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
|
|
Loading…
Reference in a new issue