lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

include.php (971B)


      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 
      7 define("XOFFSET", 90);
      8 define("YOFFSET", 45);
      9 
     10 require("config.conf");
     11 
     12 function 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                                                                                                                              
     25 function 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();
     53 set_time_limit(300);
     54 ?>