1
Speaks beauty person? So I’m about three days into this code. All mysql obsolence errors disappear, and I can navigate normally through the administrator area. However, when leaving the area and trying to enter again, he alerts me with 'Access Denied' In other words, in this game of changing bugged something that made the system not accept my login... I’ve been trying to clean up for hours, and nothing, so can someone read the files and see if you can find anything? Hugs.
Home.php:
$usuario_id = $_SESSION['usuario_id'];
$usuario_nome = $_SESSION['usuario_nome'];
}
?>
<?php
// PEGA OS DADOS DO USUÁRIO
$query = "SELECT * FROM tbl_usuarios where id = '$usuario_id'";
$resultado = mysqli_query ($conexao, $query);
$campo = mysqli_fetch_array ($resultado);
$usuario_nome = $campo ['nome'];
$sign = "ike3da";
?>
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Área Administrativa</title>
</head>
<style type="text/css">
body { width: 100%; margin:0; padding:0; background-color:#000; text-align:center; background: url(imags/bg-topo.png) center top no-repeat; font: 12px tahoma; color:#FFF; }
#topo-2 { margin: 0 auto; height: 260px; }
#banner { margin: 0 auto; width: 410px; height: 253px; background-image:url(imags/logo.png);}
/* ------------- */
#bemvindo { margin: 0 auto; margin-top: 10px; width: 300px; height: 40px; background: url(imags/bg-png.png) repeat; }
#menuadmin { margin: 0 auto; width: 100%; height: 45px; margin-top: 20px; background: url(imags/bg-png.png) repeat;}
#menuzin { margin: auto; width: 820px; margin-right: 10px; margin-top: 10px;}
ul.menuadmin2 { text-align: center; margin-top: 10px; margin-right:100px;}
ul.menuadmin2 li { padding: 0 50px 0 20px; display: inline;}
ul.menuadmin2 li a { text-decoration: none; font: bold 12px Tahoma, Arial; color:#d4d4d4; }
ul.menuadmin2 li a:hover { text-decoration: none; font: bold 12px Tahoma, Arial; color:#d5872d; }
/*---------------*/
#sistems { width: 80%; margin: 0 auto; margin-top: 10px; background:url(imags/bg-png.png) repeat; }
#baixo { width: 100%; height: 100px; margin-top: 40px; }
#baixo a { text-decoration:none; color:#CCC; }
#baixo a:hover { text-decoration:none; color:#F90; }
#baixo a:visited { text-decoration:none; color:#BBB; }
#quadro { margin:0 auto; width: 350px; background-color:#050505; border:#070707 1px solid; }
</style>
<body>
<div id="body2">
<div id="topo-2">
<div id="banner"></div>
</div>
<div id="bemvindo">
<div style="height:10px;"></div>
<span style="font: 15px tahoma; ">Seja bem-vindo, <b><?php echo "$usuario_nome"; ?></b>.</span>
</div>
<div id="menuadmin">
<div style="height:5px;"></div>
<ul class="menuadmin2">
<li><a href="?pg=noticias_cadastrar">Cadastrar Notícia</a></li>
<li><a href="?pg=noticias_listar">Listar Notícias</a></li>
<li><a href="logout.php">Sair</a></li>
</ul>
</div>
<div id="sistems">
<?php include "pages.php"; ?>
</div>
<div id="baixo">
<div id="quadro">
<div style="height:10px;"></div>
<div style="height:10px;"></div>
</div>
</div>
</div>
</body>
</html>
php connection.:
<?php
$conexao = mysqli_connect('localhost', 'root', 'wamp', 'noticias');
if($conexao){
if (mysqli_select_db($conexao, 'noticias')){ print "";
}else{ print "Não foi possível selecionar o Banco de Dados"; }
}else{ print "Erro ao conectar o MySQL"; }
?>
Autenticacao.rotinas.php:
<?php
session_start();
include ("../config/conexao.php");
$cliente_username = $_POST["usuario"];
$cliente_password = $_POST["senha"];
$enviado = $_POST["enviado"];
if ($enviado == "posted"){
if (!isset($cliente_username) or !isset($cliente_password)) { echo "Erro!"; exit; }
if (empty($cliente_username) or empty($cliente_password)) { echo "Dados inválidos!"; exit; }
$query = "select * from tbl_usuarios where login = '$cliente_username' and senha = '$cliente_password'";
$result = mysqli_query($conexao, $query);
$number = mysqli_num_rows($result);
if ($number==0) { ?><script>alert('Dados incorretos! Tente novamente.');history.back();</script>
<?php
exit;
} else {
$_SESSION['usuario_id'] = mysql_result($result,0,'id');
$_SESSION['usuario_nome'] = mysql_result($result,0,'nome');
?><script>document.location = '../principal.php'</script><?php
}
mysqli_close($conexao);
}
?>
Just perfect! Broke a branch brother! You’re awesome!!
– GGirotto
You can accept this answer. How and why to accept an answer?
– Lucas