SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2008
    0 Post(s)
    0 Thread(s)

    Smile cronjob to check updation in content

    hy to all,

    is it possible to send mail to members about the static contents when admin change or update that page.

    for example

    i have a site which are built in php mysql with some static pages

    a.php with no dynamic contents

    is it possible to make cron which check the that if any changes come in a.php then send mail to members that some new contents are add in a.php


  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    France, deep rural.
    17 Post(s)
    1 Thread(s)
    you can tell cron to invoke a php script which;

    checks the last updated date on a file
    compares that to the last known update
    sends emails

    Unless you make a script which cron then requests once a day which:

    checks if a file has a last updated date of less than 24 hours
    sends emails


  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Lancaster University, UK
    2 Post(s)
    0 Thread(s)
    Ok, well first I'd have a mysql table called Files.

    This contains four fields - ID, FilePath, DateTime, Hash.

    So, to start off, give each file a row - The ID is just a unique primary key, the FilePath is the path to the file, the DateTime is the time you insert the row and the Hash is the MD5() of the file contents.

    So, when you run that cronjob you first run a query, grabbing all of the unique filepaths and their hash (from the latest datetime). For each returned row, you MD5 the return of file_get_contents($FilePath) and compare it with the hash you've received. If it's not the same, run a query to insert a new row into the database, with the same filepath, but the new DateTime and the new hash. Store this filepath in an array.
    If it isn't different, just go to the next row.

    Then, at the end you'll have an array of the changed filepaths. You can send this in an email to your members.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts