PHP Classes

PHP Web Site Compare Files: Compare the list of files of two Web sites

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 77%Total: 240 All time: 8,018 This week: 257Up
Version License PHP version Categories
compare-site-files 1.0.2GNU General Publi...5PHP 5, Files and Folders, Web services
Collaborate with this project 

Author

Description

This class can compare the list of files of two Web sites.

It can take the URLs of two sites and compares the list of files between them.

The class uses file_list.php script that needs to be installed on both site servers, so it can use that script to retrieve the files list.

The class displays a report of the files that are missing or changed between servers, as well the respective modification dates and sizes.

Innovation Award
PHP Programming Innovation award winner
August 2016
Winner


Prize: One downloadable copy of CodeLobster Professional
Sometimes it is necessary to verify if the files of a site on the server are up to date and were not changed eventually by an attacker that took advantage of a security hole.

There are some solutions that compute hashes of all the files in the server but they do not tell whether the files different because they are not up to date with the latest development version or were changed eventually due to a security attack.

This class provides a solution that uses a different approach. It calls a script on the server that lists the existing files.

This way it can compare list of files on the production and the development environments, or even compare the files installed on different production or testing servers.

Manuel Lemos
Picture of Roger George
  Performance   Level  
Name: Roger George <contact>
Classes: 1 package by
Country: United States United States
Age: 46
All time rank: 4009513 in United States United States
Week rank: 312 Up38 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Example

<!--
Last Updated = 7/25/16
Created By: Blastroid
Compare website files.

Instructions:
1. Copy the file_list.php file to the root directory of 2 websites you want to compare.
2. Use the following code:
        $compare = new compareFolders('http://URL1/file_list.php', 'http://URL2/file_list.php');
   
        Where it says URL1 change to the website #1 URL
        Where it says URL2 change to the website #1 URL
   
    Optional paremeters are naming the 2 website paths (Defaults are URL1, and URL2). Example:
        $compare = new compareFolders('http://URL1/file_list.php', 'http://URL2/file_list.php', 'Website 1', 'Website 2');
   
    Run the class where you want the 3 HTML tables to be written.
-->

<style>
body{
    font-family:Arial;
}

table#missingTableData, table#fileDifferencesData, table#filesModifiedData{
    border-collapse:collapse;
    border:2px solid black;
}

table#missingTableData th, table#fileDifferencesData th, table#filesModifiedData th{
    background-color:black;
    color:white;
    border:1px solid lightgray;
    padding:3px;
    vertical-align:bottom;
    font-size:16px;
    text-align:center;
}

table#missingTableData td, table#fileDifferencesData td, table#filesModifiedData td{
    color:black;
    border:1px solid black;
    padding:3px;
    vertical-align:top;
    font-size:14px;
    color:black;
}

.ac{text-align:center;}
.spacer{border:0px;background-color:black;width:10px;}
.url1{background-color:#ccffff;}
.url2{background-color:#b3ffd9;}
.mismatch{background-color:#ffb3b3;}
</style>

<?php
include_once('compare_files.php');

$test = new compareFolders('bwat.info/other/class_compare_sites/A/file_list.php', 'bwat.info/other/class_compare_sites/B/file_list.php');
?>


Details

PHP_Compare_Website_Files

Compare similar website files. Shows missing files, different files (modified date / size), and files modified in the last 7 days.

http://bwat.info/

Last Updated = 7/25/16 Created By: Blastroid

Instructions:

Copy the file_list.php file to the root directory of 2 websites you want to compare.

Use the following code:

$compare = new compareFolders('http://URL1/file_list.php', 'http://URL2/file_list.php');

Where it says URL1 change to the website #1 URL

Where it says URL2 change to the website #1 URL

Optional paremeters are naming the 2 website paths (Defaults are URL1, and URL2). Example:

$compare = new compareFolders('http://URL1/file_list.php', 'http://URL2/file_list.php', 'Website 1', 'Website 2');


Run the class where you want the 3 HTML tables to be written.

Note: In the compare_file.php you can add to the array $ignoreFiles to ignore files.

See http://bwat.info/ for more information.


  Compare_Website_FilesExternal page  

Open in a separate window

Screenshots  
  • screenshot.png
  Files folder image Files  
File Role Description
Plain text file compare_files.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file file_list.php Aux. Auxiliary script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 83%
Total:240
This week:0
All time:8,018
This week:257Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:93%StarStarStarStarStar
Documentation:93%StarStarStarStarStar
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:77%StarStarStarStar
Rank:48