BioTorrents.de’s version of Gazelle
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.

sql.php 842B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. #declare(strict_types=1);
  3. list($Page, $Limit) = Format::page_limit(LOG_ENTRIES_PER_PAGE);
  4. if (!empty($_GET['search'])) {
  5. $Search = db_string($_GET['search']);
  6. } else {
  7. $Search = false;
  8. }
  9. $Words = explode(' ', $Search);
  10. $SQL = "
  11. SELECT
  12. SQL_CALC_FOUND_ROWS
  13. `ID`,
  14. `Message`,
  15. `Time`
  16. FROM
  17. `log`
  18. ";
  19. if ($Search) {
  20. $SQL .= "WHERE Message LIKE '%";
  21. $SQL .= implode("%' AND Message LIKE '%", $Words);
  22. $SQL .= "%' ";
  23. }
  24. if (!check_perms('site_view_full_log')) {
  25. if ($Search) {
  26. $SQL .= ' AND ';
  27. } else {
  28. $SQL .= ' WHERE ';
  29. }
  30. $SQL .= " Time>'".time_minus(3600 * 24 * 28)."' ";
  31. }
  32. $SQL .= "
  33. ORDER BY
  34. `ID`
  35. DESC
  36. LIMIT $Limit
  37. ";
  38. $Log = $DB->query($SQL);
  39. $DB->query('SELECT FOUND_ROWS()');
  40. list($NumResults) = $DB->next_record();
  41. $TotalMatches = $NumResults;
  42. $DB->set_query_id($Log);