• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP - Time Duration help

aussiewarrior

New Member
Can somebody help me ASAP withe the following:

When a user joins my site they have 24hrs to bid on players. How can I code so that the bid section only stats active for 24hrs then disappears.

Any help would be great.

Cheers
 
Well, PHP counts time in seconds usually...

and since 3600 seconds equals one hour... you can probably figure out how the script should work from that.
 
No, not necessarily.

PHP:
$inital_time = whatever the time is now;
if($inital_time-(3600*24) >= 0)
{
not active
}
else
{
active
}

To find out the time now, create a blank PHP file and just have this statement "echo time();" without the quotes.
 
Last edited:
Tree said:
No, not necessarily.

PHP:
$inital_time = whatever the time is now;
if($inital_time-(3600*24) >= 0)
{
not active
}
else
{
active
}

To find out the time now, create a blank PHP file and just have this statement "echo time();" without the quotes.

with initial time does that have to be in seconds???
Also do you need to add a date there so that it knows when it is past the 24hr mark?
 
When a user signs up, put the exact date and time in the database. Use an if statement to see if 24 hours has gone by.
 
Back
Top