Jump to content


Photo

Link activation on certain time?


  • Please log in to reply
3 replies to this topic

#1 CodilX

CodilX
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 17 June 2006 - 01:00 PM

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

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 17 June 2006 - 01:16 PM

What do you mean exactly? You want the link to appear between 10pm to 6am?
If that what you want, try this:

<?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 false

if($display_link){echo('<a href="page.php">Click here</a>');}; //If $display_link is set on true, display the link.
?>

Assuming that's what you asked for.

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 01:22 PM

i am learning php but also trying to help good luck.

my example but $time_from from database set at 10.00.00
and time to set in database as $time_to 18.00.00.
<?
$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";

}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 CodilX

CodilX
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 17 June 2006 - 01:29 PM

Wow, what a fast response!!

Thank you both so much, both code's are awesome

Thx - Matt





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users