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