1
0
mirror of https://github.com/PurpleI2P/regi2p.git synced 2025-01-14 17:17:59 +00:00
regi2p/views/latest.php

22 lines
701 B
PHP
Raw Normal View History

<?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 */
$STH = $pdo->query ("SELECT `host`, `base64`, `base32`, `add_date` FROM `hosts` 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]);