im silly
This commit is contained in:
parent
af520d265d
commit
26cb9e0b8f
13
upload.php
13
upload.php
@ -47,21 +47,18 @@ 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
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
||||||
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
||||||
$exists = true;
|
$exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exists) { // if the file already exists, redirect to the existing file
|
if ($exists) { // if the file already exists, redirect to the existing file
|
||||||
|
Reference in New Issue
Block a user