Log in

View Full Version : server date



nicksalad
01-21-2007, 05:10 PM
Hi, im new here, nice forum!

i got a problem... What about if you want to run a script every monday, everytime a user log in, like a monday's surprice ;)

if (date("D") == 'Mon') {
RUN SCRIPT; }
else { NOTHING }

the problem is, with this method the user could change their computer date and get the surprice any day at any time, just need to change their computer date to monday. How can i do to instead of check for the user's time, to check the time of the server where the website is hosted?

Thanks!

BLiZZaRD
01-21-2007, 05:43 PM
PHP is a server side script, it is already running off of server local time, unless you set an off set or have in your script to check visitors local time, you shouldn't have to worry about that issue.

nicksalad
01-21-2007, 05:54 PM
hehhe, i was about to say i found it myself ^^ thanks anyway for your reply :) the date uses the time (hours/minutes/seconds) of the guest but the date (month/day/year) of the server. Problem fixed, thanks!.

BLiZZaRD
01-21-2007, 05:56 PM
YAY! Glad it's working for you :D