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.

54 lines
971 B

  1. <?php
  2. define("INT_DAILY", 60*60*24*2);
  3. define("INT_WEEKLY", 60*60*24*8);
  4. define("INT_MONTHLY", 60*60*24*35);
  5. define("INT_YEARLY", 60*60*24*400);
  6. define("XOFFSET", 90);
  7. define("YOFFSET", 45);
  8. require("config.conf");
  9. function ConnectDb()
  10. {
  11. global $db_connect_string;
  12. $db = pg_pconnect($db_connect_string);
  13. if (!$db)
  14. {
  15. printf("DB Error, could not connect to database");
  16. exit(1);
  17. }
  18. return($db);
  19. }
  20. function fmtb($kbytes)
  21. {
  22. $Max = 1024;
  23. $Output = $kbytes;
  24. $Suffix = 'K';
  25. if ($Output > $Max)
  26. {
  27. $Output /= 1024;
  28. $Suffix = 'M';
  29. }
  30. if ($Output > $Max)
  31. {
  32. $Output /= 1024;
  33. $Suffix = 'G';
  34. }
  35. if ($Output > $Max)
  36. {
  37. $Output /= 1024;
  38. $Suffix = 'T';
  39. }
  40. return(sprintf("<td align=right><tt>%.1f%s</td>", $Output, $Suffix));
  41. }
  42. $starttime = time();
  43. set_time_limit(300);
  44. ?>