Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once 'conexion.php';
- $query="select name, email, type from user where (name='".$_POST['user']."' or email='".$_POST['user']."') and password='".$_POST['pass']."'";
- $result=$conect->query($query);
- if ($result->num_rows == 1) {
- $row=$result->fetch_array();
- $_SESSION['name']=$row['name'];
- $_SESSION['email']=$row['email'];
- $_SESSION['type']=$row['type'];
- if ($row['type'] == 'Student') {
- require 'student.php';
- }elseif ($row['type'] == 'Teacher') {
- require 'teacher.php';
- }
- }else{
- $query2="select name, email from admin where name='".$_POST['user']."' and password='".$_POST['pass']."'";
- echo $query2;
- $result1=$conect->query($query2);
- if ($result1->num_rows == 1) {
- $rows=$result1->fetch_array();
- $_SESSION['name']=$rows['name'];
- $_SESSION['email']=$rows['email'];
- require_once 'admin.php';
- }else{
- $text="<p style='font-weight:bold; color:red; margin-top:3%; text-align: center;'>Este usuario no existe o se ha introducido mal.</p>";
- require('paginaInicio.php');
- }
- }
- $conect->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement