website script?

Author
Discussion

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
Is there such a script that can do this? Basically all i want to do is serve a certain webpage at certain times of the day, at other times a different webpage would be served, the URL that points to these pages would remain the same though? The script would need to get the time of day from the server. Any ideas?

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
Linux i think?? We have PHP running on it i know for sure. I know bugger all about these things, i can do basic webpages but nothing like this!! Thanks

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
Thanks anyway, i did a quick search last night on Google but found nothing. Be good if it can be done smile

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
Basically up until midday i need one page to be served, after midday another page & at 4.30pm a final page. Cron? Wasn't that a film??!! Oh no, that was Tron....

biggrin

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
Sorry for the delay, been busy all afternoon!! Many thanks for this guys, i'll give it a go in a mo smile I did think of htaccess this afternoon!! I need the pages to change according to the servers time not the client as that will stay fixed. Thanks again.

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
It was a joke wink I know what cron is but have no idea how to use it. Reg1 administer the server, we just play with a website smile

Dave_ST220

Original Poster:

10,309 posts

207 months

Friday 23rd October 2009
quotequote all
crb said:
<?php
date_default_timezone_set('Europe/London');
$inc_file = "";
$minsnow = (date('G')*60)+(date('i'));

switch ($minsnow) {

case ($minsnow < 720):
$inc_file = "morning.html";
break;

case ($minsnow >= 720 && $minsnow < 990):
$inc_file = "afternoon.html";
break;

case ($minsnow >= 990):
$inc_file = "evening.html";
break;
}
require_once($inc_file);

?>


That'll work, basically save this code in the in a file named whatever.php then set up your 3 different html files (morning.html, afternoon.html and evening.html) the url you always link to will always be whatever.php
The first line sets the timezone to the uk and wouldn't be needed if your server is in the UK (mine isn't), but if someone is visiting from abroad it will be off, if this is an issue, I could probably find away round it.


Edited by crb on Friday 23 October 13:05
Works a treat m8 wink Many thanks for your help.