CUBISTCODE

CUBISTCODE

Free PHP File Manager Script

<?
//a:9:{s:4:"lang";s:2:"en";s:9:"auth_pass";s:32:"d41d8cd98f00b204e9800998ecf8427e";s:8:"quota_mb";i:0;s:17:"upload_ext_filter";a:0:{}s:19:"download_ext_filter";a:0:{}s:15:"error_reporting";s:0:"";s:7:"fm_root";s:0:"";s:17:"cookie_cache_time";i:1096733048;s:7:"version";s:5:"0.9.3";}
/*--------------------------------------------------
 | PHP FILE MANAGER
 +--------------------------------------------------
 | phpFileManager 0.9.3
 | By Fabrício Seger Kolling
 | Copyright (c) 2004 Fabrício Seger Kolling
 | E-mail: dulldusk@nho.com.br
 | URL: http://phpfm.sf.net
 | Last Changed: 2004-09-02
 +--------------------------------------------------
 | OPEN SOURCE CONTRIBUTIONS
 +--------------------------------------------------
 | TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.0
 | By Devin Doucette
 | Copyright (c) 2004 Devin Doucette
 | E-mail: darksnoopy@shaw.ca
 | URL: http://www.phpclasses.org
 +--------------------------------------------------
 | It is the AUTHOR'S REQUEST that you keep intact the above header information
 | and notify him if you conceive BUGFIXES or any IMPROVEMENTS to this program.
 +--------------------------------------------------
 | LICENCE - GPL [ GNU General Public License ]
 +--------------------------------------------------
 | This program is FREE SOFTWARE; you can REDISTRIBUTE it and/or MODIFY
 | it under the terms of the GNU General Public License as published by
 | the Free Software Foundation; either version 2 of the License, or
 | (at your option) any later version.
 | This program is distributed in the hope that it will be useful,
 | but WITHOUT ANY WARRANTY; without even the implied warranty of
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | GNU General Public License for more details.
 | You should have gotten a copy of the GPL license with this program.
 | If not, it can found at http://www.gnu.org/copyleft/gpl.html
 +--------------------------------------------------
 | CONFIGURATION AND INSTALATION NOTES
 +--------------------------------------------------
 | This program does not include any instalation or configuration
 | notes because it simply does not require them.
 | Just throw this file anywhere in your webserver and enjoy !!
 +--------------------------------------------------
*/
// +--------------------------------------------------
// | Header and Globals
// +--------------------------------------------------
    header("Pragma: no-cache");
    header("Cache-Control: no-store");
    foreach ($_GET as $key => $val$$key=htmldecode($val);
    foreach ($_POST as $key => $val$$key=htmldecode($val);
    foreach ($_COOKIE as $key => $val$$key=htmldecode($val);
    if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip $_SERVER["REMOTE_ADDR"]; //nao usa proxy
    else $ip $_SERVER["HTTP_X_FORWARDED_FOR"]; //usa proxy
    $islinux = !(strtoupper(substr(PHP_OS03)) === 'WIN');
    $url_info parse_url($_SERVER["HTTP_REFERER"]);
    $doc_root = ($islinux) ? $_SERVER["DOCUMENT_ROOT"] : ucfirst($_SERVER["DOCUMENT_ROOT"]);
    $script_filename $doc_root.$_SERVER["PHP_SELF"];
    $path_info pathinfo($script_filename);
// +--------------------------------------------------
// | Config
// +--------------------------------------------------
    $cfg new config();
    $cfg->load();
    ini_set("display_errors",1);
    ini_set("error_reporting",$error_reporting);
    if (!isset($dir_atual)){
        $dir_atual $path_info["dirname"]."/";
        if (!$islinux$dir_atual ucfirst($dir_atual);
        @chmod($dir_atual,0777);
    else $dir_atual formatpath($dir_atual);
    $is_reachable = (stristr($dir_atual,$doc_root)!==false);
    // Auto Expand Local Path
    if (!isset($expanded_dir_list)){
        $expanded_dir_list "";
        $mat explode("/",$path_info["dirname"]);
        for ($x=0;$x<count($mat);$x++) $expanded_dir_list .= ":".$mat[$x];
        setcookie("expanded_dir_list"$expanded_dir_list0"/");
    }
    if (!isset($fm_root_atual)){
        if (strlen($fm_root)) $fm_root_atual $fm_root;
        else {
            if (!$islinux$fm_root_atual ucfirst($path_info["dirname"]."/");
            else $fm_root_atual $doc_root."/";
        }
        setcookie("fm_root_atual"$fm_root_atual0"/");
    elseif (isset($set_fm_root_atual)) {
        if (!$islinux$fm_root_atual ucfirst($set_fm_root_atual);
        setcookie("fm_root_atual"$fm_root_atual0"/");
    }
    if (!isset($resolveIDs)){
        setcookie("resolveIDs"0$cookie_cache_time"/");
    elseif (isset($set_resolveIDs)){
        $resolveIDs=($resolveIDs)?0:1;
        setcookie("resolveIDs"$resolveIDs$cookie_cache_time"/");
    }
    if ($resolveIDs){
        exec("cat /etc/passwd",$mat_passwd);
        exec("cat /etc/group",$mat_group);
    }
    $fm_color['Bg'] = "EEEEEE";
    $fm_color['Text'] = "000000";
    $fm_color['Link'] = "992929";
    $fm_color['Mark'] = "A7D2E4";
    $fm_color['Dir'] = "CCCCCC";
    $fm_color['File'] = "EEEEEE";
    $fm_color['FileFirstCell'] = "FFFFFF";
    foreach($fm_color as $tag=>$color){
        $fm_color[$tag]=strtolower($color);
    }
// +--------------------------------------------------
// | File Manager Actions
// +--------------------------------------------------
if ($loggedon==$auth_pass){
    switch ($frame){
        case 1break// Empty Frame
        case 2frame2(); break;
        case 3frame3(); break;
        default:
            switch($action){
                case 1logout(); break;
                case 2config_form(); break;
                case 3download(); break;
                case 4view(); break;
                case 5server_info(); break;
                case 6execute(); break;
                case 7edit_file_form(); break;
                case 8chmod_form(); break;
                case 9shell_form(); break;
                case 10upload_form(); break;
                defaultframeset();
            }
    }
else {
    if (isset($senha)) login();
    else form_login();
}
// +--------------------------------------------------
// | Config Class
// +--------------------------------------------------
class config {
    var $data;
    var $filename;
    function config(){
        global $script_filename;
        $this->data array(
            'lang'=>'en',
            'auth_pass'=>md5(''),
            'quota_mb'=>0,
            'upload_ext_filter'=>array(),
            'download_ext_filter'=>array(),
            'error_reporting'=>'',
            'fm_root'=>'',
            'cookie_cache_time'=>time()+60*60*24*30// 30 Dias
            'version'=>'0.9.3'
            );
        $data false;
        $this->filename $script_filename;
        if (file_exists($this->filename)){
            $mat file($this->filename);
            $objdata trim(substr($mat[1],2));
            if (strlen($objdata)) $data unserialize($objdata);
        }
        if (is_array($data)&&count($data)==count($this->data)) $this->data $data;
        else $this->save();
    }
    function save(){
        $objdata "<?".chr(13).chr(10)."//".serialize($this->data).chr(13).chr(10);
        if (strlen($objdata)){
            if (file_exists($this->filename)){
                $mat file($this->filename);
                if ($fh @fopen($this->filename"w")){
                    @fputs($fh,$objdata,strlen($objdata));
                    for ($x=2;$x<count($mat);$x++) @fputs($fh,$mat[$x],strlen($mat[$x]));
                    @fclose($fh);
                }
            }
        }
    }
    function load(){
        foreach ($this->data as $key => $val$GLOBALS[$key] = $val;
    }
}
// +--------------------------------------------------
// | Internationalization
// +--------------------------------------------------
function et($tag){
    global $lang;
    // English
    $en['Version'] = 'Version';
    $en['DocRoot'] = 'Document Root';
    $en['FLRoot'] = 'File Manager Root';
    $en['Name'] = 'Name';
    $en['And'] = 'and';
    $en['Enter'] = 'Enter';
    $en['Send'] = 'Send';
    $en['Refresh'] = 'Refresh';
    $en['SaveConfig'] = 'Save Configurations';
    $en['SavePass'] = 'Save Password';
    $en['SaveFile'] = 'Save File';
    $en['Save'] = 'Save';
    $en['Leave'] = 'Leave';
    $en['Edit'] = 'Edit';
    $en['View'] = 'View';
    $en['Config'] = 'Config';
    $en['Ren'] = 'Rename';
    $en['Rem'] = 'Delete';
    $en['Compress'] = 'Compress';
    $en['Decompress'] = 'Decompress';
    $en['ResolveIDs'] = 'Resolve IDs';
    $en['Move'] = 'Move';
    $en['Copy'] = 'Copy';
    $en['ServerInfo'] = 'Server Info';
    $en['CreateDir'] = 'Create Directory';
    $en['CreateArq'] = 'Create File';
    $en['ExecCmd'] = 'Execute Command';
    $en['Upload'] = 'Upload';
    $en['UploadEnd'] = 'Upload Finished';
    $en['Perms'] = 'Permissions';
    $en['Owner'] = 'Owner';
    $en['Group'] = 'Group';
    $en['Other'] = 'Other';
    $en['Size'] = 'Size';
    $en['Date'] = 'Date';
    $en['Type'] = 'Type';
    $en['Free'] = 'free';
    $en['Shell'] = 'Shell';
    $en['Read'] = 'Read';
    $en['Write'] = 'Write';
    $en['Exec'] = 'Execute';
    $en['Apply'] = 'Apply';
    $en['StickyBit'] = 'Sticky Bit';
    $en['Pass'] = 'Password';
    $en['Lang'] = 'Language';
    $en['File'] = 'File';
    $en['File_s'] = 'file(s)';
    $en['Dir_s'] = 'directory(s)';
    $en['To'] = 'to';
    $en['Destination'] = 'Destination';
    $en['Configurations'] = 'Configurations';
    $en['JSError'] = 'JavaScript Error';
    $en['NoSel'] = 'There are no selected itens';
    $en['SelDir'] = 'Select the destination directory on the left tree';
    $en['TypeDir'] = 'Enter the directory name';
    $en['TypeArq'] = 'Enter the file name';
    $en['TypeCmd'] = 'Enter the command';
    $en['TypeArqComp'] = 'Enter the file name.\\nThe extension will define the compression type.\\nEx:\\nnome.zip\\nnome.tar\\nnome.bzip\\nnome.gzip';
    $en['RemSel'] = 'DELETE selected itens';
    $en['NoDestDir'] = 'There is no selected destination directory';
    $en['DestEqOrig'] = 'Origin and destination directories are equal';
    $en['InvalidDest'] = 'Destination directory is invalid';
    $en['NoNewPerm'] = 'New permission not set';
    $en['CopyTo'] = 'COPY to';
    $en['MoveTo'] = 'MOVE to'
Tags: file, php, scripts, server, web


Rate This Article:



Privacy Policy | Copyright/Trademark Notification