troubleshooting Question

200 Points- Advice on Postcard script *AND* Expiration

Avatar of celere
celere asked on
PerlWeb Development
9 Comments1 Solution283 ViewsLast Modified:
Hi There!

I'm writing a "mail a postcard to a friend" script. Without access to a database, I'm going to use flat text files, and plan to do it thusly:

"Sent" postcards are recorded to a delimited file:

$id::$sender_name::$sender_mail::$recip_name::$recip_mail::$id.htm::$expiration_date

Then the script will generate a small ".htm" file which will hold the <img src> and message, which will later be called and read by the script when the recipient clicks the link

<a href="domain/cgi/script.cgi?$id::$recip_name">Retrieve your postcard</a>

Is this a logical way of doing this? I don't anticipate a very high volume of postcard traffic. (Like 10/ month MAX). Am I doing it the hard way, or can someone recommend a better way?

Then I need a way to delete the files after they've expired (say 10 days?) but I have *NO* idea on how to calculate this. I suspect I can write a function to "unlink" all .htm files > 10 days, right? But I don't know how to calculate the time elapsed.

Can anyone please help me? Snippets of code would be ideal.

Thank You!
ASKER CERTIFIED SOLUTION
Tsvetomir

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros