if (file_exists($cache)) {
    $fromcreation = date('U') - date('U', filemtime($cache));
    //			hours	min		sec
    $time = 1 * 30 * 60;
    //15min
    if ($fromcreation < $time) {
        echo file_get_contents($cache);
        exit;
    }
}
require 'statsModel.php';
require 'templates/template.php';
require 'vendors.php';
$script = '<script type="text/javascript" src="js/awesomechart.js"></script>';
$out = Template::header("Statistics", $script);
$out .= Template::contentStart();
$results = new statsModel();
$stats = $results->getStats();
$out .= "<h1>General Info</h1><br/>";
$out .= "<strong>Total scans: </strong>" . $stats['total'];
$out .= "<strong> Distinct wifis: </strong>" . $stats['totalwifi'] . "<hr/>";
$out .= '<h1>Frequency Statistics</h1><br/>
		<div class="charts_container">
            <canvas id="frequencyCanvas" width="600" height="400">
                Your web-browser does not support the HTML 5 canvas element.
            </canvas>
		</div>';
$datas = "";
$labels = "";
$i = 0;
foreach ($stats['frequency'] as $frequency => $data) {
<?php

require_once 'templates/template.php';
echo Template::header("Index");
echo Template::contentStart();
?>
<h1>Open Wifi Statistics</h1>
<p>This is Open Wifi Statistics project Web Interface.</p>
<h2>Interesting Links</h2>
<p>
	<a href="https://github.com/uberspot/OpenWifiStatistics-web">Web Interface @ Github</a><br/>
	<a href="https://github.com/uberspot/OpenWifiStatistics">Android Client @ Github</a><br/>
	<a href="https://play.google.com/store/apps/details?id=com.ows.OpenWifiStatistics#?t=W251bGwsMSwxLDUwMSwiY29tLm93cy5PcGVuV2lmaVN0YXRpc3RpY3MiXQ..">Android Client @ Google Play</a><br/>
</p>

<?php 
echo Template::contentEnd();
echo Template::footer();