You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
|
|
|
|
/* Initialize Twig engine */
|
|
|
|
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates');
|
|
|
|
$twig = new \Twig\Environment($loader, [
|
|
|
|
'cache' => __DIR__ . '/../cache',
|
|
|
|
'auto_reload' => true,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$all = false;
|
|
|
|
|
|
|
|
$pdo = (new App\DB($options))->pdo;
|
|
|
|
|
|
|
|
if (isset($_GET["all"]))
|
|
|
|
$all = true;
|
|
|
|
|
|
|
|
/* Get records with limit */
|
|
|
|
$STH = $pdo->query ("SELECT `host`, `base64`, `base32`, `add_date`, `last_seen` FROM `hosts` WHERE `disabled` = 0" . ($all ? "" : " AND `blacklisted` = 0") . " ORDER BY `add_date` DESC LIMIT " . $options["tableitems"]);
|
|
|
|
$STH->setFetchMode(PDO::FETCH_ASSOC);
|
|
|
|
$rows = $STH->fetchAll();
|
|
|
|
|
|
|
|
$template = $twig->load('latest.twig');
|
|
|
|
echo $template->render(['limit' => $options["tableitems"], 'hosts' => $rows, 'all' => $all]);
|