Go Back   Gaming Gutter > Non-Gaming > Programming > Tutorials


Tutorials - Looking for programming tutorials to increase your knowledge? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post Virus!
Today 06:40 PM
Last post by Axed
Today 07:08 PM
9 Replies, 10 Views
Go to first new post Price Check on Pink...
Today 05:49 PM
Last post by jtdusk
Today 07:08 PM
7 Replies, 8 Views
Go to first new post Buying 200k for $1
Today 07:07 PM
Last post by dazbryce
Today 07:07 PM
0 Replies, 1 Views
Go to first new post tnt detects you ss
08-27-2008 04:56 PM
Last post by eckkotc203
Today 07:04 PM
46 Replies, 47 Views
Go to first new post List trouble with Sid's...
Today 11:31 AM
Last post by eckkotc203
Today 07:01 PM
1 Replies, 2 Views
Reply
 
LinkBack Thread Tools Display Modes

 Advanced Page Last Modified
Old 10-18-2006, 03:47 PM   #1 (permalink)
Oosband
Guest
 
Posts: n/a
iTrader: / %
Advanced Page Last Modified

This script displays when the page was last modified and outputs the date as xx minutes ago, or xx days ago...or even if you don't update much - xx weeks ago!

---

The Script:

Code:
<?php
//File Name
$last_modified = filemtime("FILE.php");

{
$timediff = time() - $last_modified;

if ($timediff < 3600)
{
if ($timediff < 120)
{
$returndate = "1 minute ago.";
}
else
{
$returndate = intval($timediff / 60) . " minutes ago.";
}
}
else if ($timediff < 7200)
{
$returndate = "1 hour ago.";
}
else if ($timediff < 86400)
{
$returndate = intval($timediff / 3600) . " hours ago.";
}
else if ($timediff < 172800)
{
$returndate = "1 day ago.";
}
else if ($timediff < 604800)
{
$returndate = intval($timediff / 86400) . " days ago.";
}

else if ($timediff < 1209600)
{
$returndate = "1 week ago.";
}
else if ($timediff < 3024000)
{
$returndate = intval($timediff / 604900) . " weeks ago.";
}
else
{
$returndate = @date('n-j-Y', $timestamp);
if($type=="fulldate")
{
$returndate = @date('n-j-y, H:i', $timestamp);

}

else if ($type=="time")
{

$returndate = @date('H:i', $timestamp);

}

}
//Display It
print("Last Modified: ");
print($returndate);

}
?>
---

It should be pretty easy to understand.

$last_modified = filemtime("FILE.php"); - Change FILE.php to the file you want to connect to.
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weapon for a Page Andrewlikr MapleStory 9 11-05-2006 07:26 AM
K. I wanna pwn this page. :o Ryan Chat 1 10-14-2006 10:25 AM
go to page... stewnb Website Suggestions 3 10-11-2006 05:23 PM

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 07:08 PM.


vBulletin skin developed by: eXtremepixels
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.09404302 seconds (100.00% PHP - 0% MySQL) with 20 queries