PHP script with date-based expiration not working

software development

#1

Hi folks,

I have the following script on one of my sites and after moving to Dreamhost, it dies. Basically there are little announcement ads that run on the site and timeout at midnight on specified dates. But they are no longer timing out:

$today = date(“Y-m-d”);

$expireDate = “2010-03-21”; if ($today > $expireDate) {$eventleft3 = ‘’;} else {$eventleft3 = ’

';}

had heard that it might be a global variable issue, but i am not sure what to do to fix it.

Any ideas?


#2

I would need more code to tell you what’s wrong.

Is there anywhere you read data from the querystring (the URL), or from a ?


#3

<?php $today = strtotime(date("Y-m-d")); $expireDate = strtotime("2010-03-21"); if ($today > $expireDate) { $eventleft3 = ''; } else { $eventleft3 = '<a href="/blog"><img src="../images/events/PDanBlog.jpg" border="0"></a>'; } ?>

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#4

sXi your script worked!

But why was it needed??

I need to understand what is different on the dreamhost servers from my previous servers. some of my other websites will need changes made as well.

Please reply,

Kodaz


#5

strtotime() ensured you had data in the same format on both sides, then you can a > b.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost