示例#1
0
文件: index.php 项目: cbsistem/nexos
function SaveStats($servers, $server_id, $GSgame, $data)
{
    global $db, $prefix;
    $stamp = time();
    if ($GSgame == "all" and $server_id == "all") {
        foreach ($servers as $k => $v) {
            $play = explode("/", PlayerCount($servers, $k, $data));
            $map = addslashes(CurrentMap($servers, $k, $data));
            $sname = addslashes(ServerName($servers, $k, $data));
            $ping = $data[$k]['custom']['ping'];
            $sql = "UPDATE `" . $prefix . "_gameservers_statcache` set sname='{$sname}',numplayers='{$play['0']}',maxplayers='{$play['1']}',map='{$map}',ping='{$ping}',stamp='{$stamp}' WHERE server_id = {$k}";
            if ($sname) {
                $db->sql_query($sql);
            }
        }
    } else {
        $play = explode("/", PlayerCount($servers, $data[$GSgame]['custom']['id'], $data));
        $map = addslashes(CurrentMap($servers, $data[$GSgame]['custom']['id'], $data));
        $sname = addslashes(ServerName($servers, $data[$GSgame]['custom']['id'], $data));
        $ping = $data[$GSgame]['custom']['ping'];
        $db->sql_query("INSERT INTO `" . $prefix . "_gameservers_statcache` (`server_id`,`sname`,`numplayers`,`maxplayers`,`map`,`ping`,`stamp`) VALUES ('" . $server_id . "','" . $sname . "','" . $play[0] . "','" . $play[1] . "','" . $map . "','" . $ping . "','" . $stamp . "')");
    }
}
						<th>Server</th>
						<th style="text-align:center;">Connections</th>
						<th style="text-align:center;">Unique Players</th>
					</tr>
				</thead>
				<tbody>
<?php 
foreach ($connections as $connections) {
    ?>
					<tr>
						<td><?php 
    echo $connections['time'];
    ?>
</td>
						<td><?php 
    echo ServerName($connections['server_ip']);
    ?>
</td>
						<td style="text-align:center;"><?php 
    echo $connections['connections'];
    ?>
</td>
						<td style="text-align:center;"><?php 
    echo $connections['players'];
    ?>
</td>
					</tr>
<?php 
}
?>
				</tbody>
												<th style="text-align:left;">Server </th>
												<th style="text-align:center;width:8%;">Date </th>
												<th style="text-align:center;width:10%;">Duration </th>
												<th style="text-align:center;width:5%;"><i class="fa fa-group fa-fw"> </i></th>
												<th style="text-align:right;">Map </th>
												<th style="text-align:right;">Method </th>
												<th style="text-align:right;">IP </th>
											</tr>
										</thead>
										<tbody>
						<?php 
foreach ($info as $info) {
    ?>
											<tr>
												<td style="text-align:left;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php 
    echo ServerName($info['server_ip']);
    ?>
</td>
												<td style="text-align:center;"><?php 
    echo date('y-m-d', $info['connect_time']);
    ?>
</td>
												<td style="text-align:center;"><?php 
    echo PlaytimeCon($info['duration']);
    ?>
</td>
												<td style="text-align:center;"><?php 
    echo $info['numplayers'];
    ?>
</td>
												<td style="text-align:right;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php