'; echo ''; } } closedir($handle); } if ($total > 0) echo ''; else echo '[You have no files]'; } function register () { global $alert, $members; if (isset($_POST['name']) && isset($_POST['password']) && isset($_POST['spamcheck'])) { $name = $_POST['name']; $password = $_POST['password']; $spamcheck = $_POST['spamcheck']; // spam check if ($spamcheck != "FreeBasic is great!") {$alert = "You have failed the spam check!"; return;} // validate name and password if ($name == "" || $password == "") {$alert = "The name or password is blank!"; return;} vt($name); vt($password); for ($i = 0; $i < count($members); $i += 2) { if (strtolower($name) == strtolower($members[$i])) {$alert = "This account has already been registered!"; return;} } // append member data to file and make folder if (file_exists('data/members.dat')) append('data/members.dat', ';' . $name . ';' . hash('sha384', $password)); else { file_put_contents('data/members.dat', $name . ';' . hash('sha384', $password)); chmod('data/members.dat', 0700); } mkdir('uploads/' . strtolower($name)); chmod('uploads/' . strtolower($name), 0777); $alert = "Member $name is now registered!"; } } function login () { global $alert, $refresh, $members; if (isset($_POST['name']) && isset($_POST['password'])) { $name = $_POST['name']; $password = $_POST['password']; if ($name == "") { if (isset($_COOKIE['name']) && $password == "") { setcookie('name'); setcookie('password'); $refresh = 'You have been logged out!'; } else $alert = "No name was entered!"; } else { if ($password == "") { $alert = "No password was entered!"; return; } $cp = ""; // the password (must match the cookie); if blank, the user does not exist // find member in list to see what his password should be for ($i = 0; $i < count($members); $i += 2) { if (strtolower($name) == strtolower($members[$i])) {$cp = $members[$i + 1];} } if ($cp == "") { $alert = "This member does not exist!"; return; } if (hash('sha384', $password) == $cp) { setcookie('name', $name, time() + 3600 * 24 * 3650); setcookie('password', hash('sha384', $password), time() + 3600 * 24 * 3650); $refresh = 'You are now logged in!'; return; } else { $alert = "This password is incorrect!"; return; } } } } function upload_file ($filenumber) { global $login; if (!isset($_POST['filename' . $filenumber]) || !isset($_FILES['file' . $filenumber])) return; if ($_FILES['file' . $filenumber]['error'] == 4) return; $filename = strtolower($_POST['filename' . $filenumber]); // remove file extension from file name to avoid scripting $whitelist = array('.7z', '.a', '.avi', '.bas', '.bmp', '.dll', '.doc', '.docx', '.exe', '.flac', '.gif', '.jpg', '.mid', '.mod', '.mp3', '.mp4', '.mpg', '.mpeg', '.ogg', '.pdf', '.png', '.psd', '.rar', 'tar.bz2', '.tar.gz', '.txt', '.wmv', '.xls', '.xm', '.zip'); $fileextension = '.txt'; foreach ($whitelist as $item) { if (strpos($filename, $item) + strlen($item) == strlen($filename) && strpos($filename, $item) !== false) { $fileextension = $item; $filename = substr($filename, 0, strlen($filename) - strlen($item)); } } vt($filename); if ($_FILES['file' . $filenumber]['error'] != 0) return "Upload error #" . $_FILES['file' . $filenumber]['error'] . " has occured!"; if ($_FILES['file' . $filenumber]['size'] > 8388608) return "The file is too big!"; $filer = "uploads/" . strtolower($login) . "/$filename$fileextension"; $download_destination = getcwd() . "/$filer"; if (file_exists($download_destination) && !isset($_POST['overwrite'])) return "The file already exists!"; if (move_uploaded_file($_FILES['file' . $filenumber]['tmp_name'], $download_destination)) { chmod($download_destination, 0777); if (file_exists('data/files.dat')) append('data/files.dat', ";$filer"); else { file_put_contents('data/files.dat', $filer); chmod('data/files.dat', 0700); } return "Uploaded: $filer!"; } else return "This file cannot be uploaded!"; } function upload () { global $alert, $login; if ($login == '') {$alert = 'You are not logged in!'; return;} for ($i = 1; $i <= 3; $i ++) { $result = upload_file($i); if ($result != '') $alert .= "File #$i: $result
"; } } function manage () { global $alert, $login; if (isset($_POST['filename'])) { if ($login == '') {$alert = 'You are not logged in!'; return;} $filename = strtolower($_POST['filename']); vt($filename, '.'); $fullfile = 'uploads/' . strtolower($login) . '/' . $filename; if (!file_exists('./' . $fullfile)) {$alert = $fullfile . ' cannot be deleted (does not exist)!'; return;} if (unlink('./' . $fullfile)) $alert = $fullfile . ' was deleted!'; else $alert = $fullfile . ' cannot be deleted!'; } } function sidebar () { global $login; if ($login != "") { echo '
Welcome, ' . $login . '!

'; } // load file list if (file_exists('data/files.dat')) { $c = file_get_contents('data/files.dat'); $files = explode(';', $c); } else $c = array(); $end = count($files) - 11; if ($end < 0) {$end = 0;} echo '
Recent files:
'; echo ""; } function results () { global $action, $alert; if ($action == 'showmessage' && isset($_GET['message'])) $alert = $_GET['message']; if ($alert == '') return; echo '
Results:

'; echo $alert; echo "

\"Go "; echo "\"Go "; echo "\"Refresh"; echo '
'; } function refresh () { global $refresh; if ($refresh != '') echo ""; } initialize(); // load member list, attempt login validation, etc. switch ($action) { case 'register': register(); // register a member break; case 'login': login(); // log a member in or out (set cookie) break; case 'upload': upload(); // upload a file break; case 'manage': manage(); //manage (delete) a file break; } ?> Free File Hosting

Free File Hosting

Welcome to Free File!
We offer free file hosting for files up to !
Instant registration only asks for a name and password!
Allows unlimited bandwidth and hotlinking!

Update May 20: now you can upload three files at once!
You can register instantly, for free.
Only letters, numbers, hyphens, and underscores are allowed for the username and password.
You can register multiple accounts.
Register an account
Name

Password

Spam check


You can log in after you have registered.
Leave the form blank to log out.

If you forgot your member name, check the member list at the Uploads Page.
Log into an account
Name

Password


You can upload any clean file here, up to .
We have over 100GB free server space.
You have to be logged in to upload files.

Upload avatar.jpg to be listed at the Uploads Page!
Upload files
File #1


File #2


File #3



Allow uploads to overwrite existing files?

You can delete any files you have uploaded.
Delete a file
Free File is a file host created for quick, Ad-free file sharing.
If you need help or want to see the source code, you can email the admin.

Spread the word with this banner!
Free File Hosting!