home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / src / PHP / phpisdnctrl.php3.txt < prev    next >
Encoding:
Text File  |  2002-05-06  |  4.1 KB  |  143 lines

  1. PHP_IsdnCtrl 
  2.  
  3. Frontend for the ISDN4K Util isdnrep with HTML output ( additional script to the PHP_Imon http://www.daxtar.de/isdn/ ) 
  4.  
  5.  
  6. <?
  7.   /*
  8.   Still in process, not yet found the time to comment :-)
  9.   Contact : mb@daxtar.de, http://www.daxtar.de/isdn/
  10.   */
  11.  
  12.   // set to the correct filename !!!
  13.   $isdnrep_command = "/usr/bin/isdnrep";
  14.   
  15.   $bg_image="/images/bg.gif";
  16.   
  17.   // don't change this !!!!!!!!!!, }:-)
  18.   $month_list = array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  19.  
  20.  
  21.    function print_month_select($no)
  22.    { 
  23.      $date_array = getdate(time());
  24.      printf ("<SELECT NAME=\"%s\">\n", "month".$no);
  25.      for ($i=1; $i<13; $i++)
  26.      {
  27.        if ($date_array[month] == $GLOBALS["month_list"][$i]) 
  28.          printf ("<OPTION selected VALUE=\"%s\">%s</OPTION>\n", $i, $GLOBALS["month_list"][$i]);
  29.        else
  30.          printf ("<OPTION VALUE=\"%s\">%s</OPTION>\n", $i, $GLOBALS["month_list"][$i]);
  31.      }
  32.      printf ("</SELECT>\n\n");
  33.    }
  34.  
  35.    function print_day_select($no)
  36.    { 
  37.      $date_array = getdate(time());
  38.      printf ("<SELECT NAME=\"%s\">\n", "day".$no);
  39.      for ($i=1; $i<32; $i++)
  40.      {
  41.        if ($date_array[mday] == $i) 
  42.          printf ("<OPTION selected VALUE=\"%s\">%s</OPTION>\n", $i, $i);
  43.        else
  44.          printf ("<OPTION VALUE=\"%s\">%s</OPTION>\n", $i, $i);
  45.      }
  46.      printf ("</SELECT>\n\n");
  47.    }
  48.    
  49.    function print_year_select($no)
  50.    {
  51.      $date_array = getdate(time());
  52.      printf ("<SELECT NAME=\"%s\">\n", "year".$no);
  53.      for ($i=($date_array[year]-2); $i<($date_array[year]+5); $i++)
  54.      {
  55.        if ($date_array[year] == $i) 
  56.          printf ("<OPTION selected>%s</OPTION>\n", $i);
  57.        else
  58.          printf ("<OPTION>%s</OPTION>\n", $i);
  59.      }
  60.      printf ("</SELECT>\n\n");
  61.    }
  62.  
  63. ?>
  64.  
  65. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  66. <HTML>
  67. <HEAD>
  68. <TITLE>Php Isdnrep</TITLE>
  69. </HEAD>
  70.  
  71. <BODY BACKGROUND="<? echo $bg_image; ?>">
  72.  
  73.  
  74. <TABLE ALIGN="CENTER" BORDER="0" CELLSPACING="2" CELLPADDING=3><TR><TD BGCOLOR="white">
  75. <?
  76.    $isdnrep_options = " -wX WWW ";
  77.    
  78.    switch ($repmode)
  79.    {
  80.         case "single_day" : $isdnrep_options = $isdnrep_options."-t ".$day."/".$month."/".$year[2].$year[3]; break;
  81.         case "single_month" : $isdnrep_options = $isdnrep_options."-t ".$month."/".$year[2].$year[3]; break;
  82.         case "timespan" : $isdnrep_options = $isdnrep_options."-t ".$month_from."/".$year_from[2].$year_from[3]."-".$month_til."/".$year_til[2].$year_til[3]; break;
  83.         default : break;
  84.    }
  85.    
  86.    printf ("%s", system($isdnrep_command.$isdnrep_options));
  87.    //printf ("%s", $isdnrep_command.$isdnrep_options);
  88. ?>
  89.  
  90. </TD></TR></TABLE>
  91.  
  92. <HR SIZE=1> <BR>
  93.  
  94. <TABLE BORDER="4" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER"><TR><TD bgcolor="#C0C0C0">
  95. <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0">
  96.  
  97. <?
  98.    printf ("<FORM NAME=\"single_day\" ACTION=\"%s\">\n", getenv("SCRIPT_NAME"));
  99.    printf ("<TR><TD><input type=\"submit\" value=\"Report\"></TD>\n");
  100.    printf ("<TD>day</TD><TD>:</TD><TD>\n");
  101.    print_day_select("");
  102.    print_month_select("");
  103.    print_year_select("");
  104. ?>
  105. <input type="hidden" name="repmode" value="single_day"></TD>
  106. </FORM>
  107. </TR>
  108.  
  109. <?
  110.    printf ("<FORM NAME=\"single_month\" ACTION=\"%s\">\n", getenv("SCRIPT_NAME"));
  111.    printf ("<TR><TD><input type=\"submit\" value=\"Report\"></TD>\n");
  112.    printf ("<TD>month</TD><TD>:</TD><TD>\n");
  113.    print_month_select("");
  114.    print_year_select("");
  115. ?>
  116. <input type="hidden" name="repmode" value="single_month"></TD>
  117. </FORM>
  118. </TR>
  119.  
  120. <?
  121.    printf ("<FORM NAME=\"timespan\" ACTION=\"%s\">\n", getenv("SCRIPT_NAME"));
  122.    printf ("<TR><TD><input type=\"submit\" value=\"Report\"></TD>\n");
  123.    printf ("<TD>timespan</TD><TD>:</TD><TD>\n");
  124.    print_month_select("_from");
  125.    print_year_select("_from");
  126.    printf (" til ");
  127.    print_month_select("_til");
  128.    print_year_select("_til");
  129. ?>
  130. <input type="hidden" name="repmode" value="timespan"></TD>
  131. </FORM>
  132. </TR>
  133.  
  134. </TABLE></TD></TR></TABLE></TD></TR>
  135.  
  136.  
  137. </TABLE>
  138.  
  139.  
  140. </BODY>
  141. </HTML>
  142.  
  143.