Hi All
i am pretty new to PHP so please bare with me im currently writing a website that has a call me now feature
what i want to do is place a link on the hompage that points to a script that wil retrieve the time and date from MY HOSTING SERVER not the users local server and if it is between monday and friday and the hours of 0900 and 1800 i want them to be directed to a page called support open.htm if the time is anything else to be redirected to a page called support closed.htm
i have been scouring the web but i have found nothing that helps i did find a html script that i have tested over the last couple of days but thats flaky at best
after reading thru this forum thought this would be the best place to look i am pretty desperate for this to be up and running as this is all thats left to do so i can launch the site
thanks in advance
jon
TIME BASED URL REDIRECT
Moderator: General Moderators
-
JBAVINGTON
- Forum Newbie
- Posts: 3
- Joined: Mon Aug 07, 2006 6:59 am
TIME BASED URL REDIRECT
Last edited by JBAVINGTON on Mon Aug 07, 2006 7:41 am, edited 1 time in total.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Doesn't sound urgent.... usally placing "urgent" in the thread title makes it look like you just want priority and is often ignored so it's best not to do it.
Moving on...
You just need to check timestamps and then do a header redirect.
At the TOP of the page:
Moving on...
You just need to check timestamps and then do a header redirect.
At the TOP of the page:
Code: Select all
<?php
$day = date('w');
$hour = date('H');
//If not saturday or sunday
if ($day != 0 && $day != 6)
{
if ($hour >= 9 && $hour < 18)
{
header('Location: supportopen.html');
exit();
}
}
//If we got this far the desk is closed
header('Location: supportclosed.html');
?>-
JBAVINGTON
- Forum Newbie
- Posts: 3
- Joined: Mon Aug 07, 2006 6:59 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I wrote that file so you could quite literally save it as "support.php" with nothing but those contents... no HTML at all, just that code.JBAVINGTON wrote:but am i right in saying i just add the text you supplied to the <head> of the page or do i also need to add a PHP file aswell
not sure how i implement
thanks again
Then you'd have two files it redirects to: "supportopen.html" and "supportclosed.html".
You just need to point anyone wanting support to support.php and that file will send them off in the right direction.
-
JBAVINGTON
- Forum Newbie
- Posts: 3
- Joined: Mon Aug 07, 2006 6:59 am