• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

How fix this Warning

kaparzo231

New Member
Joined
Mar 22, 2022
Messages
29
Solutions
1
Reaction score
4
Location
Poland
GitHub
XxX
I have this warning When I go to the ots website (localhost)

Warning.png

Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\layouts\tibiacom\layout.php on line 543

layout.php:


PHP:
if($config['site']['screenoftheday'] == 1)
echo '<div id="ScreenshotBox" class="Themebox" style="background-image:url('.$layout_name.'/images/themeboxes/screenshot/screenshotbox.gif);">
      <a href="?subtopic=gallery" >
        <img id="ScreenshotContent" class="ThemeboxContent" src="images/screenshotoftheday.gif" alt="Screenshot of the Day" /></a>
    <div class="Bottom" style="background-image:url('.$layout_name.'/images/general/box-bottom.gif);"></div>
    </div>';
?>
<?PHP
$time = time();
$viewpoll = $SQL->query('SELECT * FROM z_polls where end > '.$time.' ORDER BY id DESC LIMIT 1');
foreach($viewpoll as $p)
$polls .= '<center>'.$p['question'].'</center>';
    if(count($p['id']) > 0)      // Warning on this line
     echo '<div id="CurrentPollBox" class="Themebox" style="background-image:url('.$layout_name.'/images/themeboxes/current-poll/currentpollbox.gif);">
      <div id="CurrentPollText">'.$polls.'</div>
      <a class="ThemeboxButton" href="?subtopic=polls&id= '.$p['id'].'" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif);"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);"></div>
        <div class="ButtonText" style="background-image:url('.$layout_name.'/images/buttons/_sbutton_votenow.gif);"></div>
      </a>
    <div class="Bottom" style="background-image:url('.$layout_name.'/images/general/box-bottom.gif);"></div>
    </div>';
?>

How can I fix it?

Thanks in advance
 
Solution
in your index.php add

Lua:
// comment to show E_NOTICE [undefinied variable etc.], comment if you want make script and see all errors
error_reporting(0);

djblah

Active Member
Joined
Oct 15, 2010
Messages
118
Solutions
2
Reaction score
25
in your index.php add

Lua:
// comment to show E_NOTICE [undefinied variable etc.], comment if you want make script and see all errors
error_reporting(0);
 
Solution
Top