Debian Codegraph @

contrib/mrtg_php_portal/www/remove.php

raw
1 <html>
2
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
5 <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
6 <meta name="ProgId" content="FrontPage.Editor.Document">
7 <title>MRTG remove switch:</title>
8 </head>
9
10 <body>
11
12 <p><b><u>MRTG remove switch:</u></b></p>
13 <FORM ACTION=remove.php METHOD=POST>
14 <table border="0" width="100%">
15 <tr>
16 <td width="12%">Switch:</td>
17 <td width="88%"><select size="1" name="switch">
18 <?
19 // Include config file with path variable, etc...
20 include ("c:\\mrtg\\conf\\config.inc.php");
21 $dir = dir($mrtg_config_dir);
22 // echo "<ul>";
23 while($filename=$dir->read()) {
24 if (eregi("\.(cfg)$",$filename))
25 echo "<option value=".substr($filename, 0, -4).">".substr($filename, 0, -4)."</option>";
26 }
27 $dir->close();
28 //echo "</ul>";
29 ?>
30 </select></td>
31 </tr>
32 <tr>
33 <td width="12%">Option:</td>
34 <td width="88%"><input type="checkbox" name="del_config" value="ON">Delete
35 config file</td>
36 </tr>
37 <tr>
38 <td width="12%"></td>
39 <td width="88%"><input type="checkbox" name="del_html" value="ON">Delete
40 stats</td>
41 </tr>
42 <tr>
43 <td width="12%"></td>
44 <td width="88%"><input type="checkbox" name="del_index" value="ON">Delete
45 html index</td>
46 </tr>
47 </table>
48 <input type="submit" value="Delete" name="B1"><input type="reset" value="Reset" name="B2">
49 </form>
50 <hr>
51 </body>
52
53 </html>
54 <?
55
56 // Include config file with path variable, etc...
57 include ("e:\\mrtg\\conf\\config.inc.php");
58
59
60 if($REQUEST_METHOD == "POST"){
61 if (file_exists($mrtg_config_dir.$switch.".cfg") && $del_config == "ON") {
62 echo " $switch config files removed...<br>";
63 unlink($mrtg_config_dir.$switch.".cfg");
64 unlink($mrtg_config_dir.$switch.".ok");
65 }
66 if (file_exists($mrtg_html_dir.$switch) && $del_html == "ON") {
67 echo " $switch html files removed...<br>";
68 exec( "rmdir /s /q ".$mrtg_html_dir.$switch);
69 }
70 if (file_exists($mrtg_html_dir.$switch.".html") && $del_index == "ON") {
71 echo " $switch index files removed...<br>";
72 unlink($mrtg_html_dir.$switch.".html");
73 }
74 }
75 echo "<br><a href=./>Back to index</a>";
76
77 ?>