Unsupported scripts and control panel web app for a hosting company
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?PHP
  2. if (!isset($error)) {
  3. ?>
  4. <div class="block">
  5. <h2>Recent errors</h2>
  6. <table class="innerblock">
  7. <tr>
  8. <th>Time</th>
  9. <th>Type</th>
  10. <th>Client</th>
  11. <th>Message</th>
  12. </tr>
  13. <?PHP
  14. $file = '/usr/local/apache/logs/'.str_pad(SITE_ID,3,'0',STR_PAD_LEFT).'-error_log';
  15. if (file_exists($file) && ($size = filesize($file)) > 0) {
  16. $fh = fopen($file,'r');
  17. if ($size < 1024*50) { $size = 1024*50; }
  18. fseek($fh, $size - 1024*50);
  19. $lines = array();
  20. while (!feof($fh)) {
  21. $lines[] = fgets($fh);
  22. }
  23. array_shift($lines); // Could be incomplete
  24. $lines = array_reverse($lines);
  25. $lines = array_slice($lines, 0, 10);
  26. $i = 0;
  27. foreach ($lines as $line) {
  28. if (preg_match('/^\[(.*?)\] \[(.*?)\]( \[client (.*?)\])? (.*)$/', $line, $matches)) {
  29. echo '<tr'.(($i == 1)?' class="odd"':'').'><td>'.$matches[1].'</td><td>'.$matches[2].'</td><td>'.$matches[4].'</td><td>'.$matches[5].'</td></tr>';
  30. $i = 1 - $i;
  31. }
  32. }
  33. fclose($fh);
  34. } else {
  35. echo '<tr><td colspan="4" style="font-style: italic;">No errors</td></tr>';
  36. }
  37. ?>
  38. </table>
  39. </div>
  40. <?PHP
  41. }
  42. ?>