Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare days old to current date?

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
GB
Ok, this may sound weird, but I'm trying to make one of my scripts have a 3 day trial. The idea behind it is that it works for 3 days, and then it will display a message saying the trial is up. If the file b.inc is there, then the purchase should have been made, so they get unlimited use.

So far I have;

Code:
if (!is_file("admin/b.inc") { 

// something here to get the date of the file, and see how old it is...if over 3 days, or 72 hours, then show a message. This is where I'm stuck.. I tried using fileatime() and getdate() to compare the dates...but it didnt work right :(IF anyone could help me, it would be much appreciated :)

}

Thanks
 
well

you can always save the timestamp of the begining of the trial (stored in $trial)

$days3=3 * 24 * 60 * 60;
if ((time()-$trial)>=$days3){
// trial is over
}
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
So your saying, make a variable when installed, called $trial, and then use this code to see if it has expired?
 
no, store it in the database ...

i just presumed you fetched that value to that var.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
this will get you the date of the file creation/last modified.
filemtime("admin/b.inc") ***************************************
Party on, dudes!
[cannon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top