Hi everybody,
I am new in php and want to ask a question about redirecting.
My pages
index.php
site_morning.php
site_night.php
I only want that for example user came to site at morning.and he will see site_morning.php.And when he came night site_night.php will be on the screen.Is there any method to achieve this?I tried assign variables like between "18:00 and 05:00" redirect to site_night and between "05:00 and 18:00" redirect page to site_morning.php
If you can help me i will be grateful.
Thanks Anyway
RealTime page redirecting...Need Help!
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: RealTime page redirecting...Need Help!
Code: Select all
<?php
// Set the 24 hour numeric representation of the time
$hour = date('G');
// Check it against 0600 and 1800 for day time
if ($hour > 6 && $hour < 18) {
include 'daytimescript.php';
} else {
include 'nighttimescript.php';
}
?>Re: RealTime page redirecting...Need Help!
Note that this will take use of the server's time, not the users time. If you want the users time, you should look for functions in javascript...
Re: RealTime page redirecting...Need Help!
Thank You very much for your helps.