Welcome to WebmasterWorld Guest from 54.166.172.180

Forum Moderators: coopster & jatar k

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?

<?php
//SET THE TIME ZONE
date_default_timezone_set('Europe/Vilnius');
//BEGIN
$today = strtotime(date("Y-m-d"));
$expireDate = strtotime("2017-12-21");
if ($today <= $expireDate) {
//ACTIVE
echo 'ACTIVE';
} else {
//EXPIRED
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
posts:334
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
http://www.domain.com/demo/clienta/demo.php
controls what appears on that server. That is a possible vector of attack.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members