Need to extract "lastModified" date from a file other than the active document

S

(Shovel)

Guest
I have a website with extra columnists on it - its not very advanced and the free hosting has no database support.

Columns are managed using NewsPro and I want to run a cookie to compare the users "last visted date" with "when the 'news.txt' file was last modified" date.

I have read tutorials on how to write a cookie to store the information extracted from the user - but I can only get the lastModified from the page they are viewing. This is using JavaScript btw.

Is there a way to get the lastModified from an external file (it is still on the same server, though in a different directory) or will I have to learn Perl to do it?
 
T

Tempy_Incursion

Guest
If you have PHP running on your webspace, try using the following code! :)

<?
if (!isset($LastVisitDate)) {
$currdatetime = mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("y"));
setcookie("LastVisitDate",$currdatetime,time()+999999);
}

$LastNewsModify = filemtime("news.txt");

if ($LastVisitDate < $LastNewsModify) {
echo "Since your last visit on " . date("d/m/y H:i",$LastVisitDate) . ", news has been added!";
}
?>
 
S

(Shovel)

Guest
wow, in partial shock cause I could follow that, and then complete irritation cause the server wont do it :(

However, I shall try to convert it to perl :)

Thanks very much.
 
T

Tempy_Incursion

Guest
np, i've never done perl myself so I cant help there! :(
 

Users who are viewing this thread

Top Bottom