Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php require 'connect.php'; ?>
  2. <?php
  3. session_start();
  4. if(isset($_POST['login'])) {
  5. if (empty($_POST['username']) || empty($_POST['password'])) {
  6. ?>
  7.  
  8. <script language="javascript">
  9. alert("Please Enter Credentials for Username or Password");
  10. window.location="indexmember.php";
  11. </script>
  12.  
  13. <?php
  14. }
  15. else
  16. {
  17. $username=$_POST['username'];
  18. $password=$_POST['password'];
  19.  
  20. $query = mysqli_query($con,"select * from users where user='$username'");
  21. $rows = mysqli_num_rows($query);
  22. if ($rows == 1) {
  23. $res = mysqli_fetch_array($query);
  24. $_SESSION['login_user']=$res['id']; // Initializing Session
  25. header("location: adminside.php"); // Redirecting To Other Page
  26. }
  27. elseif($username=="admin" && $password=="admin123")
  28. {
  29. $_SESSION['admin'] = $username;
  30. header("location: indexmember.php"); //take the admin to the home page
  31. }
  32. **elseif(password_verify ($pass, $row['pass'] )){**
  33. ?>
  34.  
  35. <script language="javascript">
  36. alert("Username or Password is invalid");
  37. window.location="indexmember.php";
  38. </script>
  39.  
  40. <?php
  41. **}else{
  42. session_start();
  43. $_SESSION["LoginFail"] = "Yes";
  44. }**
  45. mysql_close($con); // Closing Connection
  46. }
  47. }
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement