<?php
include_once('../stats.php');
include '../geo/geoip.inc';
include '../localization.php';
$gi = geoip_open("../geo/GeoIP.dat", "");
?>
<!--
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<link href="../../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="../../css/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="../../css/main.css" rel="stylesheet" type="text/css" />
-->
<h3><?php print($pageText['last5installations'][0]); ?></h3>
<table id="lastfive" class="table table-condensed table-hover table-striped table-bordered">
	<thead>
		<tr>
			<th>#</th>
			<th><?php print($pageText['ip'][0]); ?></th>
			<th><?php print($pageText['country'][0]); ?></th>
			<th><?php print($pageText['installdate'][0]); ?></th>
			<th><?php print($pageText['os'][0]); ?></th>
			<th><?php print($pageText['privileges'][0]); ?></th>
			<th><?php print($pageText['botversion'][0]); ?></th>
		</tr>
	</thead>
    <tbody>
    <?php
                                
        if ($total != "0")
        {
            $bots = $odb->query("SELECT * FROM bots ORDER BY installdate DESC LIMIT 5");
            while ($b = $bots->fetch(PDO::FETCH_ASSOC))
            {
                $id = $b['id'];
                $ip = $b['ipaddress'];
                $cn = geoip_country_name_by_id($gi, $b['country']);
                $fl = strtolower(geoip_country_code_by_id($gi, $b['country']));
                $in = date("m-d-Y, h:i A", $b['installdate']);
                $os = $b['operatingsys'];
                $pv = $b['privileges'];
                $bv = $b['botversion'];
                echo '<tr><td>'.$id.'</td><td>'.$ip.'</td><td>'.$cn.'&nbsp;&nbsp;<img src="../../img/flags/'.$fl.'.png" /></td><td>'.$in.'</td><td>'.$os.'</td><td>'.$pv.'</td><td>'.$bv.'</td></tr>';
            }
        }else{
            echo '<tr class="odd"><td colspan="8">No data to display</td></tr>';
        }
    ?>
    </tbody>
</table>