fixed empty db when not logging ip

If you set the config value to no in order to not log IP's it would not insert anything to the DB because of the missing empty ip.
This commit is contained in:
nokonoko 2021-06-21 14:54:54 +02:00
parent a06deebce9
commit 317f689904
1 changed files with 2 additions and 1 deletions

View File

@ -133,7 +133,8 @@ function uploadFile($file)
if(LOG_IP == 'yes'){
$q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date, ip) VALUES (:hash, :orig, :name, :size, :date, :ip)');
}else{
$q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date) VALUES (:hash, :orig, :name, :size, :date)');
$ip = '0';
$q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date, ip) VALUES (:hash, :orig, :name, :size, :date, :ip)');
}
// Common parameters binding
$q->bindValue(':hash', $file->getSha1(), PDO::PARAM_STR);