fix stupid mistakes
This commit is contained in:
parent
7ae7b03ec3
commit
13686d85dc
@ -8,15 +8,12 @@ function endpoint($endpoint_data)
|
||||
|
||||
case "login":
|
||||
return doLogin($endpoint_data["email"], $endpoint_data["password"]);
|
||||
break;
|
||||
|
||||
case "logout":
|
||||
return doLogout();
|
||||
break;
|
||||
|
||||
case "register":
|
||||
return doRegister($endpoint_data["firstname"], $endpoint_data["lastname"], $endpoint_data["nickname"], $endpoint_data["email"], $endpoint_data["password"], $endpoint_data["minecraftnick"], $endpoint_data["activation_token"]);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ function isLoggedIn(){
|
||||
|
||||
function doLogin($email, $password){
|
||||
global $mysqli;
|
||||
$found = false;
|
||||
if(!empty($email) && !empty($password)){
|
||||
$stmt = $mysqli->prepare("SELECT ID, FirstName, LastName, Nickname, PasswordHash, MinecraftNick, isAdmin FROM Users WHERE EMAIL = ? AND isActive = 1");
|
||||
$stmt->bind_param("s", $email);
|
||||
@ -19,7 +20,6 @@ function doLogin($email, $password){
|
||||
$mcnick = "";
|
||||
$stmt->bind_result($idcko, $fname, $lname, $nickname, $pwdhash, $mcnick, false);
|
||||
|
||||
$found = false;
|
||||
if($stmt->num_rows() > 0){
|
||||
$stmt->fetch();
|
||||
if (password_verify($password, $pwdhash)){
|
||||
@ -34,8 +34,8 @@ function doLogin($email, $password){
|
||||
}
|
||||
}
|
||||
$stmt->close();
|
||||
return $found ? ["status" => "success"] : ["status" => "fail"];
|
||||
}
|
||||
return $found ? ["status" => "success"] : ["status" => "fail"];
|
||||
}
|
||||
|
||||
function doLogout(){
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
function runEndpoint($endpoint_file)
|
||||
{
|
||||
global $routerRequest;
|
||||
|
||||
$endpoint_data = $_POST
|
||||
$endpoint_data = $_POST;
|
||||
require_once $endpoint_file;
|
||||
|
||||
return endpoint($endpoint_data);
|
||||
|
@ -5,26 +5,6 @@ require_once "lib/router.php";
|
||||
function render()
|
||||
{
|
||||
global $routerConfig;
|
||||
$diddoAjax = true;
|
||||
|
||||
switch ($_POST["action"]) {
|
||||
case "login":
|
||||
doLogin();
|
||||
break;
|
||||
case "register":
|
||||
doRegister();
|
||||
break;
|
||||
case "logout":
|
||||
doLogout();
|
||||
break;
|
||||
default:
|
||||
$diddoAjax = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($diddoAjax) {
|
||||
exit();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user