Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = $_POST['username'];
- $password = $_POST['password'];
- $stmt = $conn->prepare("SELECT * FROM admin WHERE username = ?");
- $stmt->bind_param("s", $username);
- $stmt->execute();
- $result=$stmt->get_result();
- if ($result->num_rows < 1) {
- ?>
- <script>
- alert('Cannot find account with the username');
- window.location='admin.php';
- </script>
- <?php
- } else {
- $row = $result->fetch_assoc();
- if (password_verify($password, $row['password'])) {
- $_SESSION['admin'] = $row['id'];
- ?>
- <script>
- alert('WELCOME ADMIN');
- window.location='admin/';
- </script>
- <?php
- } else {
- ?>
- <script>
- alert('Incorrect password');
- window.location='admin.php';
- </script>
- <?php
- }
- }
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement