"Fossies" - the Fresh Open Source Software Archive 
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 "sendfile.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 $msg1 = '';
21 $msg2 = '';
22
23 // Test sessid;
24 $query = "select id from Sessions where (dnldcode=\"" . addslashes($vercode) . "\" or modcode=\"" . addslashes($vercode) . "\");";
25 $res = mysql_query($query,$dbh) or die("<p><b>Error getting session information.</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
26 if (mysql_num_rows($res) != 1) $msg1 = "The download code is invalid (expired upload?).";
27 $row = mysql_fetch_row($res);
28 $sessionid = $row[0];
29
30 // Test file presence before sending;
31 $query = "select name,method from Files where id=$fid;";
32 $res = mysql_query($query,$dbh) or die("<p><b>Error getting file name.</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
33 if (mysql_num_rows($res) != 1) $msg2 = "The requested file does not exist.";
34 else $row = mysql_fetch_row($res);
35
36 if ($msg1 == '' && $msg2 == '') {
37 $realname = "$fpath/" . stripslashes($vercode) . "/$row[0]";
38 $method = $row[1];
39
40 // Create symlink;
41 if ($method == 'http') $origin = "$fpath/" . stripslashes($vercode);
42 elseif ($method == 'ftp') $origin = "$ftppath/" . stripslashes($vercode);
43
44 if (!file_exists("$serverpath/$vercode")) symlink($origin,"$serverpath/" . stripslashes($vercode)) or error_log(stripslashes($vercode) . ": Failed to symlink $origin to $serverpath/$vercode");
45
46 $url = $proto . '://' . $servername . '/' . stripslashes($vercode) . '/' . $row[0];
47
48 if ($savehistory) {
49 // record file download into History table;
50 insert_history_entry('download', $fid, $sessionid);
51 }
52
53 }
54 ?>
55 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
56 <html>
57 <head>
58 <title><?=$appname; ?> - Send File</title>
59 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
60 <?
61 if ($method == 'http') echo '<META http-equiv="refresh" content="8;URL=' . $url . '">';
62 ?>
63 <link href="default.css" rel="stylesheet" type="text/css">
64 </head>
65 <body>
66 <?=$titleandmenu; ?>
67 <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
68 <tr>
69 <th class="content-text" scope="row" align="left"><strong>
70 <?
71 if ($msg1 != '' || $msg2 != '' || !is_link("$serverpath/" . stripslashes($vercode))) die("<font color=red>File not found</font>");
72 echo $notesheading;
73 ?>
74 </strong></th>
75 </tr>
76 <tr>
77 <th class="content-text" scope="row" align="left">
78 <ol>
79 <?
80 if ($method == 'http') {
81 echo "<li><strong>$sendnote1</strong></li>";
82 echo "<li><strong>$sendnote2</strong></li>";
83 }
84 else echo "<li><strong>$ftpsendnote1</strong></li>";
85 ?>
86 </ol>
87 </th>
88 </tr>
89 </table>
90 <p> </p>
91 <table width="500" border="0" align="center" cellpadding="3" cellspacing="1" class="border">
92
93 <?
94 if ($method == 'http') { ?>
95 <tr>
96 <th width="150" align="left" valign="top" nowrap class="header" scope="row"><?=$sendpathfieldtitle; ?></th>
97 <td align="left" valign="middle" nowrap class="content" scope="row"><a href="<?=$url; ?>"><?=$url; ?></a></td>
98 </tr>
99 <?
100 }
101 else { ?>
102 <tr>
103 <th width="150" align="left" valign="top" nowrap class="header" scope="row"><?=$ftpserverfieldtitle; ?></th>
104 <td align="left" valign="middle" nowrap class="content" scope="row"><?=$servername; ?></td>
105 </tr>
106 <tr>
107 <th width="150" align="left" valign="top" nowrap class="header" scope="row"><?=$ftpusernamefieldtitle ?><br> </th>
108 <td align="left" valign="middle" nowrap class="content" scope="row"><?=$ftpuser; ?></td>
109 </tr>
110 <tr>
111 <th width="150" align="left" valign="top" nowrap class="header" scope="row"><?=$ftppasswordfieldtitle; ?></th>
112 <td align="left" valign="middle" nowrap class="content" scope="row"><?=$ftppass; ?></td>
113 </tr>
114 <tr>
115 <th width="150" align="left" valign="top" nowrap class="header" scope="row"><?=$ftppathfieldtitle; ?></th>
116 <td align="left" valign="middle" nowrap class="content" scope="row"><?="/" . stripslashes($vercode) . "/"; ?></td>
117 </tr>
118 <tr>
119 <th width="150" align="left" valign="top" nowrap class="header" scope="row"><?=$sendfilenamefeldtitle; ?><br> </th>
120 <td align="left" valign="middle" nowrap class="content" scope="row"><?=$row[0]; ?></td>
121 </tr>
122 <?
123 }
124 ?>
125 </table>
126 <?
127 print $footer;
128 ?>
129 </body>
130 </html>