Jump to content

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.
Link to comment
https://forums.phpfreaks.com/topic/5521-text-link-rotating-php-script/
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>';
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.