|
Posted by Lee David on 05/26/05 23:51
I'm trying to use the current time, but I only see "13:1" as the hours and
minutes. The seconds seem to update. Here is the code I'm using (before
<html> tag):
<?php
if (isset($_COOKIE[lasthere]))
{
// process existing cookie
$lasthere = $_COOKIE[lasthere];
$user = $_COOKIE[user];
// hour, minute, second, month, day, year
$lastupdate = mktime(13, 0, 0, 5, 26, 2005);
if ($lasthere < $lastupdate)
{
// update stuff
$listnewstuff = "yes";
}
}
else
{
// get user name
}
// in any case write a cookie out with the current date
setcookie("lasthere", time(), time() + 36000);
setcookie("user", "Jerry", time() + 36000);
?>
The purpose is to see if you have been to the page since the last update.
Your time here is always updated to the current time in the first setcookie.
The page variable is set by the webmaster when he last updated the page. If
you were here before the last update, I want to popup a page with new
features. If you were here after the last update, then do nothing for the
UI.
Then in the body of the page, I'm putting:
<?php
echo "<br>lastupdate: " . date("M d, Y H:I:s", $lastupdate);
echo '<br>now: ' . date("M d, Y H:I", time()) . "<br>";
if ($listnewstuff = "yes")
{
echo "new stuff to be found at " . date("M d, Y H:I:s", $lasthere) .
"<br>";
}
else
{
echo "no new stuff to be found at " . date("M d, Y H:I:s", $lasthere) .
"<br>";
}
?>
Any ideas?
TIA,
Jer
Navigation:
[Reply to this message]
|