MyBB Community Forums

Full Version: Game Section: Line 723 of functions_games.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

Quick error here: mt_rand(): max(-1) is smaller than min(0)

I am running PHP 5.3.10 and have tried changing the code to fix it, but that breaks the random game selector. Is there a line that I should change in the PHP.ini file?
Perhaps you could post this on the Game Section's own support forum? There is activity there - there was a new update to Game Section this month.
Open functions_games.php and find:
		for($i = 1; $i <= $games_core->settings['stats_randomgames_max']; $i++)
		{
			$id = mt_rand(0, count($games)-1);
			eval("\$randomgames_bit .= \"".$games_core->template("games_stats_randomgames_bit")."\";");
		}

Replace with:
		if(($countgames = count($games)) > 0)
		{
			for($i = 1; $i <= $games_core->settings['stats_randomgames_max']; $i++)
			{
				$id = mt_rand(0, $countgames-1);
				eval("\$randomgames_bit .= \"".$games_core->template("games_stats_randomgames_bit")."\";");
			}
		}
I never noticed the updates. It seemed I remembered their forums being pretty dead. Guess I was wrong. I better update to fix the XSS vuln.

Thanks Omar!