Hey,
Beim Register im TheoCMS tritt bei mir folgender Fehler auf:
Fatal error: Uncaught Error: Call to a member function fetch() on boolean in configurations.php:31
Wie behebe ich diesen, bzw was ist die Ursache?
Code
Zeile 30: $TableConfigurations = $bdd->query('SELECT * FROM cms_configurations');
Zeile 31: $DetailsTableConfigurations = $TableConfigurations->fetch();
PHP
<?php
date_default_timezone_set('Europe/Paris');
require_once('configurations/connexion-bdd.php');
session_start();
if(isset($_SESSION['id']))
{
$TableUsers = $bdd->prepare('SELECT * FROM users WHERE id = ?');
$TableUsers->execute(array($_SESSION['id']));
if($TableUsers->rowCount() == 1)
{
$DetailsTableUsers = $TableUsers->fetch(PDO::FETCH_ASSOC);
$_SESSION['id'] = $DetailsTableUsers['id'];
$_SESSION['pseudo'] = $DetailsTableUsers['username'];
$_SESSION['email'] = $DetailsTableUsers['mail'];
$_SESSION['ip'] = $DetailsTableUsers['ip_last'];
$_SESSION['fonctions'] = $DetailsTableUsers['fonctions'];
$_SESSION['jetons'] = $DetailsTableUsers['jetons'];
$_SESSION['radio'] = $DetailsTableUsers['radio'];
$_SESSION['staffclub'] = $DetailsTableUsers['staffclub'];
$_SESSION['rank'] = $DetailsTableUsers['rank'];
$_SESSION['look'] = $DetailsTableUsers['look'];
$_SESSION['online'] = $DetailsTableUsers['online'];
$_SESSION['block_newfriends'] = $DetailsTableUsers['block_newfriends'];
$_SESSION['hide_online'] = $DetailsTableUsers['hide_online'];
$_SESSION['radio'] = $DetailsTableUsers['radio'];
}
}
$TableConfigurations = $bdd->query('SELECT * FROM cms_configurations');
$DetailsTableConfigurations = $TableConfigurations->fetch();
if(isset($_SESSION['id']))
{
if($DetailsTableConfigurations['maintenance'] == "oui")
{
if($_SESSION['rank'] <= 4)
{
header('Location: '.htmlspecialchars(trim($DetailsTableConfigurations['lien_site'])).'/maintenance');
exit();
}
}
}
else
{
if($DetailsTableConfigurations['maintenance'] == "oui")
{
header('Location: '.htmlspecialchars(trim($DetailsTableConfigurations['lien_site'])).'/maintenance');
exit();
}
}
if(isset($_SESSION['id']))
{
$TableAmis = $bdd->prepare('SELECT COUNT(*) AS id FROM messenger_friendships WHERE user_one_id = ? OR user_two_id = ?');
$TableAmis->execute(array($_SESSION['id'], $_SESSION['id']));
$DetailsTableAmis = $TableAmis->fetch(PDO::FETCH_ASSOC);
$TableApparts = $bdd->prepare('SELECT COUNT(*) AS id FROM rooms WHERE owner = ?');
$TableApparts->execute(array($_SESSION['id']));
$DetailsTableApparts = $TableApparts->fetch(PDO::FETCH_ASSOC);
$TableBadges = $bdd->prepare('SELECT COUNT(*) AS id FROM user_badges WHERE user_id = ?');
$TableBadges->execute(array($_SESSION['id']));
$DetailsTableBadges = $TableBadges->fetch(PDO::FETCH_ASSOC);
}
$TableBans = $bdd->prepare("SELECT * FROM bans WHERE value = ?");
$TableBans->execute(array($_SERVER["REMOTE_ADDR"]));
$DetailsTableBans = $TableBans->fetch(PDO::FETCH_ASSOC);
$ban = array($DetailsTableBans['value']);
$ip = htmlspecialchars($_SERVER['REMOTE_ADDR']);
$stamp_now = time(date('H:i:s d-m-Y'));
$stamp_expire = $DetailsTableBans['expire'];
if(in_array($ip, $ban))
{
if($stamp_now < $stamp_expire)
{
header('Location: '.htmlspecialchars(trim($DetailsTableConfigurations['lien_site'])).'/banni');
exit();
}
}
if(isset($_SESSION['id']))
{
$TableBans = $bdd->prepare("SELECT * FROM bans WHERE value = ?");
$TableBans->execute(array($_SESSION['pseudo']));
$DetailsTableBans = $TableBans->fetch();
$stamp_now = time(date('H:i:s d-m-Y'));
$stamp_expire = $DetailsTableBans['expire'];
if($stamp_now < $stamp_expire)
{
session_destroy();
header('Location: '.htmlspecialchars(trim($DetailsTableConfigurations['lien_site'])).'/index');
exit();
}
}
$injection = 'INSERT|UNION|SELECT|NULL|COUNT|FROM|LIKE|DROP|TABLE|WHERE|COUNT|COLUMN|TABLES|INFORMATION_SCHEMA|OR';
foreach($_GET as $getSearchs)
{
$getSearch = explode(" ",$getSearchs);
foreach($getSearch as $k=>$v)
{
if(in_array(strtoupper(trim($v)),explode('|',$injection)))
{
exit;
}
}
}
?>
Alles anzeigen