Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(isset($_POST['submit'])){
  4. $con = mysqli_connect("localhost","root","","imetrics");
  5.  
  6. $username = $_POST['username'];
  7. $password = $_POST['password'];
  8.  
  9.  
  10. $user = mysqli_query($con, "SELECT * FROM user WHERE password='$password' AND username='$username'")or die("Cannot connect");
  11. $count = mysqli_num_rows($user);
  12.  
  13. if($count > 0) {
  14. $row = mysqli_fetch_assoc($user);
  15.  
  16. if($row['usertype'] == 'Client'){
  17. $_SESSION['username'] = $_POST['username'];
  18. header("location:a.php");
  19. }
  20. else{
  21.  
  22. $_SESSION['age'] = $row['age']; // declaration ng session na AGE na ang value is from AGE column ng user na nag login
  23.  
  24. //DITO KA MAG LAGAY NG IF STATEMENT
  25.  
  26. $_SESSION['username'] = $_POST['username'];
  27. header("location:takesurvey.php");
  28.  
  29. }
  30. }
  31. else{
  32. echo '<script language="javascript">';
  33. echo 'alert("Wrong username/password")';
  34. echo '</script>';
  35. }
  36. }
  37.  
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement