"Fossies" - the Fresh Open Source Software Archive

Member "bandwidthd-2.0.1/phphtdocs/include.php" (8 Jan 2005, 967 Bytes) of package /linux/privat/old/bandwidthd-2.0.1.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "include.php" see the Fossies "Dox" file reference documentation.

    1 <?
    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 ?>