Search code examples
phphyperlinktemporary

Expirable links to profile pages


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!


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.