<?php
error_reporting (E_ALL & ~ E_NOTICE & ~ E_DEPRECATED); /* tramento de advertencia para que não exiba*/
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_painel_config = "localhost";
$database_painel_config = "imobi";
$username_painel_config = "root";
$password_painel_config = "vertrigo";
$painel_config = mysql_pconnect($hostname_painel_config, $username_painel_config, $password_painel_config) or trigger_error(mysql_error(),E_USER_ERROR);
?>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
troquei essa conxeção acima mysql por essa abaixo mysqli...porem meu sistema de login parou de funcionar até agora não conseguir resolver. aparesce a seguinte mesangem, "Access denied for user ''@'localhost' (using password: NO)"
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?php
$host = "localhost";
$usuario = "root";
$senha = "vertrigo";
$bb = "imobi";
$mysqli = new mysqli($host, $usuario, $senha, $bb);
if($mysqli->connect_errno)
echo "Falha na conexão;(".$mysqli->connect_errno.") ".$mysqli->connect_error;
//ini_set('display_errors',false);
?>
---------------------------------------------------------------------------------------------------------------------------------------------
abaixo codigo do sistema de login. desde já agradeço ajuda...
<?php require_once ('Connections/conexao.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['senha'];
$MM_fldUserAuthorization = "usuarioNivel";
$MM_redirectLoginSuccess = "admin/painel.php";
$MM_redirectLoginFailed = "admin/erro.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_painel_config, $painel_config);
$LoginRS__query=sprintf("SELECT email, senha, usuarioNivel FROM quimovel_clientes WHERE email=%s AND senha=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $painel_config) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,,'usuarioNivel');
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8"/>
<title>site</title>
<link rel="stylesheet" type="text/css" href="estilo-login.css">
<?php include "Connections/config.php";?>
<?php include "js/scripts.php"; ?>
<?php include "funcoes.php"; ?>
</head>
<body>
<body>
<div id="box">
<div id="header">
<div id="header_topo">
<a href="index.php"><img src="images/qui-logo.png" alt="Home" title="home"/></a>
<ul>
<li><a href="index.php?pg=cidades">Comprar</a></li>
<li><a href="index.php?pg=anunciar">Cadastrar</a></li>
<li><a href="index.php?pg=contatos">Contatos</a></li>
</ul>
</div>
</div>
<section id="corpologin">
<fieldset>
<legend>Fazer Login</legend>
<form name="central_anunciante" action="<?php echo $loginFormAction; ?>" method="POST">
<label>
<input type="text" name="usuario" placeholder="Digite seu E-mail" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"/> </label>
<label> <span class="senha_txt"></span>
<input type="password" name="senha" class="senha" placeholder="Digite sua senha"required="required" maxlength="100" />
<p><a href="index.php?pg=contatos">Esqueci minha senha</a></p>
</fieldset>
<fieldset id="btn">
<input type="submit" name="Enviar" Value="Entrar" class="btn"/>
</fieldset>
</label>
</form>
</section>
</div>
<footer id="rodape">
</Footer>
</body>