"; } } echo "
";
?>
function get_true_size($FileSize) {
IF ($FileSize / 1024 > 1024) {
Return "" . Round($FileSize / 1024 / 1024 , 2) . " GB";
}ELSE{
if ($FileSize > 1024){
Return "" . Round($FileSize / 1024 , 2) . " MB";
}ELSE{
if ($FileSize < 1024) {
Return "" . Round($FileSize , 2) . " KB";
}
}
}
}
if ($action=="console"){
echo "$head
";
}
if ($action=="info"){
echo "$head
"; } if ($action=="copy"){ template(); $from = $dir/$p; echo "$head"; echo "
";
}
if ($action=="tempcopy"){
$from = $dir/$p;
$todir = $_POST['todir'];
$to = $todir/$p;
if($todir==$dir)
{
echo "$headCannot copy to the same directory.
";
}
elseif (!@copy($from,$to))
{
echo "$headCouldn't copy $p to $todir
";
}
}
if ($action=="upload"){
template();
$datum = Date("j.n.Y");
$cas = Date("H:i:s");
$warsize=1000000;
$maxsize=2000000;
$ms=$maxsize/1000;
$ws=$warsize/1000;
$ok=1;
$adresar="$dir/";
echo"$head
";
if($soubor)
{
$s=$adresar.$soubor_name;
if($soubor_size>$maxsize)
{
printf("File $soubor_name is bigger than $ms KB.");
$ok=0;
}
else if($soubor_size>$warsize)
printf("File $soubor_name is biggest than $ws KB.");
clearstatcache();
if($ok&&file_exists($s))
{
printf("File $soubor_name allready exist.");
$ok=0;
}
if ($ok)
{
if(!(copy($soubor,$s)))
printf("File $soubor_name can't be uploaded.");
else {
chmod($s,0644);
printf("File $soubor_name has been uploaded to $dir.");
}
}
}
}
?>
echo $head ?>
$docname = basename(getenv('script_name'));
function fileext ($file) {
$p = pathinfo($file);
return $p['extension'];
}
function convertsize($size){
$times = 0;
$comma = '.';
while ($size>1024){
$times++;
$size = $size/1024;
}
$size2 = floor($size);
$rest = $size - $size2;
$rest = $rest * 100;
$decimal = floor($rest);
$addsize = $decimal;
if ($decimal<10) {$addsize .= '0';};
if ($times == 0){$addsize=$size2;} else
{$addsize=$size2.$comma.substr($addsize,0,2);}
switch ($times) {
case 0 : $mega = ' bytes'; break;
case 1 : $mega = ' KB'; break;
case 2 : $mega = ' MB'; break;
case 3 : $mega = ' GB'; break;
case 4 : $mega = ' TB'; break;}
$addsize .= $mega;
return $addsize;
}
$actionzip = $_GET['actionzip'];
include "$imgdir/pclzip.lib.php";
chdir($dir);
$basedir = $dir;
$basedir = str_replace('\\','/',$basedir); //'
if (is_dir($basedir)) {
$parent = dirname($basedir);
$cur = $basedir;
while (substr($cur,0,1) == '/') {
$cur = substr($cur,1,strlen($cur));
$path .= '/'; }
$p_out = $path;
while (strlen($cur) > 0) {
$k = strpos($cur,'/');
if (!strpos($cur,'/')) $k = strlen($cur);
$s = substr($cur,0,$k);
$cur = substr($cur,$k+1,strlen($cur));
$path .= $s.'/';
$p_out .= "$s/";
}
$glob = array();$c = 0;
if ($dh = opendir(getcwd())) {
while (($file = readdir($dh)) !== false) {
if ($file != '..' && $file != '.') $glob[$c++] = $file;
}
closedir($dh);
}
foreach ($glob as $filename) {
if (is_dir($filename)) {
}
}
$filez = $glob;
reset($filez);
if (sizeof($filez) > 0)
foreach ($filez as $filename) {
if (strtolower(fileext($filename)) == 'zip')
if (is_file($filename)) {
}
}
echo "
";
}
$unzip = $_GET['unzip'];
if (is_file($unzip)) {
$zip = new PclZip($unzip);
if (($list = $zip->listContent()) == 0) {die("Error : ".$zip->errorInfo(true)); }
for ($i=0; $i
".($_GET[actionzip] == 'unzip' ? 'Unzipping' : 'Viewing')." file $unzip
";
echo "$fil files and $fold directories in archive
\n";
echo "Compressed archive size: ".convertsize($tot_comp)."
\n";
echo "Uncompressed archive size: ".convertsize($tot_uncomp)."
\n";
if ($_GET[actionzip] == 'unzip') {
echo "
Starting to decompress...
";
$zip->extract('');
echo "Archive sucessfuly extracted!
\n";
}
if ($_GET[actionzip] == 'view') {
echo "
";
for ($i=0; $i
";
} else {
echo $list[$i][stored_filename]." (".convertsize($list[$i][size]).")
";
}
}
}
echo "