1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?php function on_post() { global $status; global $token; $status = ""; try { $user = Database\User::fromDB($_POST["username"]); if (password_verify($_POST["password"], $user->Password)) { $token = Database\Cookie::create($user->UID); } else { $status = "Incorrect password!"; } } catch(Exception $e) { $status = "User \"" . $_POST["username"] . "\" doesn't exist!"; } }