Code Snippets
Login
Basic login call
Login Function Calls for Basic Login Form
Label
// PROCEDURAL VERSION if (isset($_POST["userLoginName"], $_POST["userLoginPwd"])) { $name = standardClean($_POST["userLoginName"]); $pwd = $_POST["userLoginPwd"]; $attemptLogin = attemptUserLogin($db,$name, $pwd); header("Location: ./"); } // OO Version if (isset($_POST["userLoginName"], $_POST["userLoginPwd"])) { $name = $_POST["userLoginName"]; $pwd = $_POST["userLoginPwd"]; // either have this here or put it outside the function if there are multiple functions // $userManager = new UserManager($db); if ($userManager->attemptUserLogin($name, $pwd)) { header("Location: ./"); exit; } else { echo "Login failed. Please check your credentials."; } }
Copy to clipboard
Copied!
©
Leerlandais 2024