Advertisement
Guest User

Untitled

a guest
Feb 14th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2.         if (isset($_POST['login']))
  3.             {
  4.                 $username=$_POST['username'];
  5.                 $password=$_POST['password'];
  6.                
  7.                 $query= "select * from username WHERE username='$username' AND password='$password' ";
  8.  
  9.                 $query_run = mysqli_query($con,$query);
  10.                
  11.                 if(mysqli_num_rows($query_run)>0)
  12.                 {
  13.                     //valid
  14.                     $_SESSION['username']= $username;
  15.                     header('location:homepage.php');
  16.                 }  
  17.                 else {
  18.                     //invalid
  19.                     echo '<script type="text/javascript"> alert ("Invalid credentials") </script>';
  20.                 }
  21.             }
  22.  
  23.        
  24.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement