Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_SESSION['username'])) {
- header('location:index.php');
- }
- include '../inc/db.php';
- if (isset($_POST['submit'])) {
- $username = mysqli_real_escape_string($conn,$_POST['username']);
- $password = mysqli_real_escape_string($conn,$_POST['password']);
- $query = "SELECT * FROM admin_user WHERE username='$username'";
- $rslt = mysqli_query($conn,$query);
- if(mysqli_num_rows($rslt)>0){
- while ($row = mysqli_fetch_array($rslt)) {
- if (password_verify($password, $row['password'])) {
- $_SESSION['username'] = $username;
- header('location:index.php');
- }else{
- echo "<div class='alert alert-danger inputmsg-txt'>Username or Password does not matched</div>";
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment