Jump to content

Archived

This topic is now archived and is closed to further replies.

the_chancellor

text link rotating php script ?

Recommended Posts

Greetings,
I have been searching for a php script. Let me explain below ;

I have several text links (urls) to be rotated on my site. The script should rotate those links automatically accoring to my hosting service's server time. For instance, the text link on my site will be www.yahoo.com between 00am to 03am, and then will turn to www.google.com between 03am to 1pm, and then will turn to www.phpfreaks.com between 1pm to 8:30pm, and will turn to www.phpbb.com between 8:30pm to 00am ..... etc. Let me tell you onces again that the time is "SERVER TIME".

Could anyone help me about this script? Is it too custom or can i find an anonymous script on the net?

Thank you all.

Share this post


Link to post
Share on other sites
'um,

$currentServerTime = date("G"); //give current hour of day on server

if ($currentServerTime < 6)
{
echo '<a href="http://www.yahoo.com" title="go to yahoo">Yahoo!</a>';

}elseif ($currentServerTime < 12){
echo '<a href="http://www.site1.com">site2</a>';

}elseif ($currentServerTime < 18){
echo '<a href="http://www.site3.com">site3</a>';

}else{
echo '<a href="http://www.site4.com">site4</a>';

Share this post


Link to post
Share on other sites

×

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.