Tuesday, August 25, 2009

How to expire PHP script after certain date.

"One idea can change your life." No.. No.. I am not advertiseing for Idea... I remember this word because one of my colleague was tired of some unusual work and I suggested him a shortcut, which he used and get relaxed of the said work. There is a short story behind it.

"He has designed many online submission form for our institute. However it was always required that the online submission should be closed after certain date and time. This dates always came on Saturdays/Sundays :). Oops it is so boring to come on Saturday/Sunday in office and remove link for online submission so that no one can submit their application after the expired time period. He was doing same work since last 1 year. One day I came to know this and I suggest him to put following PHP code at begining in his online submission application form and relax. Here is the code.
< ? php
$exipredate = "2009-08-31 17:00:00";
if(date('Y-m-d H:i:s')>=$exipredate)
{
echo 'Date & Time for submitting application on-line is over.';
exit;
}
?>

He implemented this and He relaxed. A small script worked better for him. Isn't it "A small idea can change your life".

I am writing this article after a long time. The delay was due to some heavy work in office. Sorry for this delay.

No comments: