Jump to content

Twitch

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by Twitch

  1. I've changed my mind about 4 or 5 times...I'm just going with whatever I get to work....ha ha I'm not sure I understand how to use this script. It seems to basically redirect to whatever php file is in the action. How do I tell this script to change to the Tuesday include file after 10 pm on Monday night? Forgive my ignorance, I promise I'm smarter than this...ha ha. Maybe my coffee hasn't kicked in yet.
  2. Appreciate it CroNIX, but in the final code the "Have a nice Saturday", "Have a nice Sunday" will be replaced with include('saturday-inc.php'); include('sunday-inc.php'); etc. Basically the include file is event information that changes by day. Just looking to automate the process rather than going in and changing the name of the include file manually.
  3. Once again thanks so much for the quick response. Complicated is what I don't want...ha ha. What if I just get the server time and use a script like this. This is the one I originally had. The problem is I can't really test it easily since I can't manually change the time on the server. Therefore I have to wait for each day to go by...ha ha. I thought I'd post it here so a pro PHPer could look at it and at least see if it's proper code. <?php echo(date("l F Y h:i:s A") . "<br />"); ?> <?php $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<="10" && $m<="00" && $a="PM" && $d=="Thu") include('thursday-inc.php'); elseif ($h<="10" && $m<="00" && $a="PM" && $d=="Fri") include('friday-inc.php'); elseif ($d=="Sat") echo "Have a nice Saturday!"; else echo "Have a nice Sunday!"; ?>
  4. Actually I'm trying to get the local machine's time and not the server, I read somewhere that php only gets the server time therefore you need to use a combination of javascript and php. I was trying to change the php file at 10 pm and have the script check the day and time and change to the appropriate php include file. I guess I could see if it works by cycling through each day at midnight or change the end of day to 10 instead of midnight. How would I make it change the php file using your end of day script? Appreciate the prompt response earlier. -Twitch
  5. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.