dashboard\primary\error("URL not valid!"), 'no_local' => dashboard\primary\error("URL can't be a local path! Must be a remote URL accessible by the open internet!"), 'failure' => dashboard\primary\error("Failed to add file!"), 'success' => dashboard\primary\success("Successfully added file!"), 'tester_file_exceed' => dashboard\primary\error("Tester plan may only upload files up to 10MB. Upgrade for larger file size!"), 'dev_file_exceed' => dashboard\primary\error("File size limit is 50MB. Please upgrade for larger file size!"), 'seller_file_exceed' => dashboard\primary\error("File size limit is 75MB. This is the MAX"), 'name_too_large' => dashboard\primary\error("File name is too large. Rename it to something shorter"), 'invalid_extension' => dashboard\primary\error("No HTML files. You must get the DIRECT URL which downloads INSTANTLY. No download page, direct file."), 'bad_response' => dashboard\primary\error("File either not found or URL not allowed by the file host!"), 'discord_cdn' => dashboard\primary\error("Discord's developers made files expire after 24 hours, use catbox.moe or pages.dev instead!"), 'github_no_raw' => dashboard\primary\error("Click the \"Raw\" button on GitHub file. Only use raw.githubusercontent.com URLs"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['delfiles'])) { $resp = misc\upload\deleteAll(); match($resp){ 'failure' => dashboard\primary\error("Failed to delete all files!"), 'success' => dashboard\primary\success("Successfully deleted all files!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['deletefile'])) { $resp = misc\upload\deleteSingular($_POST['deletefile']); match($resp){ 'failure' => dashboard\primary\error("Failed to delete all files!"), 'success' => dashboard\primary\success("Successfully deleted all files!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } if (isset($_POST['editfile'])) { $file = misc\etc\sanitize($_POST['editfile']); $result = misc\mysql\query("SELECT `url` FROM `files` WHERE `id` = ? AND `app` = ?", [$file, $_SESSION['app']]); $fileUrl = mysqli_fetch_array($result->result); echo '
'; } if (isset($_POST['savefile'])) { $fileid = misc\etc\sanitize($_POST['savefile']); $url = misc\etc\sanitize($_POST['url']); if (!filter_var($url, FILTER_VALIDATE_URL)) { dashboard\primary\error("Invalid Url!"); echo ""; return; } if (str_contains($url, "discord")) { dashboard\primary\error("Discord's developers made files expire after 24 hours, use catbox.moe or pages.dev instead!"); echo ""; return; } if (str_contains($url, "github.com")) { dashboard\primary\error("Click the \"Raw\" button on GitHub file. Only use raw.githubusercontent.com URLs"); echo ""; return; } if (str_contains($url, "localhost") || str_contains($url, "127.0.0.1") || str_contains($url, "file:/")) { dashboard\primary\error("URL can't be a local path! Must be a remote URL accessible by the open internet"); echo ""; return; } // Initialize cURL session $ch = curl_init($url); // Set options curl_setopt($ch, CURLOPT_NOBODY, true); // Only fetch headers, no body curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the transfer as a string curl_setopt($ch, CURLOPT_HEADER, true); // Include the header in the output curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla KeyAuth'); $response = curl_exec($ch); $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpStatusCode == 403 || $httpStatusCode == 404) { dashboard\primary\error("File either not found or URL not allowed by the file host!"); echo ""; return; } // Get content length $filesize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); $contType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); if(str_contains($contType, "html")) { dashboard\primary\error("No HTML files. You must get the DIRECT URL which downloads INSTANTLY. No download page, direct file."); echo ""; return; } if ($filesize > 10000000 && $role == "tester") { dashboard\primary\error("Users with tester plan may only upload files up to 10MB. Paid plans may upload up to 75MB."); echo ""; return; } else if ($filesize > 50000000 && ($role == "developer" || $role == "Manager")) { dashboard\primary\error("File size limit is 50 MB. Upgrade your account to gain a total of 75mb."); echo ""; return; } else if ($filesize > 75000000) { dashboard\primary\error("File size limit is 75 MB."); echo ""; return; } $fn = basename(parse_url($url, PHP_URL_PATH)); $fs = misc\etc\formatBytes($filesize); if(strlen($fn) > 49) { dashboard\primary\error("File name is too large! Rename it to have a shorter name."); echo ""; return; } $authed = misc\etc\sanitize($_POST['authed']) == NULL ? 0 : 1; $query = misc\mysql\query("UPDATE `files` SET `name` = ?,`size` = ?,`url` = ?, `uploaddate` = ?, `authed` = ? WHERE `app` = ? AND `id` = ?", [$fn, $fs, $url, time(), $authed, $_SESSION['app'], $fileid]); if ($query->affected_rows != 0) { misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid); dashboard\primary\success("Successfully Updated File!"); } else { dashboard\primary\error("Failed to update file"); } } if (isset($_POST["selected"]) && isset($_POST["action"])) { $selected = json_decode($_POST['selected'], true); if ($_POST["action"] == "delete") { foreach ($selected as $value) { $resp = misc\upload\deleteSingular($value); match($resp){ 'failure' => dashboard\primary\error("Failed to delete file!"), 'success' => dashboard\primary\success("Successfully deleted file!"), default => dashboard\primary\error("Unhandled Error! Contact us if you need help") }; } } else if ($_POST["action"] == "authEnable") { foreach ($selected as $value) { $query = misc\mysql\query("UPDATE `files` SET `authed` = 1 WHERE `app` = ? AND `id` = ?", [$_SESSION['app'], $value]); if ($query->affected_rows != 0) { misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid); dashboard\primary\success("Successfully updated files!"); } else { dashboard\primary\error("Failed to update files"); } } } else if ($_POST["action"] == "authDisable") { foreach ($selected as $value) { $query = misc\mysql\query("UPDATE `files` SET `authed` = 0 WHERE `app` = ? AND `id` = ?", [$_SESSION['app'], $value]); if ($query->affected_rows != 0) { misc\cache\purge('KeyAuthFile:' . ($secret ?? $_SESSION['app']) . ':' . $fileid); dashboard\primary\success("Successfully updated files!"); } else { dashboard\primary\error("Failed to update files"); } } } else { dashboard\primary\error("Invalid action"); } } ?>Let your users download files you upload here. Learn More.
| Select | Filename | ID | Size | Upload Date | Authenticated | Actions |
|---|---|---|---|---|---|---|
| ' . ' | '; echo "" . $row["name"] . " | "; echo "" . $row["id"] . " | "; echo "" . $row["size"] . " | "; echo ""; echo " | " . ($row["authed"] ? 'True' : 'False') . " | "; echo '
Dropdown actions in RED do not show a confirmation! Dropdown actions in BLUE will show a confirmation!