//$dba = new mysqli($config['database']['hostname'], $config['database']['username'], $config['database']['password'], $config['database']['database']);
$config2['database']['type'] = 'mysql';
$config2['database']['database'] = 'helloweb4';
$config2['database']['table_prefix'] = 'mybb_';
$config2['database']['hostname'] = 'sql.helloweb.home.pl';
$config2['database']['username'] = 'helloweb4';
$config2['database']['password'] = '.d9WHC1gQEY';
$linksb = mysql_connect($config2['database']['hostname'], $config2['database']['username'], $config2['database']['password']);
mysql_select_db($config2['database']['database'], $linksb);
$sbrooms = array();
$hos = array();
$sqlhos=mysql_query("SELECT `uid`, `usergroup` FROM `mybb_users` WHERE `usergroup` = 20 ORDER BY `uid` DESC");
while($wynikhos = mysql_fetch_array($sqlhos)) {
array_push($hos, $wynikhos['uid']);
}
$sqlsb=mysql_query("SELECT * FROM `mybb_mysb_shouts` WHERE `shout_msg`
while($wyniksb = mysql_fetch_array($sqlsb)) {
$uid = $wyniksb['uid'];
$pattern = '/roomid=[~0-9A-Za-z]*/';
if(preg_match($pattern, $wyniksb['shout_msg'], $matches)) {
$roomid = substr($matches[0], -64);
foreach($rooms as $key=>$val){
if(preg_match("#$roomid#", $val['id'])){
foreach($sbrooms as $key2=>$val2){
if(preg_match("#$roomid#", $val2['id'])){
$nie = 1;
}
}
if($nie == 0) {
$sbrooms[] = array(
'ver' => $val['ver'],
'id' => $val['id'],
'name' => $val['name'],
'players' => $val['players'],
'max_players' => $val['max_players'],
'password' => $val['password'],
'country' => $val['country'],
'latitude' => $val['latitude'],
'longitude' => $val['longitude'],
'distance' => $val['distance'],
'shoutuid' => $wyniksb['uid']
);
}
$nie = 0;
}
}
}
}
$roomssb = '<ul class="nav profile-sidenav" id="profile-sidenav" style="width:100%; margin-top:0; text-align: left;">
<li class="active" style="color: white;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
background-image: url(../images/ababab.png);margin: 0 0 -1px;
padding: 8px 14px;
border: 1px solid #E5E5E5;"><i class="icon-play pull-right" style="margin: 3px 0"></i> Zagraj z nami!</li>';
foreach($sbrooms as $klucz=>$war) {
$roomssb .= '<li class="" style="margin: 0 0 -1px;
padding: 8px 14px;
border: 1px solid #E5E5E5;"><span class="smalltext">
';
if(in_array($war['shoutuid'], $hos) && (preg_match("#pl-hb#", $war['name']) || preg_match("#PL-HB#", $war['name']))) {
$roomssb .= '<i class="icon-star pull-right" style="margin: 10px 0px 0 0;" data-rel="tooltip" data-placement="left" title="Oficjalny pokój PL-HB"></i>';
}
if($war['password'] == 1) {
$roomssb .= '<i class="icon-lock pull-right" style="margin: 10px 0px 0 0;" data-rel="tooltip" data-placement="left" title="Pokój chroniony hasłem"></i>
<div style="margin-top: 3px;float: left;line-height: 15px;"><p class="ellipsis" style="width: 220px;"><a href="http://www.haxball.com/?roomid='.$war['id'].'&pass=1">'.$war['name'].'</a><p>';
} else {
$roomssb .= '<div style="margin-top: 3px;float: left;line-height: 15px;"><p class="ellipsis" style="width: 220px;"><a href="http://www.haxball.com/?roomid='.$war['id'].'">'.$war['name'].'</a></p>';
}
$roomssb .= '<span style="font-size: 12px;"><span class="muted">Liczba graczy: </span>'.$war['players'].'/'.$war['max_players'].'</span></div><br style="clear:both;"></span></li>
';
}
if(!$sbrooms) {
$roomssb .= '<li class="muted" style="margin: 0 0 -1px;
padding: 8px 14px;
border: 1px solid #E5E5E5;">
Teraz nie gramy na żadnym pokoju.
<i class="icon-info-sign pull-right" style="margin-top:3px; margin-right:-1px;" data-placement="left" data-rel="tooltip" data-original-title="Jeśli chcesz, aby twój pokój pojawił się na tej liście, wyślij na shoutboxie odnośnik do niego. Pąmiętaj, że pokój nie może być ukryty!" data-placement="left"></i>
</li>
';
}
$roomssb .= '</ul>';