-1
I’m having problems with Login No error appears, but it seems that the program stops when trying to select
<?php
ob_start();
session_start();
include("conn.php");
$conexao = getConnection();
$referer = $_POST['referer']; /*redirlogin*/
$usuario=$_POST['usuario'];
$senha = $_POST['senha'];
$lembrar = $_POST['lembrar'];
//-------------------------------- COOKIE ini ------------------------------------
if($_COOKIE["usuario_PROJECT"] == '' && $_COOKIE["senha_PROJECT"] == ''){
//-------------------------- COOCKIE ---------------------------------------
if($lembrar == 1){
setcookie("usuario_PROJECT",$_SESSION['usuario'], time()+60*60*24*365, '/');
setcookie("senha_PROJECT",$_SESSION['senha'], time()+60*60*24*365, '/');
}else{
setcookie("usuario_PROJECT",$_SESSION['usuario']);
setcookie("senha_PROJECT",$_SESSION['senha']);
}
//cookie('web', 'ano', time()+1000, '/', '.luxweb.sk')
}
//setcookie("usuario_PEM", $_SESSION['usuario'], time()+60*60*24*365, "/coluna/php/", "www.imasters.com.br",1);
//-------------------------------- COOKIE fim ------------------------------------
?>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> Autenticando Usuario </title>
</head>
<body>
Maybe this is the part:
<?php
$sql2 = "SELECT * FROM login_tab WHERE usuario = :usuario AND senha = :senha";
$stmt = $conexao->prepare($sql2);
$stmt = bimdParam(':usuario',$usuario);
$stmt = bimdParam(':senha',$senha);
$stmt->execute();
$result = $stmt->fetchAll();
//$row = $stmt->rowCount();
foreach($result as $ln)
{
$perfil = $ln['perfil'];
echo $ativo = $ln['ativo'];
}
if($ativo == 1){
$_SESSION['usuario']=$_POST['usuario'];
$_SESSION['senha']=$_POST['senha'];
//-------------------------- COOCKIE ---------------------------------------
if($lembrar == 1){
setcookie("sistema_project_cookie_login", $_SESSION['usuario'], time()+ 31536000);
setcookie("sistema_project_cookie_senha", $_SESSION['senha'], time()+ 31536000);
}else{
setcookie("sistema_project_cookie_login", $_SESSION['usuario']);
setcookie("sistema_project_cookie_senha", $_SESSION['senha']);
}
//-------------------------- COOCKIE ---------------------------------------
/* redirlogin */
if($referer == ""){
echo"<script>location.href = 'index.php'</script>";}
else {
echo"<script>location.href =".$referer."'</script>";
}
}
else{
echo '<script language= "JavaScript">location.href="login.php#erro'.$perfil.'"</script>';
}
?>
</body>
</html>
From now on Thank you
I had placed the echo to see if you got the information, but not this. none of the alternatives worked :/
– rubo