Reply to Time() problem

Your name:

Reply:


Posted by Lee David on 05/27/05 02:19

I posted this in another newsgroup, but no one knew the answer so I thought
I'd try it here.

Here is what comes before the <html>:

<?php
$lasthere = $_COOKIE[lasthere];

if (isset($lasthere))
{
// process existing cookie
$user = $_COOKIE[user];

// hour, minute, second, month, day, year
$lastupdate = mktime(16, 16, 16, 3, 26, 2005);

if ($lasthere < $lastupdate)
{
// updated stuff
$listnewstuff = "yes";
}
else
{
// old stuff
$listnewstuff = "no";
}
}
else
{
// get user name
$listnewstuff = "no cookie";
}

// in any case write a cookie out with the current date
setcookie("lasthere", time(), time() + 36000);
setcookie("user", "Kevin", time() + 36000);
?>

and I check the varibles with this:

<?php
echo "<br>lastupdate: " . date("M d, Y H:I:s", $lastupdate);
echo "<br>lasthere: " . date("M d, Y H:I:s", $lasthere);
echo '<br>now: ' . date("M d, Y H:I", time());
echo '<br>LNS: ' . $listnewstuff . '<br>';

if ($listnewstuff == "yes")
{
echo "new stuff to be found<br>";
}
else
{
echo "no new stuff to be found<br>";
}
?>

The output is this:
lastupdate: Mar 26, 2005 16:0:16
lasthere: May 26, 2005 14:1:36
now: May 26, 2005 14:1
LNS: no
no new stuff to be found

I hit it a few seconds later and got this:
lastupdate: Mar 26, 2005 16:0:16
lasthere: May 26, 2005 14:1:15
now: May 26, 2005 14:1
LNS: no
no new stuff to be found

the seconds change, but the minutes is still one character and doesn't
change.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация