"Fossies" - the Fresh Open Source Software Archive 
Member "eventh/tnadmin/purge.php" (21 Aug 2007, 3479 Bytes) of package /linux/privat/old/eventh-1.1.11.tar.gz:
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 "purge.php" see the
Fossies "Dox" file reference documentation.
1 <?
2 /*
3 This file is part of Event Horizon (EVH).
4
5 EVH is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 EVH is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 include "../inc.php";
20
21 $queryfiles = "select id, sessionid, name from Files where 1;";
22 $resfiles = mysql_query($queryfiles,$dbh) or die("<p><b>A fatal database error occured</b>.\n<br />Query: " . $queryfiles . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
23 ?>
24 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
25 <html>
26 <head>
27 <title><?=$appname; ?> - Admin</title>
28 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
29 <link href="../default.css" rel="stylesheet" type="text/css">
30 </head>
31 <body>
32 <?=$titleandmenu; ?>
33
34 <?
35 if (!isset($confirm) and $confirm != 1) { ?>
36 <script language="JavaScript">
37 <!--
38 input_box=confirm("Do you really want to delpurge ALL files? \r\nClick OK or Cancel to Continue");
39 if (input_box==false) {
40 alert ("File deletion cancelled.")
41 }
42 if (input_box==true) {
43 window.location = location.href+"?confirm=1";
44 }
45 if (input_box==false) {
46 window.location = location.href+"?confirm=0";
47 }
48 -->
49 </script>
50 <?
51 }
52 elseif (isset($confirm) and $confirm == 1) {
53 error_log("File purge initiated.");
54 $query = "select id,dnldcode from Sessions where 1";
55 $res = mysql_query($query,$dbh) or die("<p><b>Could not retrieve session list.</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
56
57 while ($row = mysql_fetch_row($res)) {
58 error_log($row[1] . ': Purging files');
59 $query2 = "select id from Files where sessionid=$row[0]";
60 $res2 = mysql_query($query2,$dbh) or die("<p><b>File was invalid, could not delete.... Purge cancelled.</b>.\n<br />Query: " . $query2 . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
61 $filerow = mysql_fetch_row($res2);
62
63 if ($savehistory) {
64 // record file modification/deletion into History table;
65 insert_history_entry('purge', $filerow[0], $row[0]);
66 }
67
68 $query2 = "delete from Files where sessionid=$row[0]";
69 $res2 = mysql_query($query2,$dbh) or die("<p><b>File was invalid, could not delete.... Purge cancelled.</b>.\n<br />Query: " . $query2 . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
70 $query2 = "delete from Sessions where id=$row[0];";
71 $res2 = mysql_query($query2,$dbh) or die("<p><b>Session was invalid, could not delete.... Purge cancelled.</b>.\n<br />Query: " . $query2 . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
72 remove_files("$row[1]");
73 }
74 echo '<div align=center class="content-text">Purge Completed</div>';
75 }
76 else {
77 echo '<div align=center class="content-text">Purge Cancelled</div>';
78 }
79 ?>
80 <p align="center"><span class="content-text"><strong><a href=index.php>Back to admin page</a></strong></span></p>
81 <?
82 print $footer;
83 ?>
84 </body>
85 </html>
86