cvs: phpweb / do_download.php log_download.php
| From: | Hojtsy Gabor | Date: | Sun, 28 Oct 2001 21:58:51 +0000 |
| Subject: | cvs: phpweb / do_download.php log_download.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-7233@lists.php.net to get a copy of this message | ||
goba Sun Oct 28 16:58:51 2001 EDT
Added files:
/phpweb log_download.php
Modified files:
/phpweb do_download.php
Log:
Finish posting Jeroen's patch, hope it will work :)
Jeroen should definitely ask for phpweb karma...
Index: phpweb/do_download.php
diff -u phpweb/do_download.php:1.5 phpweb/do_download.php:1.6
--- phpweb/do_download.php:1.5 Sun Jul 8 05:26:40 2001
+++ phpweb/do_download.php Sun Oct 28 16:58:51 2001
@@ -9,17 +9,19 @@
exit("Invalid file requested for download!");
}
-if (!isset($source_site)) {
- $source_site="www.php.net";
-}
+header("Location: http://$SERVER_NAME/distributions/$download_file");
-header("Location: http://$source_site/distributions/$download_file");
+$remote_log =
+ @fopen("http://www.php.net/log_download.php".
+ "?download_file=" . urlencode($download_file).
+ "&mirror=" . urlencode($SERVER_NAME).
+ "&user_referer=" . urlencode($HTTP_REFERER).
+ "&user_ip=" . urlencode($REMOTE_ADDR),
+ 'r');
-$log = @fopen("logs/download.log", "a");
-if ($log) {
- $log_line = sprintf("%s %s %s %s %s", date("H:i:s d-M-Y"), $HTTP_REFERER,
$download_file, gethostbyaddr($REMOTE_ADDR), $source_site);
- fputs($log, "$log_line\n");
- fclose($log);
+if ($remote_log) {
+ fread($remote_log, 1024);
+ fclose($remote_log);
}
?>
Index: phpweb/log_download.php
+++ phpweb/log_download.php
<?php
$log = @fopen("logs/download.log", "a");
if ($log) {
$log_line = sprintf("%s %s %s %s %s", date("H:i:s d-M-Y"), $user_referer,
$download_file, gethostbyaddr($user_ip), $mirror);
fputs($log, "$log_line\n");
fclose($log);
}
?>