Question

I'm working on a project in core php with mysql for a tutor agency in which i have send mail to people with links to the tutor profile pages matching their required criteria. I want these links to be temporary links and want them to expire in say 72 hours, I'm not sure how to go about it. Any ideas? originally link is something like this

"http://mysite.com/mysubdirectory/index.php?action=view_credentials&tutorid=".$tutor_id;

Thanks for help.

For anyone looking for the same answer as I was, I followed shadyyx and with a bit of effort i was done!! thanx everyone!

Was it helpful?

Solution

Some solution that bumped into my mind:

Create a DB table for these links where You would save the link, unique identifier (some hash), date it was created and date when it will expire.

Then create a page (script) that will get that link (containing not the full URL but the URL of that script and a unique identifier of the link stored in the DB). This script will try to search for the link identified by the unique hash while conditioning current date and time to the link expiry date.

If the link is found and not expired then You would redirect user to that page otherwise You will end up with a message that the link is expired or not found.

Should be pretty easy to implement.

Hope this idea will help You.

OTHER TIPS

Use a table to store the TIMESTAMP when sending the link and redirect to an error if the link is accessed after TIMESTAMP+<72 hours>

Your tutor_id shall be stored in database before you send it. This would help sending unique id (just in case :), and do some checks if i.e. ID used come with is valid. So when anyone enters the link, your index.php should check if all parameters are valid, query DB agains value of $_GET['tutorid'] and see if it is not expired. And you'd know this because your DB record shall hold TIMESTAMP with creation date. Having creation date you can check how old it is and accept or reject the tutor_id

Protected Links is a PHP Script from codecanyon, it expires links after a fixed time and much more..

It can be used to expire a tutorial link or any other link in 72 hours or any number of hours, by IP address, for single user or mutiple users. A php coder can integrate this in their application with some effort.

http://codecanyon.net/item/protected-links-expiring-download-links/2556861

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top