Advertisement
Guest User

login_PHP

a guest
Nov 11th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. if(isset($_POST['submit1']))
  2. {
  3. require_once 'config.php';
  4. $_SESSION['username'] = $_POST['username'];
  5. $myusername = $_SESSION['username'];
  6. $mypassword = $_POST['password'];
  7.  
  8. $sql = "SELECT * FROM customer WHERE CusID = '$myusername' and Pass = '$mypassword'";
  9. $result = mysqli_query($conn,$sql);
  10. $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  11. $_SESSION['CusName'] = $row['CusName'];
  12.  
  13.  
  14.  
  15. // If result matched $myusername and $mypassword, table row must be 1 row
  16.  
  17. if($row['CusID'] == $myusername && $row['Pass'] == $mypassword)
  18. {
  19.  
  20. header("Location: menu.php");
  21.  
  22. }
  23. if($row['CusID'] != $myusername)
  24. { ?>
  25. <script language="javascript">
  26. alert("You are not registered")</script>
  27. <?php }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement