View file file/loads/index.php

File size: 5.95Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);

extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);

session_name("SESID");
session_start();
require ("../../mysql.php");
require ("../../config.php");
require ("../../themes/$themes.php");
 include 'funct.php';
 include 'constant.php';
 @$folder = strip_tags(trim($_GET['a'])); @$n = strip_tags(trim($_GET['n']));
 if($_GET['a'] == '/') exit(ERROR_MESAGE);
  if($_GET['a'] == '\\') exit(ERROR_MESAGE);
if(strstr($_GET['a'],'/.')) exit(ERROR_MESAGE);
if(strstr($_GET['a'],'\.')) exit(ERROR_MESAGE);
if($n == '') {
     $n=0; 
    }
$ss = 0; $con = 0; $sok = 0;
  if($folder) {
   if(strstr($folder,'..')) exit(ERROR_MESAGE);
   $dir = @opendir('./'.$folder);
  } else {
     $dir = @opendir('./');
    } 
            while($file = @readdir($dir)) {
 if($file != '.' && $file != '..' && $file != '.htaccess'&& $file != 'index.php' && $file != 'kol.php' && $file != 'file.png' && $file != 'folder.png' && $file != 'comm.php' && $file != 'comm' && $file != 'user.png' && $file != 'funct.php' && $file != 'about.php' && $file != 'about' && $file != 'scr' && $file != 'read.php' && $file != 'pre.php' && $file != 'small' && $file != 'prew.php' && $file != 'cpre.php' && $file != 'ck' && $file != 'constant.php' && $file != 'd.php' && $file != 'ds' && $file != 'admin.php' && $file != 'config.php' && $file != 'in.html' && $file != '1.txt' && $file != 'kl.php' && $file != 'pr.php' && $file != 'screen.jpg') {
    if($con < $n) {
	  $con++; 
      continue;
	}
  if($sok < FILES_ON_PAGE) {
			 $name = $file;
			  $name = str_replace('_',' ',$name);
			  if(file_exists($folder.'/in.html')) require_once($folder.'/in.html');
			  if(file_exists($folder.'/1.txt')) require_once($folder.'/1.txt');
 if($folder) {
     $sz = filesize($folder.'/'.$file);
     $file = $folder.'/'.$file;
    }   else  {
	   $sz = filesize($file);
	}
 $fsize = round($sz/1024,1);
    if(is_file($file)) {
	 		if(time() - filectime($file) < IS_NEW_FILE) {
   if(!preg_match("[\.txt]",$name)) {			
  echo '<small>'.NEW_FILE_MESSAGE.' </small>'; 
  }
  }
     if(preg_match("[\.txt]",$name)) {
        $name = strtok($name,''); 
           if(!preg_match("[\.n\.d\.txt]",$name)) {
             $name = strtok($name,'.'); 
                 echo '<small><img src="file.png" alt=""/> <b><a href="?read='.$file.'&br='.$folder.'">'.trans($name,TRANSLATE_TXT).'</a></b></small><br/>'; 
            } elseif(preg_match("[\.n\.d\.txt]",$name)) {
              $name = strtok($name,'.');
                 echo '<small><img src="file.png" alt=""/> <b><a href="?read='.$file.'&br='.$folder.'">'.trans($name,TRANSLATE_NDTXT).'</a></b></small><br/>'; 
            } 
		} elseif(preg_match("[\.png]",$name) or preg_match("[\.gif]",$name) or preg_match("[\.jpg]",$name) or preg_match("[\.bmp]",$name) or preg_match("[\.JPG]",$name) or preg_match("[\.PNG]",$name)or preg_match("[\.GIF]",$name)) {
		       $fname = strtok($name,'.');
			   $name = str_replace(' ','_',$name);
                 echo '<small><img src="pr.php?img='.$file.'"/><br /> <b><a href="'.$file.'">'.trans($name,TRANSLATE_PICTURE).'</a> ['.$fsize.' kb] [<a href="prew.php?img='.$file.'&nm='.$name.'&br='.$folder.'"><b>>></b></a>]</b></small><br/>'; 
        }

 elseif(preg_match("[\.sdt]",$name)) {
		$name = str_replace(' ','_',$name); 
                 echo '<small>';
				 if(file_exists($folder.'/screen.jpg')) {
				 echo '<img src="'.$folder.'/screen.jpg" alt=""/><br />'; 
				 }
				 echo '<b><a href="d.php?file='.$file.'&cf='.$name.'">'.trans($name,TRANSLATE_FILE).'</a> ['.$fsize.' kb] [<a href="about.php?cf='.$name.'&lf='.$file.'&br='.$folder.'"><b>info</b></a>]</b></small><br/>'; 
        }


		elseif(!preg_match("[\.html]",$name)) {
		$name = str_replace(' ','_',$name); 
                 echo '<small><img src="file.png" alt=""/> <b><a href="d.php?file='.$file.'&cf='.$name.'">'.trans($name,TRANSLATE_FILE).'</a> ['.$fsize.' kb] [<a href="about.php?cf='.$name.'&lf='.$file.'&br='.$folder.'"><b>info</b></a>]</b></small><br/>'; 
        } else {	
		     $name = strtok($name,'.');
		     $name = str_replace(' ','_',$name);
                 echo '<small><img src="folder.png" alt=""/> <b><a href="'.$file.'">'.trans($name,TRANSLATE_HTML).'</a> [<a href="about.php?cf='.$name.'&lf='.$file.'&br='.$folder.'"><b>info</b></a>]</b></small><br/>'; 
		}
    $sok++;
    $ss = $ss + $con;
    } else {
	   if(FILES_DIR_COUNT == 1){
   $jf = files($file);
    if(empty($jf)) $jf = 0;
   $clf = ' <small>['.$jf.']</small>';
   } else $clf = '';
		if(!preg_match("[HTML]",$name) && !preg_match("[CSS]",$name) && !preg_match("[NTRLS]",$name)) {
                 echo '<small><img src="folder.png" alt=""/> <b><a href="?a='.$file.'">'.trans($name,TRANSLATE_FOLDER).'</a></b></small>'.$clf.'<br/>';
          $sok++; 
		} elseif(preg_match("[HTML]",$name) or preg_match("[CSS]",$name) or preg_match("[NTRLS]",$name)) {
		      $name = strtok($name,'N');
                 echo '<small><img src="folder.png" alt=""/> <b><a href="?a='.$file.'">'.trans($name,TRANSLATE_HTML_FOLDER).'</a></b></small><br/>';
          $sok++; 
		}
    }
    }
   $con++;
    }
    }
   @closedir($dir);
     if($n != 0) {
		echo '<a href="index.php?a='.$folder.'&n='.($n - FILES_ON_PAGE).'"><small><b><<Назад</b></small></a>|';
	}   
	if(!$sok < FILES_ON_PAGE && $sok + $n != $con) {
		echo '<a href="?a='.$folder.'&n='.($sok + $n).'"><small><b>Далее>></b></small></a>';
	}
     $ss = round($ss/1024,1);
     $pag = round($con/10);
      if(($con - $pag * 10) > 0) {
  			$pag++;
		}  
		$knc = strtok($folder,'/');
		$ob = strrchr($folder,'/');
		$back = str_replace($ob,'',$folder);
			if($folder != '') echo '<hr> <a href="index.php?a='.$back.'"><small>Назад</small></a><br />
			<a href="index.php?a='.$knc.'"><small>К началу</small></a>';
include('../../foot.php');
?>