2021-02-21 16:37:27 +00:00
< ? 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 ,
]);
$pdo = ( new App\DB ( $options )) -> pdo ;
/* Get records with limit */
2021-06-27 16:05:27 +00:00
$STH = $pdo -> query ( " SELECT `host`, `base64`, `base32`, `add_date`, `last_seen` FROM `hosts` WHERE `disabled` = 0 ORDER BY `add_date` DESC LIMIT " . $options [ " tableitems " ]);
2021-02-21 16:37:27 +00:00
$STH -> setFetchMode ( PDO :: FETCH_ASSOC );
$rows = $STH -> fetchAll ();
$template = $twig -> load ( 'latest.twig' );
echo $template -> render ([ 'limit' => $options [ " tableitems " ], 'hosts' => $rows ]);