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

View File

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