CodilX Posted June 17, 2006 Share Posted June 17, 2006 Hi everyone,I'm new to the forums, hope to recieve some help on code I'm trying to put together :)Basicly I want a link, that would work from 10pm to 6am. I'm trying to do it with array's, but with no luck :( Can somebody help me with that?Thx, Matt Quote Link to comment https://forums.phpfreaks.com/topic/12233-link-activation-on-certain-time/ Share on other sites More sharing options...
Orio Posted June 17, 2006 Share Posted June 17, 2006 What do you mean exactly? You want the link to appear between 10pm to 6am?If that what you want, try this:[code]<?php$hour=date(G); //Get the hour (numbers 0-23)$display_link=TRUE;if($hour<22 && $hour>5){$display_link=FALSE;}; //If the time is between 6am to 10pm set $display_link to falseif($display_link){echo('<a href="page.php">Click here</a>');}; //If $display_link is set on true, display the link.?>[/code]Assuming that's what you asked for.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12233-link-activation-on-certain-time/#findComment-46637 Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 i am learning php but also trying to help good luck.my example but $time_from from database set at 10.00.00and time to set in database as $time_to 18.00.00.[code]<?$time_from="10.00.00";$time_to="18.00.00";if ($time_to - $time_from) {echo "<a href='http://www.google.com'>google link</a>";}else {echo "sorry wrong time";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12233-link-activation-on-certain-time/#findComment-46639 Share on other sites More sharing options...
CodilX Posted June 17, 2006 Author Share Posted June 17, 2006 Wow, what a fast response!!Thank you both so much, both code's are awesomeThx - Matt Quote Link to comment https://forums.phpfreaks.com/topic/12233-link-activation-on-certain-time/#findComment-46641 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.