Advertisement
Guest User

Untitled

a guest
Jun 17th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2.     include("includes\config.php");
  3.     session_start();
  4.     if($_SERVER["REQUEST_METHOD"] == "POST")
  5.     {
  6.         $username=mysqli_real_escape_string($dbconfig,$_POST['username']);
  7.         $password=mysqli_real_escape_string($dbconfig,$_POST['password']);
  8.         $sql_query="SELECT id FROM admins WHERE username='$username' and password='$password'";
  9.         $result=mysqli_query($dbconfig,$sql_query);
  10.         $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
  11.         $count=mysqli_num_rows($result);
  12.        
  13.         if($count==1){
  14.         $_SESSION['login_user']=$username;
  15.          
  16.         header("location: login_success.php");
  17.         }
  18.         else
  19.         {
  20.             $error="Username or Password is invalid";
  21.         }
  22.     }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement