<?php
session_start();
$login = $_POST['email'];
$password = md5($_POST['password']);

include('/home/worksmidiacom/cirurgiadeuroemcadaveres/config/cirurgiadeuroemcadaveres.config.php');

$sql1 = $conecta->query("SELECT * FROM usuarios WHERE senha = '$password' AND email = '$login'");
while ($consulta1 = $sql1->fetch_assoc())
{$nome = $consulta1['nome'];}

if(mysqli_num_rows ($sql1) > 0)
{
$_SESSION['login'] = $login;
$_SESSION['password'] = $password;
$_SESSION['nome'] = $nome;
header('location:/controle/system');
}
else
{
unset ($_SESSION['login']);
unset ($_SESSION['password']);
unset ($_SESSION['nome']);
header('location:/controle/?error=1');
}

?>