Add logging to files feature

This commit is contained in:
Retro_Guy 2021-06-01 00:09:52 +00:00
parent d94ea073ed
commit c6a4dfb0a8
2 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,8 @@
include "config.inc.php";
include "newsportal.php";
$logfile=$logdir.'/files.log';
if(isset($_COOKIE['tzo'])) {
$offset=$_COOKIE['tzo'];
} else {
@ -15,6 +17,8 @@ include "newsportal.php";
fclose($getfh);
header('Content-type: '.$_REQUEST[contenttype]);
header('Content-disposition: filename="'.$_REQUEST[showfilename].'"');
file_put_contents($logfile, "\n".format_log_date()." Requesting: ".$_REQUEST['showfile'], FILE_APPEND);
echo $getfile;
exit(0);
}

View File

@ -2,6 +2,8 @@
include "config.inc.php";
include "newsportal.php";
$logfile=$logdir.'/files.log';
if(isset($_POST['username'])) {
$name = $_POST['username'];
// Save name in cookie
@ -34,6 +36,7 @@ if(isset($_FILES)) {
}
$success = move_uploaded_file($_FILES[photo][tmp_name], $upload_to);
if ($success) {
file_put_contents($logfile, "\n".format_log_date()." Saved: ".strtolower($_POST['username'])."/".$_FILES[photo][name], FILE_APPEND);
echo 'Saved '.$_FILES[photo][name].' to your files folder';
} else {
echo 'There was an error saving '.$_FILES[photo][name];