Login   Register  
PHP Classes
elePHPant
Icontem

File: PreviewPages/bottom_pp.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Nadir Latif  >  Site Tools  >  PreviewPages/bottom_pp.php  >  Download  
File: PreviewPages/bottom_pp.php
Role: Auxiliary script
Content type: text/plain
Description: Used to preview a list of web pages in a .csv file
Class: Site Tools
Search, list and view files from a directory
Author: By
Last change:
Date: 7 years ago
Size: 1,339 bytes
 

Contents

Class file image Download
<?
$file_list
=$_GET['file_list'];
$file_to_check=$_GET['file_to_check'];
$refering_file_list=array();

$list_of_files=file($file_list);
for(
$count=0;$count<count($list_of_files);$count++)
    {
        
$current_directory=$_SERVER["DOCUMENT_ROOT"].'/';
        
$name=trim(str_replace('http://'.$_SERVER['SERVER_NAME'].'/',$current_directory,$list_of_files[$count]));
        
$file_contents "";
        
        if (
$handle = @fopen($name,'r',true)) {

        while (!
feof($handle)) 
            {
                
$part fread($handle1024);
                
$file_contents .= $part;
                
//if (eregi("</head>", $part)) break;
            
}
        
$file_name=substr($file_to_check,strrpos($file_to_check,'/')+1);
        if(
strpos($file_contents,$file_name))$refering_file_list[]=$list_of_files[$count];
        }
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bottom</title>
</head>

<body>
<?
if(isset($_GET['file_list']))
    {
        echo 
'<h3>List of referring files</h3><br/>';
        for(
$count=0;$count<count($refering_file_list);$count++)
            {
                echo(
"<a href='".$refering_file_list[$count]."'>$refering_file_list[$count]</a><br/>");
            }
    }
?>
</body>
</html>