Example #1
0
        // return user details
        //return $query->fetchAll();
        echo 'it\'s good';
        echo '<br>';
    } else {
        echo 'error';
        echo '<br>';
        //return $false;
    }
}
$name = "bachirdiop";
$email = "*****@*****.**";
$password = "******";
$email2 = 'diopisemou@gmail';
echo storeUser($name, $email, $password);
echo getUserByEmailAndPassword('*****@*****.**', 'bachirdiop3');
if (isUserExisted($email2)) {
    echo 'il existe';
} else {
    echo 'il existe pas ';
}
/*	
				$uuid = uniqid('fss_u', true);
				
				$salt = sha1(rand());
				$salt = substr($salt, 0, 10);
				$encrypted = base64_encode(sha1($password . $salt, true) . $salt);
				
				$hash = array("salt" => $salt, "encrypted" => $encrypted);
				$encrypted_password = $hash["encrypted"]; // encrypted password
				$salt = $hash["salt"]; // salt
Example #2
0
// dangerous
$dbname = "jengar1q_mobiel";
$conn = mysqli_connect($servername, $username, $password, $dbname);
//  //json response array
// $response = array("error" => FALSE);
// $response["error"] = FALSE;
//         $response["ID"] = "1";
//         $response["user"]["Naam"] = "test";
//         $response["user"]["Email"] = "test";
//         echo json_encode($response);
if (isset($_POST['email']) && isset($_POST['password'])) {
    // receiving the post params
    $email = $_POST['email'];
    $password = $_POST['password'];
    // get the user by email and password
    $user = getUserByEmailAndPassword($email, $password);
    if ($user != false) {
        // use is found
        $response["ID"] = $user["ID"];
        $response["user"]["Naam"] = $user["Naam"];
        $response["user"]["Achternaam"] = $user["Achternaam"];
        $response["user"]["Email"] = $user["Email"];
        $response["user"]["Wachtwoord"] = $user["Wachtwoord"];
        echo json_encode($response);
    } else {
        // user is not found with the credentials
        $response["error"] = TRUE;
        $response["error_msg"] = "Login credentials are wrong. Please try again!";
        echo json_encode($response);
    }
} else {