mirror of https://github.com/PurpleI2P/regi2p.git
Domain registry project
http://reg.i2p/
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.
34 lines
1.1 KiB
34 lines
1.1 KiB
4 years ago
|
<?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,
|
||
|
]);
|
||
|
|
||
|
$offset = $options["tableitems"] * ($page - 1);
|
||
|
$newregoffs = date ("Y-m-d H:i:s", strtotime ("-7 day"));
|
||
|
$newseenlim = date ("Y-m-d H:i:s", strtotime ("-3 day"));
|
||
|
$oldseenlim = date ("Y-m-d H:i:s", strtotime ("-7 day"));
|
||
|
|
||
|
$pdo = (new App\DB($options))->pdo;
|
||
|
|
||
|
/* Get records amount */
|
||
|
$STH = $pdo->query ("SELECT COUNT(*) as `count` FROM `hosts`");
|
||
|
$STH->setFetchMode (PDO::FETCH_ASSOC);
|
||
|
$records = $STH->fetch()["count"];
|
||
|
|
||
|
$pages = intdiv($records, $options["tableitems"]) + 1;
|
||
|
|
||
|
/* Get records with limit */
|
||
|
$STH = $pdo->query ("SELECT `host`, `base64`, `base32`, `last_seen` FROM `hosts` LIMIT " . $offset . ", " . $options["tableitems"]);
|
||
|
$STH->setFetchMode(PDO::FETCH_ASSOC);
|
||
|
$rows = $STH->fetchAll();
|
||
|
|
||
|
$template = $twig->load('all.twig');
|
||
|
echo $template->render(['current' => $page, 'total' => $pages, 'hosts' => $rows]);
|