ニジカもんすたぁ!! トップ・ページ https://nizika.monster
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.

index.php 1.1 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. if ($_SERVER['HTTP_HOST'] === 'nizika.monster')
  3. header ('location: //nizika.tv');
  4. const LOG_PATH = './log.txt';
  5. $log_data = [];
  6. $page = (int) ($_GET['p'] ?? 1);
  7. $length = (int) ($_GET['max'] ?? 20);
  8. $asc = ($_GET['asc'] ?? 0) != 0;
  9. $keyword = trim ($_GET['q'] ?? '');
  10. $f = fopen (LOG_PATH, 'r');
  11. if ($f !== false)
  12. {
  13. while (($dt = fgetcsv ($f, 0, "\t")) !== false)
  14. {
  15. $chat_info = json_decode ($dt[1]);
  16. $log_data[] = ['date_time' => $dt[0],
  17. 'chat_icon' => $chat_info -> author -> imageUrl,
  18. 'chat_name' => $chat_info -> author -> name,
  19. 'chat_message' => $chat_info -> message,
  20. 'answer' => $dt[2]];
  21. }
  22. }
  23. fclose ($f);
  24. unset ($f);
  25. if ($keyword != '')
  26. {
  27. $log_data = array_filter ($log_data, fn ($row) => (
  28. strpos ($row['chat_name'] . "\n" . $row['chat_message'] . "\n" . $row['answer'],
  29. $keyword)
  30. !== false));
  31. }
  32. $pages_max = (int) ((count ($log_data) - 1) / $length) + 1;
  33. if (!($asc))
  34. $log_data = array_reverse ($log_data);
  35. require_once './index.frm.php';