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();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileHash = null;
|
$fileHash = hash_file("sha256", $file); // the hash of the file
|
||||||
try {
|
|
||||||
$fileHash = hash_file("sha256", $file); // the hash of the file
|
|
||||||
} catch (Exception $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
$exists = false;
|
$exists = false;
|
||||||
if ($fileHash != null) {
|
foreach (scandir($target_dir) as $file) { // scan the maps directory for a file with the same hash
|
||||||
foreach (scandir($target_dir) as $file) { // scan the maps directory for a file with the same hash
|
if ($file == "." || $file == "..") { // ignore the . and .. files
|
||||||
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
continue;
|
||||||
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
}
|
||||||
$exists = true;
|
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
||||||
break;
|
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
||||||
}
|
$exists = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user