Tengo 2 problemas que aparecen al inicio de mi sitio, y son los siguientes:
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home1/j8f5w8o7/nepe.smeext-carding.com/pieces/inc.php on line 26 Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home1/j8f5w8o7/nepe.smeext-carding.com/pieces/inc.php on line 27
Este es mi codigo:
<?php
session_start();
ob_start();
$display = new display();
$user = new user();
DEFINE("localhost", "");
DEFINE("j8f5w8o7_finix", "");
DEFINE("yael2204", "");
DEFINE("j8f5w8o7_finix", "");
$sql = new mysqli(host, username, password, database);
function __destruct()
{
ob_clean();
}
class settings
{
public static function website($data)
{
global $sql;
$website = mysqli_query($sql, 'SELECT * FROM merchant LIMIT 1');
$fwebsite = mysqli_fetch_array($website);
return $fwebsite[$data];
}
}
class display {
public static function success($msg)
{
echo('<div class="alert alert-success role="alert" style="text-align: center;">'.$msg.'</div>');
}
public static function error($msg)
{
echo('<div class="alert alert-danger role="alert" style="text-align: center;">'.$msg.'</div>');
}
}
class user {
function IsLogged()
{
global $sql;
/* If session exists. */
if(!isset($_SESSION['auth'])){
header('Location: signin.php');
exit();
}
/* Additional check.If session is null or user does not exists. */
if(isset($_SESSION['auth'])) {
if(is_numeric($_SESSION['auth']) && !empty($_SESSION['auth'])) {
$query = mysqli_query($sql, 'SELECT UserName FROM users WHERE UserID = "'.$_SESSION['auth'].'"');
if(mysqli_num_rows($query) == 0) {
unset($_SESSION['auth']);
header('Location: signin.php');
exit();
}
}
}
}
function IsBanned()
{
$banned = $this->GetData('UserBanned');
if($banned == 1) {
header('Location: ./index.php');
exit();
}
}
function IsAdmin()
{
if($this->GetData('UserAdmin') == 0) {
header('Location: ./index.php');
exit();
}
}
function HasMembership()
{
if($this->GetData('UserMembership') == 0) {
header('Location: ./purchase.php');
exit();
}
}
function GetData($data)
{
global $sql;
if(isset($_SESSION['auth'])) {
$id = $_SESSION['auth'];
if(is_numeric($id)) {
$query = mysqli_query($sql, 'SELECT '.$data.' FROM users WHERE UserID = "'.$id.'"');
$row = mysqli_fetch_array($query);
return $row[$data];
}
}
}
}
DEFINE ("NOMBRE_CONSTANTE", "VALOR_CONSTANTE");
por eso la conexión no reconoce las credenciales (usuario, password, etc) que crees estarle pasando.