Web Admin (file manager)

free web hosting
Open Discussion > Have your say > General Talk

Web Admin (file manager)

jamez
i wanna share this web admin (file manager) written in php that i have downloaded in the script sites.. try it and enjoy!!

COPY THE CODE AND SAVE IT AS *filename*.php THEN UPLOAD IT TO YOUR WEBSERVER RUNNING A PHP.

[CODE]
<?php
/*
* webadmin.php - a simple Web-based file manager
* Copyright (C) 2004 Daniel Wacker <daniel.wacker@web.de>
*
* 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 received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* -------------------------------------------------------------------------
* While using this script, do NOT navigate with your browser's back and
* forward buttons! Always open files in a new browser tab!
* -------------------------------------------------------------------------
*
* This is Version 0.9, revision 7
* =========================================================================
*
* Changes of revision 7
* <szuniga@vtr.net>
* added Spanish translation
* <lars@soelgaard.net>
* added Danish translation
* <daniel.wacker@web.de>
* improved rename dialog
*
* Changes of revision 6
* <nederkoorn@tiscali.nl>
* added Dutch translation
*
* Changes of revision 5
* <daniel.wacker@web.de>
* added language auto select
* fixed symlinks in directory listing
* removed word-wrap in edit textarea
*
* Changes of revision 4
* <daloan@guideo.fr>
* added French translation
* <anders@wiik.cc>
* added Swedish translation
*
* Changes of revision 3
* <nzunta@gabriele-erba.it>
* improved Italian translation
*
* Changes of revision 2
* <daniel.wacker@web.de>
* got images work in some old browsers
* fixed creation of directories
* fixed files deletion
* improved path handling
* added missing word 'not_created'
* <till@tuxen.de>
* improved human readability of file sizes
* <nzunta@gabriele-erba.it>
* added Italian translation
*
* Changes of revision 1
* <daniel.wacker@web.de>
* webadmin.php completely rewritten:
* - clean XHTML/CSS output
* - several files selectable
* - support for windows servers
* - no more treeview, because
* - webadmin.php is a >simple< file manager
* - performance problems (too much additional code)
* - I don't like: frames, java-script, to reload after every treeview-click
* - execution of shell scripts
* - introduced revision numbers
*
/* ------------------------------------------------------------------------- */

/* Your language:
* 'en' - English
* 'de' - German
* 'fr' - French
* 'it' - Italian
* 'nl' - Dutch
* 'se' - Swedish
* 'sp' - Spanish
* 'dk' - Danish
* 'auto' - autoselect
*/
$lang = 'auto';

/* Charset of your filenames:
*/
$charset = 'ISO-8859-1';

/* Homedir:
* For example: './' - the script's directory
*/
$homedir = './';

/* Size of the edit textarea
*/
$editcols = 80;
$editrows = 25;

/* -------------------------------------------
* Optional configuration (remove # to enable)
*/

/* Permission of created directories:
* For example: 0705 would be 'drwx---r-x'.
*/
# $dirpermission = 0705;

/* Permission of created files:
* For example: 0604 would be '-rw----r--'.
*/
# $filepermission = 0604;

/* Filenames related to the apache web server:
*/
$htaccess = '.htaccess';
$htpasswd = '.htpasswd';

/* ------------------------------------------------------------------------- */

if (get_magic_quotes_gpc()) {
array_walk($_GET, 'strip');
array_walk($_POST, 'strip');
array_walk($_REQUEST, 'strip');
}

if (array_key_exists('image', $_GET)) {
header('Content-Type: image/gif');
die(getimage($_GET['image']));
}

$delim = DIRECTORY_SEPARATOR;

if (function_exists('php_uname')) {
$win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false;
} else {
$win = ($delim == '') ? true : false;
}

if (!empty($_SERVER['PATH_TRANSLATED'])) {
$scriptdir = dirname($_SERVER['PATH_TRANSLATED']);
} elseif (!empty($_SERVER['SCRIPT_FILENAME'])) {
$scriptdir = dirname($_SERVER['SCRIPT_FILENAME']);
} elseif (function_exists('getcwd')) {
$scriptdir = getcwd();
} else {
$scriptdir = '.';
}
$homedir = relative2absolute($homedir, $scriptdir);

$dir = (array_key_exists('dir', $_REQUEST)) ? $_REQUEST['dir'] : $homedir;

if (array_key_exists('olddir', $_POST) && !path_is_relative($_POST['olddir'])) {
$dir = relative2absolute($dir, $_POST['olddir']);
}

$directory = simplify_path(addslash($dir));

$files = array();
$action = '';
if (!empty($_POST['submit_all'])) {
$action = $_POST['action_all'];
for ($i = 0; $i < $_POST['num']; $i++) {
if (array_key_exists("checked$i", $_POST) && $_POST["checked$i"] == 'true') {
$files[] = $_POST["file$i"];
}
}
} elseif (!empty($_REQUEST['action'])) {
$action = $_REQUEST['action'];
$files[] = relative2absolute($_REQUEST['file'], $directory);
} elseif (!empty($_POST['submit_upload']) && !empty($_FILES['upload']['name'])) {
$files[] = $_FILES['upload'];
$action = 'upload';
} elseif (array_key_exists('num', $_POST)) {
for ($i = 0; $i < $_POST['num']; $i++) {
if (array_key_exists("submit$i", $_POST)) break;
}
if ($i < $_POST['num']) {
$action = $_POST["action$i"];
$files[] = $_POST["file$i"];
}
}
if (empty($action) && (!empty($_POST['submit_create']) || (array_key_exists('focus', $_POST) && $_POST['focus'] == 'create')) && !empty($_POST['create_name'])) {
$files[] = relative2absolute($_POST['create_name'], $directory);
switch ($_POST['create_type']) {
case 'directory':
$action = 'create_directory';
break;
case 'file':
$action = 'create_file';
}
}
if (sizeof($files) == 0) $action = ''; else $file = reset($files);

if ($lang == 'auto') {
if (array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER) && strlen($_SERVER['HTTP_ACCEPT_LANGUAGE']) >= 2) {
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
} else {
$lang = 'en';
}
}

$words = getwords($lang);

$cols = ($win) ? 4 : 7;

if (!isset($dirpermission)) {
$dirpermission = (function_exists('umask')) ? (0777 & ~umask()) : 0755;
}
if (!isset($filepermission)) {
$filepermission = (function_exists('umask')) ? (0666 & ~umask()) : 0644;
}

if (!empty($_SERVER['SCRIPT_NAME'])) {
$self = html(basename($_SERVER['SCRIPT_NAME']));
} elseif (!empty($_SERVER['PHP_SELF'])) {
$self = html(basename($_SERVER['PHP_SELF']));
} else {
$self = '';
}

if (!empty($_SERVER['SERVER_SOFTWARE'])) {
if (strtolower(substr($_SERVER['SERVER_SOFTWARE'], 0, 6)) == 'apache') {
$apache = true;
} else {
$apache = false;
}
} else {
$apache = true;
}

switch ($action) {

case 'view':

if (is_script($file)) {

/* highlight_file is a mess! */
ob_start();
highlight_file($file);
$src = ereg_replace('<font color="([^"]*)">', '<span style="color: 1">', ob_get_contents());
$src = str_replace(array('</font>', "r", "n"), array('</span>', '', ''), $src);
ob_end_clean();

html_header();
echo '<h2 style="text-align: left; margin-bottom: 0">' . html($file) . '</h2>

<hr />

<table>
<tr>
<td style="text-align: right; vertical-align: top; color: gray; padding-right: 3pt; border-right: 1px solid gray">
<pre style="margin-top: 0"><code>';

for ($i = 1; $i <= sizeof(file($file)); $i++) echo "$in";

echo '</code></pre>
</td>
<td style="text-align: left; vertical-align: top; padding-left: 3pt">
<pre style="margin-top: 0">' . $src . '</pre>
</td>
</tr>
</table>

';

html_footer();

} else {

header('Content-Type: ' . getmimetype($file));
header('Content-Disposition: filename=' . basename($file));

readfile($file);

}

break;

case 'download':

header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: ' . getmimetype($file));
header('Content-Disposition: attachment; filename=' . basename($file) . ';');
header('Content-Length: ' . filesize($file));

readfile($file);

break;

case 'upload':

$dest = relative2absolute($file['name'], $directory);

if (@file_exists($dest)) {
listing_page(error('already_exists', $dest));
} elseif (@move_uploaded_file($file['tmp_name'], $dest)) {
listing_page(notice('uploaded', $file['name']));
} else {
listing_page(error('not_uploaded', $file['name']));
}

break;

case 'create_directory':

if (@file_exists($file)) {
listing_page(error('already_exists', $file));
} else {
$old = @umask(0777 & ~$dirpermission);
if (@mkdir($file, $dirpermission)) {
listing_page(notice('created', $file));
} else {
listing_page(error('not_created', $file));
}
@umask($old);
}

break;

case 'create_file':

if (@file_exists($file)) {
listing_page(error('already_exists', $file));
} else {
$old = @umask(0777 & ~$filepermission);
if (@touch($file)) {
edit($file);
} else {
listing_page(error('not_created', $file));
}
@umask($old);
}

break;

case 'execute':

chdir(dirname($file));

$output = array();
$retval = 0;
exec('echo "./' . basename($file) . '" | /bin/sh', $output, $retval);

$error = ($retval == 0) ? false : true;

if (sizeof($output) == 0) $output = array('<' . $words['no_output'] . '>');

if ($error) {
listing_page(error('not_executed', $file, implode("n", $output)));
} else {
listing_page(notice('executed', $file, implode("n", $output)));
}

break;

case 'delete':

if (!empty($_POST['no'])) {
listing_page();
} elseif (!empty($_POST['yes'])) {

$failure = array();
$success = array();

foreach ($files as $file) {
if (del($file)) {
$success[] = $file;
} else {
$failure[] = $file;
}
}

$message = '';
if (sizeof($failure) > 0) {
$message = error('not_deleted', implode("n", $failure));
}
if (sizeof($success) > 0) {
$message .= notice('deleted', implode("n", $success));
}

listing_page($message);

} else {

html_header();

echo '<form action="' . $self . '" method="post">
<table class="dialog">
<tr>
<td class="dialog">
';

request_dump();

echo "t<b>" . word('really_delete') . '</b>
<p>
';

foreach ($files as $file) {
echo "t" . html($file) . "<br />n";
}

echo ' </p>
<hr />
<input type="submit" name="no" value="' . word('no') . '" id="red_button" />
<input type="submit" name="yes" value="' . word('yes') . '" id="green_button" style="margin-left: 50px" />
</td>
</tr>
</table>
</form>

';

html_footer();

}

break;

case 'rename':

if (!empty($_POST['destination'])) {

$dest = relative2absolute($_POST['destination'], $directory);

if (!@file_exists($dest) && @rename($file, $dest)) {
listing_page(notice('renamed', $file, $dest));
} else {
listing_page(error('not_renamed', $file, $dest));
}

} else {

$name = basename($file);

html_header();

echo '<form action="' . $self . '" method="post">

<table class="dialog">
<tr>
<td class="dialog">
<input type="hidden" name="action" value="rename" />
<input type="hidden" name="file" value="' . html($file) . '" />
<input type="hidden" name="dir" value="' . html($directory) . '" />
<b>' . word('rename_file') . '</b>
<p>' . html($file) . '</p>
<b>' . substr($file, 0, strlen($file) - strlen($name)) . '</b>
<input type="text" name="destination" size="' . textfieldsize($name) . '" value="' . html($name) . '" />
<hr />
<input type="submit" value="' . word('rename') . '" />
</td>
</tr>
</table>

<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>

</form>

';

html_footer();

}

break;

case 'move':

if (!empty($_POST['destination'])) {

$dest = relative2absolute($_POST['destination'], $directory);

$failure = array();
$success = array();

foreach ($files as $file) {
$filename = substr($file, strlen($directory));
$d = $dest . $filename;
if (!@file_exists($d) && @rename($file, $d)) {
$success[] = $file;
} else {
$failure[] = $file;
}
}

$message = '';
if (sizeof($failure) > 0) {
$message = error('not_moved', implode("n", $failure), $dest);
}
if (sizeof($success) > 0) {
$message .= notice('moved', implode("n", $success), $dest);
}

listing_page($message);

} else {

html_header();

echo '<form action="' . $self . '" method="post">

<table class="dialog">
<tr>
<td class="dialog">
';

request_dump();

echo "t<b>" . word('move_files') . '</b>
<p>
';

foreach ($files as $file) {
echo "t" . html($file) . "<br />n";
}

echo ' </p>
<hr />
' . word('destination') . ':
<input type="text" name="destination" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" />
<input type="submit" value="' . word('move') . '" />
</td>
</tr>
</table>

<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>

</form>

';

html_footer();

}

break;

case 'copy':

if (!empty($_POST['destination'])) {

$dest = relative2absolute($_POST['destination'], $directory);

if (@is_dir($dest)) {

$failure = array();
$success = array();

foreach ($files as $file) {
$filename = substr($file, strlen($directory));
$d = addslash($dest) . $filename;
if (!@is_dir($file) && !@file_exists($d) && @copy($file, $d)) {
$success[] = $file;
} else {
$failure[] = $file;
}
}

$message = '';
if (sizeof($failure) > 0) {
$message = error('not_copied', implode("n", $failure), $dest);
}
if (sizeof($success) > 0) {
$message .= notice('copied', implode("n", $success), $dest);
}

listing_page($message);

} else {

if (!@file_exists($dest) && @copy($file, $dest)) {
listing_page(notice('copied', $file, $dest));
} else {
listing_page(error('not_copied', $file, $dest));
}

}

} else {

html_header();

echo '<form action="' . $self . '" method="post">

<table class="dialog">
<tr>
<td class="dialog">
';

request_dump();

echo "n<b>" . word('copy_files') . '</b>
<p>
';

foreach ($files as $file) {
echo "t" . html($file) . "<br />n";
}

echo ' </p>
<hr />
' . word('destination') . ':
<input type="text" name="destination" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" />
<input type="submit" value="' . word('copy') . '" />
</td>
</tr>
</table>

<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>

</form>

';

html_footer();

}

break;

case 'create_symlink':

if (!empty($_POST['destination'])) {

$dest = relative2absolute($_POST['destination'], $directory);

if (substr($dest, -1, 1) == $delim) $dest .= basename($file);

if (!empty($_POST['relative'])) $file = absolute2relative(addslash(dirname($dest)), $file);

if (!@file_exists($dest) && @symlink($file, $dest)) {
listing_page(notice('symlinked', $file, $dest));
} else {
listing_page(error('not_symlinked', $file, $dest));
}

} else {

html_header();

echo '<form action="' . $self . '" method="post">

<table class="dialog" id="symlink">
<tr>
<td style="vertical-align: top">' . word('destination') . ': </td>
<td>
<b>' . html($file) . '</b><br />
<input type="checkbox" name="relative" value="yes" id="checkbox_relative" checked="checked" style="margin-top: 1ex" />
<label for="checkbox_relative">' . word('relative') . '</label>
<input type="hidden" name="action" value="create_symlink" />
<input type="hidden" name="file" value="' . html($file) . '" />
<input type="hidden" name="dir" value="' . html($directory) . '" />
</td>
</tr>
<tr>
<td>' . word('symlink') . ': </td>
<td>
<input type="text" name="destination" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" />
<input type="submit" value="' . word('create_symlink') . '" />
</td>
</tr>
</table>

<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>

</form>

';

html_footer();

}

break;

case 'edit':

if (!empty($_POST['save'])) {

$content = str_replace("rn", "n", $_POST['content']);

if (($f = @fopen($file, 'w')) && @fwrite($f, $content) !== false && @fclose($f)) {
listing_page(notice('saved', $file));
} else {
listing_page(error('not_saved', $file));
}

} else {

if (@is_readable($file) && @is_writable($file)) {
edit($file);
} else {
listing_page(error('not_edited', $file));
}

}

break;

case 'permission':

if (!empty($_POST['set'])) {

$mode = 0;
if (!empty($_POST['ur'])) $mode |= 0400; if (!empty($_POST['uw'])) $mode |= 0200; if (!empty($_POST['ux'])) $mode |= 0100;
if (!empty($_POST['gr'])) $mode |= 0040; if (!empty($_POST['gw'])) $mode |= 0020; if (!empty($_POST['gx'])) $mode |= 0010;
if (!empty($_POST['or'])) $mode |= 0004; if (!empty($_POST['ow'])) $mode |= 0002; if (!empty($_POST['ox'])) $mode |= 0001;

if (@chmod($file, $mode)) {
listing_page(notice('permission_set', $file, decoct($mode)));
} else {
listing_page(error('permission_not_set', $file, decoct($mode)));
}

} else {

html_header();

$mode = fileperms($file);

echo '<form action="' . $self . '" method="post">

<table class="dialog">
<tr>
<td class="dialog">

<p style="margin: 0">' . phrase('permission_for', $file) . '</p>

<hr />

<table id="permission">
<tr>
<td></td>
<td style="border-right: 1px solid black">' . word('owner') . '</td>
<td style="border-right: 1px solid black">' . word('group') . '</td>
<td>' . word('other') . '</td>
</tr>
<tr>
<td style="text-align: right">' . word('read') . ':</td>
<td><input type="checkbox" name="ur" value="1"'; if ($mode & 00400) echo ' checked="checked"'; echo ' /></td>
<td><input type="checkbox" name="gr" value="1"'; if ($mode & 00040) echo ' checked="checked"'; echo ' /></td>
<td><input type="checkbox" name="or" value="1"'; if ($mode & 00004) echo ' checked="checked"'; echo ' /></td>
</tr>
<tr>
<td style="text-align: right">' . word('write') . ':</td>
<td><input type="checkbox" name="uw" value="1"'; if ($mode & 00200) echo ' checked="checked"'; echo ' /></td>
<td><input type="checkbox" name="gw" value="1"'; if ($mode & 00020) echo ' checked="checked"'; echo ' /></td>
<td><input type="checkbox" name="ow" value="1"'; if ($mode & 00002) echo ' checked="checked"'; echo ' /></td>
</tr>
<tr>
<td style="text-align: right">' . word('execute') . ':</td>
<td><input type="checkbox" name="ux" value="1"'; if ($mode & 00100) echo ' checked="checked"'; echo ' /></td>
<td><input type="checkbox" name="gx" value="1"'; if ($mode & 00010) echo ' checked="checked"'; echo ' /></td>
<td><input type="checkbox" name="ox" value="1"'; if ($mode & 00001) echo ' checked="checked"'; echo ' /></td>
</tr>
</table>

<hr />

<input type="submit" name="set" value="' . word('set') . '" />

<input type="hidden" name="action" value="permission" />
<input type="hidden" name="file" value="' . html($file) . '" />
<input type="hidden" name="dir" value="' . html($directory) . '" />

</td>
</tr>
</table>

<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>

</form>

';

html_footer();

}

break;

default:

listing_page();

}

/* ------------------------------------------------------------------------- */

function getlist ($directory) {
global $delim, $win;

if ($d = @opendir($directory)) {

while (($filename = @readdir($d)) !== false) {

$path = $directory . $filename;

if ($stat = @lstat($path)) {

$file = array(
'filename' => $filename,
'path' => $path,
'is_file' => @is_file($path),
'is_dir' => @is_dir($path),
'is_link' => @is_link($path),
'is_readable' => @is_readable($path),
'is_writable' => @is_writable($path),
'size' => $stat['size'],
'permission' => $stat['mode'],
'owner' => $stat['uid'],
'group' => $stat['gid'],
'mtime' => @filemtime($path),
'atime' => @fileatime($path),
'ctime' => @filectime($path)
);

if ($file['is_dir']) {
$file['is_executable'] = @file_exists($path . $delim . '.');
} else {
if (!$win) {
$file['is_executable'] = @is_executable($path);
} else {
$file['is_executable'] = true;
}
}

if ($file['is_link']) $file['target'] = @readlink($path);

if (function_exists('posix_getpwuid')) $file['owner_name'] = @reset(posix_getpwuid($file['owner']));
if (function_exists('posix_getgrgid')) $file['group_name'] = @reset(posix_getgrgid($file['group']));

$files[] = $file;

}

}

return $files;

} else {
return false;
}

}

function sortlist (&$list, $key, $reverse) {

quicksort($list, 0, sizeof($list) - 1, $key);

if ($reverse) $list = array_reverse($list);

}

function quicksort (&$array, $first, $last, $key) {

if ($first < $last) {

$cmp = $array[floor(($first + $last) / 2)][$key];

$l = $first;
$r = $last;

while ($l <= $r) {

while ($array[$l][$key] < $cmp) $l++;
while ($array[$r][$key] > $cmp) $r--;

if ($l <= $r) {

$tmp = $array[$l];
$array[$l] = $array[$r];
$array[$r] = $tmp;

$l++;
$r--;

}

}

quicksort($array, $first, $r, $key);
quicksort($array, $l, $last, $key);

}

}

function permission_octal2string ($mode) {

if (($mode & 0xC000) === 0xC000) {
$type = 's';
} elseif (($mode & 0xA000) === 0xA000) {
$type = 'l';
} elseif (($mode & 0x8000) === 0x8000) {
$type = '-';
} elseif (($mode & 0x6000) === 0x6000) {
$type = 'b';
} elseif (($mode & 0x4000) === 0x4000) {
$type = 'd';
} elseif (($mode & 0x2000) === 0x2000) {
$type = 'c';
} elseif (($mode & 0x1000) === 0x1000) {
$type = 'p';
} else {
$type = '?';
}

$owner = ($mode & 00400) ? 'r' : '-';
$owner .= ($mode & 00200) ? 'w' : '-';
if ($mode & 0x800) {
$owner .= ($mode & 00100) ? 's' : 'S';
} else {
$owner .= ($mode & 00100) ? 'x' : '-';
}

$group = ($mode & 00040) ? 'r' : '-';
$group .= ($mode & 00020) ? 'w' : '-';
if ($mode & 0x400) {
$group .= ($mode & 00010) ? 's' : 'S';
} else {
$group .= ($mode & 00010) ? 'x' : '-';
}

$other = ($mode & 00004) ? 'r' : '-';
$other .= ($mode & 00002) ? 'w' : '-';
if ($mode & 0x200) {
$other .= ($mode & 00001) ? 't' : 'T';
} else {
$other .= ($mode & 00001) ? 'x' : '-';
}

return $type . $owner . $group . $other;

}

function is_script ($filename) {
return ereg('.php$|.php3$|.php4$|.php5$', $filename);
}

function getmimetype ($filename) {
static $mimes = array(
'.jpg$|.jpeg$' => 'image/jpeg',
'.gif$' => 'image/gif',
'.png$' => 'image/png',
'.html$|.html$' => 'text/html',
'.txt$|.asc$' => 'text/plain',
'.xml$|.xsl$' => 'application/xml',
'.pdf$' => 'application/pdf'
);

foreach ($mimes as $regex => $mime) {
if (eregi($regex, $filename)) return $mime;
}

// return 'application/octet-stream';
return 'text/plain';

}

function del ($file) {
global $delim;

if (!@is_link($file) && !file_exists($file)) return false;

if (!@is_link($file) && @is_dir($file)) {

if ($dir = @opendir($file)) {

$error = false;

while (($f = readdir($dir)) !== false) {
if ($f != '.' && $f != '..' && !del($file . $delim . $f)) {
$error = true;
}
}
closedir($dir);

if (!$error) return @rmdir($file);

return !$error;

} else {
return false;
}

} else {
return @unlink($file);
}

}

function addslash ($directory) {
global $delim;

if (substr($directory, -1, 1) != $delim) {
return $directory . $delim;
} else {
return $directory;
}

}

function relative2absolute ($string, $directory) {

if (path_is_relative($string)) {
return simplify_path(addslash($directory) . $string);
} else {
return simplify_path($string);
}

}

function path_is_relative ($path) {
global $win;

if ($win) {
return (substr($path, 1, 1) != ':');
} else {
return (substr($path, 0, 1) != '/');
}

}

function absolute2relative ($directory, $target) {
global $delim;

$path = '';
while ($directory != $target) {
if ($directory == substr($target, 0, strlen($directory))) {
$path .= substr($target, strlen($directory));
break;
} else {
$path .= '..' . $delim;
$directory = substr($directory, 0, strrpos(substr($directory, 0, -1), $delim) + 1);
}
}
if ($path == '') $path = '.';

return $path;

}

function simplify_path ($path) {
global $delim;

if (@file_exists($path) && function_exists('realpath') && @realpath($path) != '') {
$path = realpath($path);
if (@is_dir($path)) {
return addslash($path);
} else {
return $path;
}
}

$pattern = $delim . '.' . $delim;

if (@is_dir($path)) {
$path = addslash($path);
}

while (strpos($path, $pattern) !== false) {
$path = str_replace($pattern, $delim, $path);
}

$e = addslashes($delim);
$regex = $e . '((.[^.' . $e . '][^' . $e . ']*)|(..[^' . $e . ']+)|([^.][^' . $e . ']*))' . $e . '..' . $e;

while (ereg($regex, $path)) {
$path = ereg_replace($regex, $delim, $path);
}

return $path;

}

function human_filesize ($filesize) {

$suffices = 'kMGTPE';

$n = 0;
while ($filesize >= 1000) {
$filesize /= 1024;
$n++;
}

$filesize = round($filesize, 3 - strpos($filesize, '.'));

if (strpos($filesize, '.') !== false) {
while (in_array(substr($filesize, -1, 1), array('0', '.'))) {
$filesize = substr($filesize, 0, strlen($filesize) - 1);
}
}

$suffix = (($n == 0) ? '' : substr($suffices, $n - 1, 1));

return $filesize . " {$suffix}B";

}

function strip (&$str) {
$str = stripslashes($str);
}

/* ------------------------------------------------------------------------- */

function listing_page ($message = null) {
global $self, $directory, $sort, $reverse;

html_header();

$list = getlist($directory);

if (array_key_exists('sort', $_GET)) $sort = $_GET['sort']; else $sort = 'filename';
if (array_key_exists('reverse', $_GET) && $_GET['reverse'] == 'true') $reverse = true; else $reverse = false;

sortlist($list, $sort, $reverse);

echo '<h1 style="margin-bottom: 0">webadmin.php</h1>

<form enctype="multipart/form-data" action="' . $self . '" method="post">

<table id="main">
';

directory_choice();

if (!empty($message)) {
spacer();
echo $message;
}

if (@is_writable($directory)) {
upload_box();
create_box();
} else {
spacer();
}

if ($list) {
listing($list);
} else {
echo error('not_readable', $directory);
}

echo '</table>

</form>

';

html_footer();

}

function listing ($list) {
global $directory, $homedir, $sort, $reverse, $win, $cols, $date_format, $self;

echo '<tr class="listing">
<th style="text-align: center; vertical-align: middle"><img src="' . $self . '?image=smiley" alt="smiley" /></th>
';

$d = 'dir=' . urlencode($directory) . '&amp;';

if (!$reverse && $sort == 'filename') $r = '&amp;reverse=true'; else $r = '';
echo "t<th class="filename"><a href="$self?{$d}sort=filename$r">" . word('filename') . "</a></th>n";

if (!$reverse && $sort == 'size') $r = '&amp;reverse=true'; else $r = '';
echo "t<th class="size"><a href="$self?{$d}sort=size$r">" . word('size') . "</a></th>n";

if (!$win) {

if (!$reverse && $sort == 'permission') $r = '&amp;reverse=true'; else $r = '';
echo "t<th class="permission_header"><a href="$self?{$d}sort=permission$r">" . word('permission') . "</a></th>n";

if (!$reverse && $sort == 'owner') $r = '&amp;reverse=true'; else $r = '';
echo "t<th class="owner"><a href="$self?{$d}sort=owner$r">" . word('owner') . "</a></th>n";

if (!$reverse && $sort == 'group') $r = '&amp;reverse=true'; else $r = '';
echo "t<th class="group"><a href="$self?{$d}sort=group$r">" . word('group') . "</a></th>n";

}

echo ' <th class="functions">' . word('functions') . '</th>
</tr>
';

for ($i = 0; $i < sizeof($list); $i++) {
$file = $list[$i];

$timestamps = 'mtime: ' . date($date_format, $file['mtime']) . ', ';
$timestamps .= 'atime: ' . date($date_format, $file['atime']) . ', ';
$timestamps .= 'ctime: ' . date($date_format, $file['ctime']);

echo '<tr class="listing">
<td class="checkbox"><input type="checkbox" name="checked' . $i . '" value="true" onfocus="activate('other')" /></td>
<td class="filename" title="' . html($timestamps) . '">';

if ($file['is_link']) {

echo '<img src="' . $self . '?image=link" alt="link" /> ';
echo html($file['filename']) . ' &rarr; ';

$real_file = relative2absolute($file['target'], $directory);

if (@is_readable($real_file)) {
if (@is_dir($real_file)) {
echo '[ <a href="' . $self . '?dir=' . urlencode($real_file) . '">' . html($file['target']) . '</a> ]';
} else {
echo '<a href="' . $self . '?action=view&amp;file=' . urlencode($real_file) . '">' . html($file['target']) . '</a>';
}
} else {
echo html($file['target']);
}

} elseif ($file['is_dir']) {

echo '<img src="' . $self . '?image=folder" alt="folder" /> [ ';
if ($win || $file['is_executable']) {
echo '<a href="' . $self . '?dir=' . urlencode($file['path']) . '">' . html($file['filename']) . '</a>';
} else {
echo html($file['filename']);
}
echo ' ]';

} else {

if (substr($file['filename'], 0, 1) == '.') {
echo '<img src="' . $self . '?image=hidden_file" alt="hidden file" /> ';
} else {
echo '<img src="' . $self . '?image=file" alt="file" /> ';
}

if ($file['is_file'] && $file['is_readable']) {
echo '<a href="' . $self . '?action=view&amp;file=' . urlencode($file['path']) . '">' . html($file['filename']) . '</a>';
} else {
echo html($file['filename']);
}

}

if ($file['size'] >= 1000) {
$human = ' title="' . human_filesize($file['size']) . '"';
} else {
$human = '';
}

echo "t<td class="size"$human>{$file['size']} B</td>n";

if (!$win) {

echo "t<td class="permission" title="" . decoct($file['permission']) . '">';

$l = !$file['is_link'] && (!function_exists('posix_getuid') || $file['owner'] == posix_getuid());
if ($l) echo '<a href="' . $self . '?action=permission&amp;file=' . urlencode($file['path']) . '&amp;dir=' . urlencode($directory) . '">';
echo html(permission_octal2string($file['permission']));
if ($l) echo '</a>';

echo "</td>n";

if (array_key_exists('owner_name', $file)) {
echo "t<td class="owner" title="uid: {$file['owner']}">{$file['owner_name']}</td>n";
} else {
echo "t<td class="owner">{$file['owner']}</td>n";
}

if (array_key_exists('group_name', $file)) {
echo "t<td class="group" title="gid: {$file['group']}">{$file['group_name']}</td>n";
} else {
echo "t<td class="group">{$file['group']}</td>n";
}

}

echo ' <td class="functions">
<input type="hidden" name="file' . $i . '" value="' . html($file['path']) . '" />
';

$actions = array();
if (function_exists('symlink')) {
$actions[] = 'create_symlink';
}
if (@is_writable(dirname($file['path']))) {
$actions[] = 'delete';
$actions[] = 'rename';
$actions[] = 'move';
}
if ($file['is_file'] && $file['is_readable']) {
$actions[] = 'copy';
$actions[] = 'download';
if ($file['is_writable']) $actions[] = 'edit';
}
if (!$win && function_exists('exec') && $file['is_file'] && $file['is_executable'] && file_exists('/bin/sh')) {
$actions[] = 'execute';
}

if (sizeof($actions) > 0) {

echo ' <select class="small" name="action' . $i . '" size="1">
<option value="">' . str_repeat('&nbsp;', 30) . '</option>
';

foreach ($actions as $action) {
echo "tt<option value="$action">" . word($action) . "</option>n";
}

echo ' </select>
<input class="small" type="submit" name="submit' . $i . '" value=" &gt; " onfocus="activate('other')" />
';

}

echo ' </td>
</tr>
';

}

echo '<tr class="listing_footer">
<td style="text-align: right; vertical-align: top"><img src="' . $self . '?image=arrow" alt="&gt;" /></td>
<td colspan="' . ($cols - 1) . '">
<input type="hidden" name="num" value="' . sizeof($list) . '" />
<input type="hidden" name="focus" value="" />
<input type="hidden" name="olddir" value="' . html($directory) . '" />
';

$actions = array();
if (@is_writable(dirname($file['path']))) {
$actions[] = 'delete';
$actions[] = 'move';
}
$actions[] = 'copy';

echo ' <select class="small" name="action_all" size="1">
<option value="">' . str_repeat('&nbsp;', 30) . '</option>
';

foreach ($actions as $action) {
echo "tt<option value="$action">" . word($action)

 

 

 


Reply

wildteen88
jamez, we have a problem! Seems that the forum has cut off the bottom of the script! Post alink to where you got it from so we can download it man.

Reply

Niosis
Dood, it's wildteen.

Reply

God
QUOTE
jamez, we have a problem! Seems that the forum has cut off the bottom of the script! Post alink to where you got it from so we can download it man.


And post it in a code block.

Reply

wildteen88
Niosis,

What you mean its wildteen! Aint I liked!

CodeFX,

He all ready has put this in the code blocks

[ code:1:2024ebc54d ] (without spaces, ofcourse).

That number bit is MySQL's refrence number for the code blocks. Also it may seem that MySQl has hit the maximum characters! As its so big! lol

But yeah lin would be nice jamez!

Reply

adrein
Is this a script where you can manage your files without using FTP Connection?

Reply

adrein
Is this a script where you can manage your files without using FTP Connection?

Reply

welbis
yes, but half of it is missing at the moment.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. admin file disposition - 29.39 hr back. (1)
  2. index of/file webadmin - 78.39 hr back. (1)
  3. nulled web based file manager - 285.07 hr back. (1)
  4. cpanel "file owner" "file manager" - 741.63 hr back. (1)
  5. intitle:webadmin.php filename^ - 863.50 hr back. (1)
Similar Topics

Keywords : web, admin, file, manager

  1. Secure File Transfer For Mainframe Systems
    (2)
  2. Birthday Boy Opaque
    Happy Birthday Trap17 Admin OpaQue (30)
    Hello, Another year older yes boys and girls It is OpaQue's birthday today but wait it
    isn't his birthday yet.. It is in another 4 hours /tongue.gif" style="vertical-align:middle"
    emoid=":P" border="0" alt="tongue.gif" /> i.e 1st of December is OpaQue's birthday. I am happy
    to wish him a very happy birthday for he has worked his *bottom* off for this forum and has never
    taken a time out.. I mean whenever I come online, he is online and the weird bit is that we have
    different time zones so that is a bit freaky to see him in the middle of the night working o....
  3. Will There Be A free Image, File, Video And Flash Host?
    (5)
    Do you think there will ever be a free Image, File, Video, and flash host all on one site? I doubt
    there is, and wouldn't it be great if you could register and have your own account, kinda like a
    photobucket layout, but with more file extensions and file hosting, if there is link me right
    away! It would be so awesome if they had unlimited image size and 5 minute video length. well
    what are your thoughts on this?....
  4. Happy Birthday Buffalohelp. Let's All Wish Buffalohelp A Wonderful Birthday.
    Let's wish our great admin a nice birthday today. (28)
    I was checking things out here in here as usual. And I see in today's birthdays. It's
    BuffaloHELP 's birthday today. Happy birthday BuffaloHELP I hope you have a wonderful
    birthday today and that you eat lot's of cake and thanks for being such a wonderful Admin
    in here. You help out alot of people in here when you are able to. And again Happy Birthday big guy
    and many more yet to come. Happy Birthday to you, Happy Birthday to you Happy Birthday dear
    BuffaloHELP, Happy Birthday to you and many more. HAPPY BIRTHDAY BuffaloHELP ....
  5. Need File Host
    (7)
    i require a host to host files that has a good upload speed (unlike megaupload, sendspace) it
    can't be filefront cuz i got banned for it not being game stuff. max file limit anythign over
    100mb ....
  6. Favor From Admin/mod Needed
    (5)
    If you get a sec could you take me a screen shot of a blank post showing the moderation buttons?
    Thanks Pm me & ill give you my email. ....
  7. Merry Xmas From The Admin & Mods
    (13)
    Let me be the First to Say Merry Xmas from the Admin and Moderators and that you all have a good
    holidays as well. I got 3 Hours till its official for me but for the eastern world you all have a
    good start on us. /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' />
    /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' /> So Enjoy your xmas and
    see most of you on the Next Year.....
  8. The Admin Thing
    (5)
    What is the coding for the box that an admin or moderator does when someone breaks the rules. Just
    curious. PS: I understand you if you think this makes no sense.....
  9. DL Manager and Anti Leech
    (2)
    Anyone know where I can get script for a decent free Download Manager (soomethin to track my sites
    downloads) and a anti lech to prevent leeching of my downloads.....
  10. Sig file problems
    (8)
    I have a signatue image I tried insert it using HTML -- BBCode EVERYTHING!! but it just
    displays my scripting-- What am i doing wrong? Pleas PM me -- Mike....
  11. Admin or stoneddevil please respond
    (4)
    QUOTE Well everyone has been asking about whats been going on, and whats going to happen. Well
    im hear to explain all. Well after a good run as a free host, admin has got to the point where
    he can longer keep up and pay for the free server. Also, he has been having tons of troubles with
    the free server, as you can all tell as of right now. So admin has decided to shut down, for the
    time being, the free hosting. This will happen as soon as he makes the switch to the new hosting
    name and company. Galaxy-Webhost.com That will be the new name of FNH. As you can tell....
  12. File Urls?
    (5)
    I upload files to the public folder under a new folder now if I want to link these files to
    hyperlinks on my site I need each files url. How do I go about finding this? Would these files if
    zipped up become "downloadable" to my users?....
  13. Loading values in txt file to database
    (0)
    I have a script that during the install, I am to run a file that is supposed to load zip code data
    into the database. It says it runs correctly at the end but yet the table in the database remains
    empty. Here is the code: PHP Code: CODE <? require('data.php');
    require('functions.php'); sql_connect();
    $file=file("admin/zip.txt"); $i=form_get("i"); $start=$i+1;
    $end=$start+5000; if($end>=count($file)){ $end=count($file);
    } for($i....
  14. What files are you supposed to have under file manager?
    (3)
    Can someone tell me the files that are supposed to be under file manager...thanks!....
  15. Admin...
    (0)
    The siteuptime statistics go to casanare.gov.co not here /wink.gif' border='0'
    style='vertical-align:middle' alt='wink.gif' /> ....
  16. Creating a settings file for your site (PHP)
    (0)
    Being a designer, sometimes it's easy to overlook the little things that you'll hate yourself for
    later on. For example, what if you change your domain name? Do you really want to change all 3254
    links on your site? Isn't there an easier way? Yes With a global settings file, you can
    avoid this altogether. Here's a template for creating such a file. CODE <?php
    /********************************************************** *      Functions, Variables, Ect for
    Revamp                                       * *           Author:  VampyreVein   ....
  17. html imput file
    (0)
    I would like to know if is possible to cange the file of the "html imput file" with source code
    Thanks....
  18. File size limit?
    (16)
    Is there a file size limit on the upload? Cause I'm trying to upload a file size of 1.97mb and
    everything it uploads at about 300kb it says QUOTE 421 Timeout (no new data for 900 seconds)
    Connection lost: vaio-hosting.com Transfer Failed! Anyhelp here?....
  19. Admin install please imagemagick or GD
    (1)
    admin can you install imagemagick or GD image on the server so i can use coppermine or 4images.
    thank you....
  20. Hi frnds and admin
    (4)
    Hi frnds m husain frm india..... 21 m m interest in mobile m plaing to start a site for which i
    hav requested....
  21. how to upload a file?
    (4)
    How to use file manager in cpanel to upload a file from another web source. As my college does not
    allow ftp acess. I tried once with a zip file it shows the size as one kb. is ther any other
    option.......
  22. Need: Public_html file...
    (2)
    I deleted it cuzz I thought I didn't need it :S Please someone send me it!!!....
  23. @ admin: please notice
    (0)
    There is a little problem with my internet connection at the moment, so I'm not able to log in every
    week. :? (At the moment I'm at a friend's house) Please do not delete my account. PLEASE. You'll
    notice me when I'm back online. So: stay cool, stay online, I'll be back soon. 8)....
  24. file format question
    (12)
    Can I put some zip or rar file on the free hosting account? because I want to share some file with
    my friend....
  25. Championship Manager 04/05
    (3)
    What do you think about championship manager??? Do you know release date 4.3.2005 /laugh.gif'
    border='0' style='vertical-align:middle' alt='laugh.gif' /> ....
  26. Donations??? -- (Idea For Admin)
    (13)
    I said this is a post, but wanted it to get noticed by admin. ADMIN: Just a honest, trying to
    help suggestion: Why not have a paypal donation button on the main page, or on the top of the forum,
    to allow happy members, who have extra cash every now and again, to help ya pay for this giant
    machine? Thanks for killer service!....
  27. Cpanel-->File Manager
    (6)
    I don't get that the File Manager works. I am not able to go up any file, I believe that has
    relationship with the problem of Cpanel I hope you can solve the problem. Thank you for all
    their help Thank you....
  28. Forum Admin Needed/wanted
    Read if interested! (5)
    Triple Triangle Org. is looking for a dedicated person who can be administrator of an Invision Power
    Board. All I ask is that this person have experience in customizing the boards and moderating. If
    you are interested in taking up this interesting project, please reply to this post or send an
    e-mail directly to tripletriangleradio@hotpop.com . I hope to see many replies!....
  29. Which File Extension Are You?
    (48)
    Ever wonder which file extension you are? /smile.gif' border='0' style='vertical-align:middle'
    alt='smile.gif' /> Take the following test. http://bbspot.com/News/2004/10/extension_quiz.php as
    for me: i'm a PDF! /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> true, true. i have a certain attachment to PDFs. i collect PDF ebooks, and
    even my default printer is set to print in PDF! /biggrin.gif' border='0'
    style='vertical-align:middle' alt='biggrin.gif' /> any web page i want, i just press Ctrl-P, and
    voila -- a PDF co....
  30. 2 Gb Free For File Storage Or Web Hosting
    don't wait to see the link (12)
    here it is: CODE http://www.omnilect.com Omnilect is your own web storage, built on
    the idea that you should be able to keep all the data you share in one place and access it anywhere.
    The key features are: 2,000 Megabytes - Just For You. You need plenty of space - but it should be
    space you can actually use. Omnilect gives you 2,000 megabytes of storage and lets you use your
    space however you want - for email, photos, blogs, or whatever. We provide the services and the
    space, you provide the data. Best Email, Calendar, & Addressbook. Omnilect has the b....

    1. Looking for web, admin, file, manager

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for web, admin, file, manager

*MORE FROM TRAP17.COM*
advertisement



Web Admin (file manager)



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE