Advertisement
Guest User

f

a guest
May 18th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php session_start();
  2. include("config.php");
  3. if(isset($_POST['login']))
  4. {
  5.     $userName = secure($_POST['username'], $mysqli);
  6.     $pass =  secure($_POST['password'], $mysqli);
  7.    
  8.     $q = "SELECT * FROM tbl_members WHERE username = '$userName' AND pass = '$pass'";
  9.     if($res = $mysqli->query($q))
  10.     {
  11.         if($res->num_rows > 0)
  12.         {
  13.             $_SESSION['userName'] = $userName;
  14.             header("Location:welcome.php");
  15.             exit;
  16.         }
  17.         else
  18.         {
  19.             echo'<script>alert("INVALID USERNAME OR PASSWORD");</script>';
  20.             header("Location:index.php");
  21.             exit;
  22.         }
  23.     }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement