Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

date time expire page

is this script OK?

6:37 pm on Sep 2, 2017 (gmt 0)

New User

joined:Aug 31, 2017
posts: 6
votes: 0

So idea is to have a php page with content that expires with a set date. Here is a script I found and updated to my needs. Am I missing something? Security OK?

$today = strtotime(date("Y-m-d"));
$expireDate = strtotime("2017-12-21");
if ($today <= $expireDate) {
echo 'ACTIVE';
} else {
echo 'EXPIRED';

The php file will be pulled by remote site with:
<?php print file_get_contents("http://www.domain.com/demo/clienta/demo.php"); ?>
2:07 pm on Sept 17, 2017 (gmt 0)

Full Member

Top Contributors Of The Month

joined:Apr 20, 2017
votes: 73

$today = strtotime(date("Y-m-d"));
you can simply do:
$today = time ( ) ;

Now, about "security", it depends what you mean exactly.
3:33 pm on Oct 19, 2017 (gmt 0)

Senior Member from ES 

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 11, 2003
posts: 1381
votes: 0

Yeah, as Peter_S said, what security concern do you have? For the moment (other than Peter_S's suggestion) the code looks fine. Do you control both sites? Will you always control both sites? I mean, a concern could be that by printing that file_get_contents, whoever has control of
controls what appears on that server. That is a possible vector of attack.