Kacper Wojciechowski
- Mentor MyBB
- 858 119 156 43
Witam, mam problem z PHP (no znowu... xd), pętla foreach wyświetla tylko 1 wynik
http://wrt.xaa.pl/home.php
Jest 10 graczy na serwerze a wyświetla tylko 1
http://wrt.xaa.pl/home.php
Jest 10 graczy na serwerze a wyświetla tylko 1
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body id="panel">
{$header}
<br />
<div class="thead">
<ul class="menu_gorne">
<li><a class="activeMenu" href="home.php">Strona Główna</a></li>
<li><a href="szukajgracza.php">Gracze</a></li>
<li><a href="#">TOP Listy</a></li>
<li><a href="#">Gangi</a></li>
<li><a href="sklad.php">Skład</a></li>
</ul>
</div>
<div class="info_podglad">
<div class="calosc_podglad">
<div class="lewa_podglad">
<ul class="tabs">
<li class="active"><a href="home.php">Gracze OnLine</a></li>
<li><a href="staty.php">Statystyki</a></li>
<li style="border-bottom: none !important;"><a href="bany.php">Bany</a></li>
</ul>
</div>
<div style="margin-top: 100px;" class="prawa_podglad">
<div class="tab_container">
<div style="display: block;" id="tab1" class="tab_content">
<div class="thead">
<div style="margin-top: 5px;"><strong>Gracze OnLine</strong></div>
</div>
<?php
$adres_ip_serwera_mysql_z_baza_danych = 'mysql-fr1.ServerProject.pl';
$nazwa_bazy_danych = 'xxxx';
$login_bazy_danych = 'xxxx';
$haslo_bazy_danych = 'xxxx';
if ( !mysql_connect($adres_ip_serwera_mysql_z_baza_danych,
$login_bazy_danych,$haslo_bazy_danych) ) {
echo 'Nie moge polaczyc sie z baza danych';
exit (0);
}
if ( !mysql_select_db($nazwa_bazy_danych) ) {
echo 'Blad otwarcia bazy danych';
exit (0);
}
require "panel/SampQueryAPI.php";
$query = new SampQueryAPI('80.88.90.213', '7777');
if($query->isOnline())
{
$aInformation = $query->getInfo();
$aServerRules = $query->getRules();
$aPlayers = $query->getDetailedPlayers();
if(!is_array($aPlayers) || count($aPlayers) == 0)
{
echo '<center><br><br><b>Brak graczy na serwerze! :(</b></center>';
}
else
{
foreach($aPlayers as $sValue)
echo "<table class=\"tborder\"><tbody><tr>";
echo "<td class=\"tcat\" width=\"5%\" align=\"center\">ID</td>";
echo "<td class=\"tcat\" align=\"center\">Nick</td>";
echo "<td class=\"tcat\" width=\"10%\" align=\"center\">Exp</td>";
echo "</tr>";
{
$query = "SELECT * FROM Admins WHERE Nick='".htmlentities($sValue['nickname'])."'";
$reputationlevel = mysql_query($query);
$row = mysql_fetch_row($reputationlevel);
echo "</tr>";
echo "<td class=\"trow1\" align=\"center\">".$sValue["playerid"]."</td>";
echo "<td class=\"trow1\" align=\"center\"><a href=\"wyszukanygracz.php?nick=".htmlentities($sValue['nickname'])."\">";
if($row[1] == 9)
{
echo "<span style=\"text-shadow: 0px 0px 10px #FF0000; color: #FF0000;\"><i class=\"fa fa-star\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 8)
{
echo "<span style=\"text-shadow: 0px 0px 10px #94d2f2; color: #94d2f2;\"><i class=\"fa fa-database\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 7)
{
echo "<span style=\"text-shadow: 0px 0px 10px #FF8000; color: #FF8000;\"><i class=\"fa fa-star-half-o\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1]== 6)
{
echo "<span style=\"text-shadow: 0px 0px 10px #964e2e; color: #964e2e;\"><i class=\"fa fa-send\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 5)
{
echo "<span style=\"text-shadow: 0px 0px 10px #66FFFF; color: #66FFFF;\"><i class=\"fa fa-tint\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 4)
{
echo "<span style=\"text-shadow: 0px 0px 10px #124DFF; color: #124DFF;\"><i class=\"fa fa-leaf\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 3)
{
echo "<span style=\"text-shadow: 0px 0px 10px #8060a9; color: #8060a9;\"><i class=\"fa fa-gift\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 2)
{
echo "<span style=\"text-shadow: 0px 0px 10px #37DB45; color: #37DB45;\"><i class=\"fa fa-cog\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 1)
{
echo "<span style=\"text-shadow: 0px 0px 10px #6ab09c; color: #6ab09c;\"><i class=\"fa fa-puzzle-piece\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
if($row[1] == 0)
{
echo "<span style=\"text-shadow: 0px 0px 10px #D0E8FF; color: #D0E8FF;\"><i class=\"fa fa-user\"></i> ".htmlentities($sValue['nickname'])."</span>";
}
echo "</a></td>";
echo "<td class=\"trow1\" align=\"center\">".$sValue["score"]."</td>";
echo "<tr>";
echo "</tbody></table>";
}
}
}
else
{
echo '<center><br><br><b>Brak graczy na serwerze! :(</b></center>';
}
if ( !mysql_close() ) {
echo 'Nie moge zakonczyc polaczenia z baza danych';
exit (0);
}
?>
</table>
</div> </div> </div> </div>
</div>
</div>
</div>
<br>
<div id="board_footer"><p id="copyright"> 2015 <b>X3nO, Panel Version: 1.0</b></p></div>
{$footer}
</body>
</html>