Hey guys, newbie to PHP and have had enough of pulling my hair out so I thought I'd ask for help.
I'm trying to write a simple script to get the local machine's time and then change an include file based on whether it's 10 pm or not. For instance, it looks at the users time, then if it's passed 10 pm it changes to the next include file such as "friday.php" Thought it should be simple, but sometimes it appears to work and then I realize it doesn't. I'd done various versions of this, but here is what I have at the moment. Any help is much appreciated.
<?php
//code
?>
<script type="text/javascript">
function Gettime() {
var now = new Date();
document.write(now);
}
</script>
<?php
$time_current = "<script language=javascript>Gettime();</script>";
echo "time: ". $time_current;
$d=date("D");
$h=date("h");
$m=date("i");
$a=date("A");
if ($d=="Mon")
echo "Have a nice Monday!";
elseif ($d=="Tue")
echo "Have a nice Tuesday!";
elseif ($d=="Wed")
echo "Have a nice Wednesday!";
elseif ($h<="22" && $m<="00" && $d=="Thu")
include('thursday.php');
elseif ($h<="22" && $m<="00" && $d=="Fri")
include('friday.php');
elseif ($d=="Sat")
echo "Have a nice Saturday!";
else
echo "Have a nice Sunday!";
?>
Thursday and Friday are my test days at the moment.
Thanks in advance,
Twitch