Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once 'conexion.php';
  4.  
  5. $query="select name, email, type from user where (name='".$_POST['user']."' or email='".$_POST['user']."') and password='".$_POST['pass']."'";
  6.  
  7. $result=$conect->query($query);
  8.  
  9. if ($result->num_rows == 1) {
  10. $row=$result->fetch_array();
  11.  
  12. $_SESSION['name']=$row['name'];
  13. $_SESSION['email']=$row['email'];
  14. $_SESSION['type']=$row['type'];
  15.  
  16. if ($row['type'] == 'Student') {
  17. require 'student.php';
  18. }elseif ($row['type'] == 'Teacher') {
  19. require 'teacher.php';
  20. }
  21. }else{
  22. $query2="select name, email from admin where name='".$_POST['user']."' and password='".$_POST['pass']."'";
  23. echo $query2;
  24. $result1=$conect->query($query2);
  25.  
  26. if ($result1->num_rows == 1) {
  27. $rows=$result1->fetch_array();
  28.  
  29. $_SESSION['name']=$rows['name'];
  30. $_SESSION['email']=$rows['email'];
  31. require_once 'admin.php';
  32. }else{
  33. $text="<p style='font-weight:bold; color:red; margin-top:3%; text-align: center;'>Este usuario no existe o se ha introducido mal.</p>";
  34. require('paginaInicio.php');
  35. }
  36. }
  37. $conect->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement