Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function login_user($username, $password) {
- $sqlQuery = "SELECT * FROM users WHERE username = ? AND password = ?";
- $statement = $db->prepare($sqlQuery);
- $statment->bindParam(1, $username);
- $statment->bindParam(2, $password);
- $statement->execute();
- $data = $statement->fetch();
- if ($data) {
- return true;
- }
- return false;
- }
- if (isset($_POST['submit'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- // execute your function
- if (login_user($username, $password)) {
- header("location:admin");
- }
- }
- header("location:login.php");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement