require_once('conexao.php');
@$email = $_POST['email'];
@$senha = md5($_POST['senha']);
// $email = "[email protected]";
// $senha = "12346";
$pdo = $dbconn->prepare("SELECT userid, nome, nivel FROM usuario WHERE email=:email and senha=:senha");
$pdo->bindParam(":email", $email);
$pdo->bindParam(":senha", $senha);
$pdo->execute();
// print_r ($pdo);
$users = $pdo->fetchAll(PDO::FETCH_ASSOC);
if (count($users) <= 0)
{
echo "<script>alert('Email ou senha errados');
top.location.href='./index.php';
</script>";
exit;
}
// pega o primeiro usuário
$user = $users[0];
session_start();
$_SESSION['logged_in'] = true;
$_SESSION['userid'] = $user['userid'];
$_SESSION['username'] = $user['nome'];
$_SESSION['usernivel'] = $user['nivel'];
// print_r ($_SESSION);
// echo session_id();
header('Location: ./_link/link.php');
I want to return id
on another page to make a insert
in the bank
session_start();
print_r($_SESSION);
if(!$_SESSION) {
header("Location: .././index.php");
exit;
}