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!
'; echo ''; } } closedir($handle); } if ($total > 0) echo ''; else echo '[You have no files]'; } function register () { global $alert, $members; if (isset($_GET['register']) && 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($_GET['login']) && isset($_POST['name']) && isset($_POST['password'])) { $name = $_POST['name']; $password = $_POST['password']; vt($name); vt($password); if ($name == "") { if (isset($_COOKIE['name']) && $password == "") { setcookie('name'); setcookie('password'); $alert = "You have been logged out!"; $refresh = true; } 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 ($name == $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); $alert = "You are now logged in!"; $refresh = true; return; } else { $alert = "This password is incorrect!"; return; } } } } function upload () { global $alert, $login, $refresh; if (isset($_GET['upload']) && isset($_POST['filename']) && isset($_FILES['file'])) { $filename = strtolower($_POST['filename']); if ($login == "") {$alert = "You are not logged in!"; return;} if ($filename == "") {$alert = "No filename was entered!"; return;} // remove file extension from file name to avoid scripting $whitelist = array('.zip', '.rar', '.7z', '.jpg', '.gif', '.png', '.bmp', '.txt', '.exe', '.doc', '.xls', '.mp3', '.tar.gz', 'tar.bz2', '.flac', '.ogg', '.mid', '.xm', '.mod', '.mp4', '.avi', '.mpg', '.mpeg', '.swf'); $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']['error'] != 0) {$alert = "Upload error #" . $_FILES['file']['error'] . " has occured!"; return;} if ($_FILES['file']['size'] > 8388608) {$alert = "The file is too big!"; return;} $filer = "uploads/" . strtolower($login) . "/$filename$fileextension"; $download_destination = getcwd() . "/$filer"; if (move_uploaded_file($_FILES['file']['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); } $alert = "The file $filer was successfully uploaded!"; $refresh = true; } else { $alert = "This file cannot be uploaded!"; } } } function manage () { global $alert, $login; if (isset($_GET['delete']) && 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 = 'The file 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 . '!
Recent files:
"; echo "|
Welcome to Free File!
You can register instantly, for free.
You can log in after you have registered.
You can upload any clean file here, up to . You can delete any files you have uploaded.
Free File is a file host created for quick, Ad-free file sharing. |