CruzIT
Saturday March 23, 2019 - 11:27:37 AM

Registered Linux User #440901    


 
Login    Register
Login Required

HowTo Dynamically Display "File Last Modified" With PHP

The lite version

This method requires a file that will be included in the page to be displayed.

First: Right click on this link and save it as “lastmod_lite.php” to your main directory. The original filename on this server is "lastmod_lite.code" If you left click on it, you will see the source code.
Second: Once included, the code will grab the name of the file (web page) it is included in, get the last modified time and date for it, then display it.
Yes, it even works on itself. Try it out here.
So, wherever you want it displayed, put the following into that page:

<?php include "lastmod_lite.php"; ?>

That should produce something like this:

Last modified on 09/1/18 @ 10:33:50:pm

This is for PHP 5 and above. Probably works for PHP 4 and above, although it has not been tested on Version 4.

Collecting For A Server Upgrade  

Dynamically Display File Last Modified - The non-lite version

Something extra for the dynamic file last modified code:

This one shows the same information as above and adds an extra line with the file name of the web page displayed.

Do the same thing as above except right click on this link and save this file as “lastmod.php”. Then put this where you'd like to display it:

<?php include "lastmod.php"; ?>

That should produce something like this:

This page was last modified on 09/1/18 @ 10:33:50:pm
This file name: howto_lastmod.php

Note: Any code provided that writes out HTML entities like line breaks, images or forms is formatted to use valid XHTML format. That means, if you are not using XHTML, you will need to edit those tags accordingly.
For instance, if the code I've given you has “<br />” then change it to read “<br>”


“Windows - Just Say No”

@ Active Member Project Honeypot  email addresses

This page was last modified on 09/1/18 @ 10:33:50:pm
This file name: howto_lastmod.php

Questions, Comments, Suggestions or Requests should be sent to:  ronnie@cruzit.com 

There have been  84460  Unique Visitors (IP Addresses) to this site.

Current users online : 15
Maximum users at a time : 50
Last 25 attacks have come from:
14.248.137.211
157.55.39.224
209.97.138.189
185.227.111.133
40.77.167.119
195.201.141.210
45.77.106.13
146.71.77.244
45.119.212.150
104.198.63.244
52.87.182.94
23.228.81.10
188.166.80.133
91.134.248.235
52.78.241.165
175.126.62.28
192.42.116.16
46.229.168.142
188.126.73.10
103.59.38.130
192.200.215.90
176.31.124.223
183.90.250.38
159.65.146.132
138.197.46.78

There are currently 25 unique IP addresses blacklisted.

Public cruzit.com Server Status
server offline limelight  web service
 Aw Crap!, It's Off-Line
server offline limelight  mail service
 Aw Crap!, It's Off-Line
server online www  web service
 Is On-Line
server online mx 08  mail service
 Is On-Line
server online www01  F/O web service
 Is On-Line
server online mx 09  mail service
 Is On-Line
server online tertiary  DNS service
 Is On-Line
server online mx 10  mail service
 Is On-Line

©Copyright 2004-2019 - cruzit.com - Redd Enterprises™, Inc.,  All Rights Reserved.
Ubuntu® is a registered trademark of Canonical Ltd.
Linux® is a registered trademark of Linus Torvalds.
Apache® is a registered trademark of The Apache Software Foundation.
PHP® is a registered trademark of The PHP Group.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other product and service names mentioned are the trademarks of their respective companies.

 

pretrial
pretrial
pretrial
pretrial
Let us know what you think! finance@homelandcomputersecurity.com