Add Database structure
This commit is contained in:
1 parent
f5f42b73ee
commit
3ad5f5bdd6
4 files changed
+19
-4
No files matched your search
Regular → Executable
+2
-2
@@ -28,14 +28,14 @@ $hash = hash("sha256", $password);
|
||||
$command = "SELECT username, password FROM users WHERE username = :username AND password = :password";
|
||||
$args = [
|
||||
":username" => $username,
|
||||
":password" => $password
|
||||
":password" => $hash
|
||||
];
|
||||
|
||||
// Execute SQL Command
|
||||
$result = $api->dbCommand($command, true, true, $args);
|
||||
|
||||
// Check Result
|
||||
if ($result) {
|
||||
if ($result && password_verify($password, $result["password"])) {
|
||||
// Login successful. Generate Auth Token
|
||||
$token = $api->generateToken($username);
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
// Load Main Libary
|
||||
require "../api.php";
|
||||
|
||||
$api = new gbAPI(true);
|
||||
$api = new gbAPI(false);
|
||||
|
||||
// Check Request body
|
||||
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||
@@ -32,7 +32,7 @@ if ($password !== $password_repeat) {
|
||||
}
|
||||
|
||||
// Hash Password
|
||||
$hash = hash("sha256", $password);
|
||||
$hash = password_hash($password);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user