im silly
This commit is contained in:
parent
af520d265d
commit
26cb9e0b8f
21
upload.php
21
upload.php
@ -47,20 +47,17 @@ if (!isZipFile($map["name"])) {
|
||||
die();
|
||||
}
|
||||
|
||||
$fileHash = null;
|
||||
try {
|
||||
$fileHash = hash_file("sha256", $file); // the hash of the file
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$fileHash = hash_file("sha256", $file); // the hash of the file
|
||||
|
||||
$exists = false;
|
||||
if ($fileHash != null) {
|
||||
foreach (scandir($target_dir) as $file) { // scan the maps directory for a file with the same hash
|
||||
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
||||
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
foreach (scandir($target_dir) as $file) { // scan the maps directory for a file with the same hash
|
||||
if ($file == "." || $file == "..") { // ignore the . and .. files
|
||||
continue;
|
||||
}
|
||||
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
||||
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user