PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Larry Wakeman   PHP Compare Directories   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: A simple example
Class: PHP Compare Directories
Compare files in two directories and find changes
Author: By
Last change:
Date: 11 years ago
Size: 1,707 bytes
 

Contents

Class file image Download
<?php
/**
** Copyright © Larry Wakeman - 2013
**
** All rights reserved. No part of this publication may be reproduced, stored in a retrieval system,
** or transmitted in any form or by any means without the prior written permission of the copyright
** owner and must contain the avove copyright notice.
**
*/
/**
** Home Page
*/
?>
<html>

<head>
<title>Upgrade checker</title>
<META NAME="AUTHOR" CONTENT="Larry Wakeman">
<META NAME="COPYRIGHT" CONTENT="&copy; 2010 Larry Wakeman, All rights reserved">
<!--
** No part of this publication may be reproduced, stored in a retrieval system, or
** transmitted in any form or by any means without the prior written permission of the copyright
** owner and must contain the avove copyright notice.
**
-->
</head>
<body>
<h1 align="center">Upgrade checker</h1>
<?php
   
include ('compare.class.php'); // Load the class
   
$cmp = new compare(); // Initialize the class
   
$dir = dirname(__FILE__);
   
$cmp->set_source($dir.'\Source'); // Directory where Source files are
   
$cmp->set_update($dir.'\Update'); // Directory where pristeen files are
   
$cmp->do_compare(); // Do the compare
   
$removed = $cmp->get_removed(); // Get the results
   
$added = $cmp->get_added(); // ...
   
$changed = $cmp->get_changed(); // ...
   
echo '<h3>Files Changed</h3>'; // Display the results
   
foreach($changed as $file) {
        echo
$file.' has been changed<br>';
    }
    echo
'<h3>Files Added</h3>';
    foreach (
$added as $add) {
        echo
$add.'<br>';
    }
    echo
'<h3>Files Removed</h3>';
    foreach (
$removed as $remove) {
        echo
$remove.'<br>';
    }
   
?>
</body>
</html>