OneFileCMS."; $config_disabled = "bmp,ico,gif,jpg,png,psd,zip"; $config_excluded = "onefilecms.php,favicon,.htaccess"; $version = "1.1.4"; // ONEFILECMS_BEGIN if( phpversion() < '5.0.0' ) { exit("OneFileCMS requires PHP5 to operate. Please contact your host to upgrade your PHP installation."); }; function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $starttime = getmicrotime(); session_start(); if (isset($_POST["onefilecms_username"])) { $_SESSION['onefilecms_username'] = $_POST["onefilecms_username"]; } if (isset($_POST["onefilecms_password"])) { $_SESSION['onefilecms_password'] = $_POST["onefilecms_password"]; } if (($_SESSION['onefilecms_username'] == $config_username) and ($_SESSION['onefilecms_password'] == $config_password || md5($_SESSION['onefilecms_password']) == $config_password)) { $_SESSION['onefilecms_valid'] = "1"; } else { $_SESSION['onefilecms_valid'] = "0"; if ($_GET["p"] !== "login") { header("Location: ".$_SERVER["php_self"]."?p=login"); } } global $pagetitle; $pagetitle = "/"; if ((isset($_GET["i"])) && ($_GET["i"] !== "")) { $pagetitle = "/".$_GET["i"]."/"; } global $page; $page = "index"; if (isset($_GET["p"])) { // redirect on invalid page attempts if (!in_array(strtolower($_GET["p"]), array( "copy","delete","error","deletefolder","edit","folder","index","login","logout","new","other","rename","renamefolder","upload" ))) { header("Location: /"); exit(); } $page = $_GET["p"]; } if ($_GET["p"] == "other") {$pagetitle = "Other"; } if ($_GET["p"] == "login") {$pagetitle = "Log In"; } if ($_GET["p"] == "logout") {$pagetitle = "Log Out"; $_SESSION['onefilecms_valid'] = "0"; session_destroy(); } if ($_GET["i"] == "") { unset($_GET["i"]); } // entitize get params foreach ($_GET as $name => $value) { $_GET[$name] = htmlentities($value); } // COPY FILE if (isset($_GET["c"])) { $filename = $_GET["c"]; $pagetitle = "Copy “".$filename."”"; $page = "copy"; } if (isset($_POST["copy_filename"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $old_filename = $_POST["old_filename"]; $filename = $_POST["copy_filename"]; copy($old_filename, $filename); $message = $old_filename." copied successfully to ".$filename."."; } // DELETE FILE if (isset($_GET["d"])) { $filename = $_GET["d"]; $pagetitle = "Delete “".$filename."”"; $page = "delete"; } if (isset($_POST["delete_filename"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $filename = $_POST["delete_filename"]; unlink($filename); $message = $filename." successfully deleted."; } // DELETE FOLDER if ($_GET["p"] == "deletefolder") { $pagetitle = "Delete Folder “".$_GET["i"]."”"; } if (isset($_POST["delete_foldername"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $foldername = $_POST["delete_foldername"]; if (@rmdir($foldername)) { $message = $foldername." successfully deleted."; } else { $message = "That folder is not empty."; } } // EDIT if (isset($_POST["filename"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $filename = $_POST["filename"]; $content = stripslashes($_POST["content"]); $fp = @fopen($filename, "w"); if ($fp) { fwrite($fp, $content); fclose($fp); } $message = $filename." saved successfully."; } if (isset($_GET["f"])) { $filename = stripslashes($_GET["f"]); if (file_exists($filename)) { $page = "edit"; $pagetitle = "Edit “".$filename."”"; $fp = @fopen($filename, "r"); if (filesize($filename) !== 0) { $loadcontent = fread($fp, filesize($filename)); $loadcontent = htmlspecialchars($loadcontent); } fclose($fp); } else { $page = "error"; unset ($filename); $message = "File does not exist."; } } // NEW FILE if ($_GET["p"] == "new") {$pagetitle = "New File"; } if (isset($_POST["new_filename"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $filename = $_POST["new_filename"]; if (file_exists($filename)) { $message = $filename." not created. A file with that name already exists."; } else { $handle = fopen($filename, 'w') or die("can't open file"); fclose($handle); $message = $filename." created successfully."; } } // NEW FOLDER if ($_GET["p"] == "folder") {$pagetitle = "New Folder"; } if (isset($_POST["new_folder"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $foldername = $_POST["new_folder"]; if (!is_dir($foldername)) { mkdir($foldername); $message = $foldername." created successfully."; } else { $message = "A folder by that name already exists."; } } // RENAME FILE if (isset($_GET["r"])) { $filename = $_GET["r"]; $pagetitle = "Rename “".$filename."”"; $page = "rename"; } if (isset($_POST["rename_filename"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $old_filename = $_POST["old_filename"]; $filename = $_POST["rename_filename"]; rename($old_filename, $filename); $message = $old_filename." successfully renamed to ".$filename."."; } // RENAME FOLDER if ($_GET["p"] == "renamefolder") {$pagetitle = "Rename Folder “".$_GET["i"]."”"; } if (isset($_POST["rename_foldername"]) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $old_foldername = $_POST["old_foldername"]; $foldername = $_POST["rename_foldername"]; if (rename($old_foldername, $foldername)) { $message = $old_foldername." unsuccessfully renamed to ".$foldername."."; } else { $message = "There was an error. Try again and/or contact your admin."; } } // UPLOAD FILE if ($_GET["p"] == "upload") {$pagetitle = "Upload File"; } if (isset($_FILES['upload_filename']['name']) && $_SESSION['onefilecms_valid'] = "1" && $_POST["sessionid"] == session_id()) { $filename = $_FILES['upload_filename']['name']; $destination = $_POST["upload_destination"]; if(move_uploaded_file($_FILES['upload_filename']['tmp_name'], $destination.basename($filename))) { $message = basename($filename)." uploaded successfully to ".$destination."."; } else{ $message = "There was an error. Try again and/or contact your admin."; } } ?>
Existing files with the same filename are automatically overwritten... Be careful!
Are you sure?
Folders have to be empty before they can be deleted.
?i=" class="folder">.. / ?i=" class="folder">
?p=new&i=" class="new">New File ?p=folder&i=" class="newfolder">New Folder ?p=deletefolder&i=" class="deletefolder">Delete Folder ?p=renamefolder&i=" class="renamefolder">Rename Folder ?p=upload&i=" class="upload">Upload File ?p=other" class="other">Other
You have successfully been logged out and may close this window.
Existing files with the same name will not be overwritten.
Existing folders with the same name will not be overwritten.
Future versions of OneFileCMS will have a one-click upgrade process. For now, though, you have to click this link. You are using version .
Let people know you use OneFileCMS by putting this in your footer:
This site powered by <a href="http://onefilecms.com/">OneFileCMS</a>.
Add this to your footer (or something) for lazy/forgetful admins. They'll still have to know the username and password, of course.
[<a href="">Admin</a>]
By the way, MD5 hash of your currently configured password is:
Existing files with the same filename are automatically overwritten... Be careful!
To move a file, preface its name with the folder's name, as in "foldername/filename.txt." The folder must already exist.