I have the following problem:
I am creating a login in which 2 types of users (Admin and Client) can enter. But for some reason, the PHP entry form of the client does not work for me, I have changed the type of login and many times, with different variables, different ways of doing it, etc; and even then I can not make it work in a good way.
I clarify that I am new to this. Could anyone help me? Thanks in advance.
<?php
include_once '../Asistencia_Docentes/core/controller/Database.php';
include_once '../Asistencia_Docentes/core/controller/Session.php';
if (Session::getUID()=="")
{
$user = $_POST['User'];
$pass = sha1(md5($_POST['Password']));
$base = new Database();
$con = $base->connect();
$sql = "SELECT * FROM user WHERE (email= \"".$user."\" OR username= \"".$user."\") AND is_active=1";
$pro = "select * from person where id = '$user'";
//print $sql;
$query = mysqli_query($con,$sql);
$result = mysqli_query($con,$pro);
$row = mysqli_fetch_array($query);
$fil = mysqli_fetch_array($result);
//$active = $row['active'];
//$activo = $fil['active'];
$count = mysqli_num_rows($row);
$cuenta= mysqli_num_rows($fil);
{
if ($row['password'] == $pass)
{
session_start();
// print $userid;
$_SESSION['user_id']=$userid;
// setcookie('userid',$userid);
// print $_SESSION['userid'];
print "Cargando ... $user";
header("location:../Control_Docentes");
exit();
}
if ($fil['Dane'] == $pass)
{
session_start();
// print $userid;
$_SESSION['user_id']=$userid;
// setcookie('userid',$userid);
// print $_SESSION['userid'];
print "Cargando ... $user";
header("location:../Control_Padres");
exit();
}
else
{
//$_SESSION['user_id']='';
header("location:../Login/Login.php");}
}
}
else
{
header("location:../index.html");
}
?>