Hey! I got a problem with a script http://otland.net/f118/gesior-acc-best-counters-nice-look-128185/ I got this error at the site when I try to test it out
and I want it to be at latestnews page ONLY!
When you enter the site
Then you can see it on the latest news.
I dont want like a page for it.
So if you can put it in my latest news.
So if you could add this Top Countries to my latest news code it would be great!
here is languages.php code
Regards W
Code:
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\languages.php on line 3
and I want it to be at latestnews page ONLY!
When you enter the site
Then you can see it on the latest news.
I dont want like a page for it.
So if you can put it in my latest news.
So if you could add this Top Countries to my latest news code it would be great!
here is languages.php code
Code:
<?php
$players = $SQL->query("SELECT `level`, `account_id` FROM `players`;")->fetchAll(); $countriesCount = 0; $countriesTop = $config["languages"];
foreach ($countriesTop as $countryName => $countryFile) $countriesTop[$countryName] = 0;
foreach ($players as $playerData)
{
$accountData = $SQL->query("SELECT `location` FROM `accounts` WHERE `id` = \"".$playerData["account_id"]."\";")->fetch();
$countriesTop[$accountData["location"]] += $playerData["level"];
}
arsort($countriesTop); $countCountries = 0;
$main_content .= '<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
<table border="0">
<tr>
<td style="text-align: center; font-weight: bold;">
<font color="white"><center>Best Countries</center></font>
</td>
</tr>
</table>
</div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
<tr>';
foreach ($countriesTop as $countriesName => $countriesCount)
{
$countCountries = $countCountries + 1;
$backgroundColor = is_int($playerCount / 2) ? $config["site"]["darkborder"] : $config["site"]["lightborder"]; $playerCount++;
if ($countCountries <= 3)
{
$backgroundColor = is_int($countCountries / 2) ? $config["site"]["darkborder"] : $config["site"]["lightborder"];
$main_content .= "<td bgcolor=\"".$backgroundColor."\" width=\"33%\"><center><img src=\"/images/flags/".$config["languages"][$countriesName]."\"><h2 style=\"margin-bottom:-10px;\">".$countriesName."</h2><br><font style=\"color:red; font-size:16pt; font-weight:bold;\">#".$countCountries."</font><br><br><font style=\"font-weight:bold; font-size:12pt;\">Points: ".$countriesCount."</font></center>";
$main_content .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width=\"100%\" style=\"border:1px solid #5f4d41;\">"; $playerCount = 0;
$playerData = $SQL->query("SELECT `name`, `level` FROM `players` WHERE `account_id` IN (SELECT `id` FROM `accounts` WHERE `location` = \"".$countriesName."\") ORDER BY `level`;")->fetchAll();
$count = 0; for($i = 0; $i <= 5; $i++)
{
$player = $playerData[$i];
$backgroundColor2 = is_int($count / 2) ? $config["site"]["darkborder"] : $config["site"]["lightborder"]; $count++;
if (isset($player["level"]) and isset($player["name"]))
$main_content .= "<tr bgcolor=\"".$backgroundColor2."\"><td><a href=\"?subtopic=characters&name=".urlencode($player["name"])."\">".$player["name"]."</a><b> [level ".$player["level"]."]</b></td></tr>";
else
$main_content .= "<tr bgcolor=\"".$backgroundColor2."\"><td> </td></tr>";
}
$main_content .= "</table></td>";
if ($countContries == 3) $main_content .= "</tr></table>";
}
else
{
if ($countCountries >= $config["site"]["maxlangs"] or $countriesCount == 0) break;
if ($countCountries == 4) $main_content .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width=\"100%\"><tr bgcolor=\"".$config['site']['vdarkborder']."\"><td class=\"white\" width=\"100%\" colspan=\"3\"><b>Best Countries on ".$config["server"]["serverName"]."</b></td></tr>";
$main_content .= "<tr bgcolor=\"".$backgroundColor."\"><td width=\"10%\"><center><font style=\"color:red; font-size:16pt; font-weight:bold;\">#".$countCountries."</font></center></td><td width=\"30%\"><img src=\"/images/flags/".$config["languages"][$countriesName]."\" style=\"float:left; margin-top:8px; margin-left:5px;\"><h2> ".$countriesName."</h2></td><td width=\"60%\">";
$playerData = $SQL->query("SELECT `name`, `level` FROM `players` WHERE `account_id` IN (SELECT `id` FROM `accounts` WHERE `location` = \"".$countriesName."\") ORDER BY `level`;")->fetchAll();
for($i = 0; $i <= 5; $i++)
{
$player = $playerData[$i];
if (isset($player["level"]) and isset($player["name"]))
$main_content .= "<a href=\"?subtopic=characters&name=".urlencode($player["name"])."\">".$player["name"]."</a><b> [level ".$player["level"]."]</b> ";
}
$main_content .= "</td></tr>";
}
}
$main_content .= "</table>";
?>
Regards W