gisfrancisco
04-16-2007, 03:04 AM
I have a game script i'm modifying and i'm stuck.I need to redirect based on my servers date and time.I need to restrict player to a certain time frame to play.I can't figure out how to span two days.I need to redirect to the games at Fri 1800 and end Sat 1800.
I found this on this forum and it's close but doesn't span two dates.
<?php
$curTime = date('Gi',time()); //gets current hour [24 hour]
$hour = date('G');
$minute = date('i');
$day = date('w');
$m = $hour * 60 + $minute; // Minutes since midnight.
if(
$day == 6 // Saturday...
&& $m >= 735 // ... after 12:15...
&& $m <= 1035 // ... but before 17:15...
) header("Location: saturdayafternoon.php");
else if(
$day == 4 // Wednesday...
&& $m >= 1155 // ... after 19:15...
&& $m <= 1335 // ... but before 22:15...
) header("Location: http://full path wednesdaynight.php");
?>
Any help would be appreciated.Thanks in advance.
I found this on this forum and it's close but doesn't span two dates.
<?php
$curTime = date('Gi',time()); //gets current hour [24 hour]
$hour = date('G');
$minute = date('i');
$day = date('w');
$m = $hour * 60 + $minute; // Minutes since midnight.
if(
$day == 6 // Saturday...
&& $m >= 735 // ... after 12:15...
&& $m <= 1035 // ... but before 17:15...
) header("Location: saturdayafternoon.php");
else if(
$day == 4 // Wednesday...
&& $m >= 1155 // ... after 19:15...
&& $m <= 1335 // ... but before 22:15...
) header("Location: http://full path wednesdaynight.php");
?>
Any help would be appreciated.Thanks in advance.