Jump to content

Link activation on certain time?


CodilX

Recommended Posts

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 false

if($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.
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.
[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]

Archived

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

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