42 lines
889 B
PHP
42 lines
889 B
PHP
<?php
|
|
|
|
if ($_SERVER['HTTP_HOST'] === 'nizika.monster')
|
|
header ('location: //nizika.tv');
|
|
|
|
const LOG_PATH = './log.txt';
|
|
|
|
$log_data = [];
|
|
|
|
$page = (int) ($_GET['p'] ?? 1);
|
|
$length = (int) ($_GET['max'] ?? 20);
|
|
$asc = ($_GET['asc'] ?? 0) != 0;
|
|
|
|
$f = fopen (LOG_PATH, 'r');
|
|
|
|
if ($f !== false)
|
|
{
|
|
while (($dt = fgetcsv ($f, 0, "\t")) !== false)
|
|
{
|
|
$chat_info = json_decode ($dt[1]);
|
|
|
|
$log_data[] = ['date_time' => $dt[0],
|
|
'chat_icon' => $chat_info -> author -> imageUrl,
|
|
'chat_name' => $chat_info -> author -> name,
|
|
'chat_message' => $chat_info -> message,
|
|
'answer' => $dt[2]];
|
|
}
|
|
|
|
}
|
|
|
|
fclose ($f);
|
|
|
|
unset ($f);
|
|
|
|
$pages_max = (int) (count ($log_data) / $length);
|
|
|
|
if (!($asc))
|
|
$log_data = array_reverse ($log_data);
|
|
|
|
require_once './index.frm.php';
|
|
|