frshjb373 Posted May 11, 2012 Share Posted May 11, 2012 I'm not sure I'm in the right place, but I'm looking to create a unique URL that links to the same page every time I send an email after a form is submitted on my website and have it expire after 15 days. After expiring, the link would redirect to a default page. I'm still a beginner and realize this is probably going to be a tough task, but any resources or direction provided would be much appreciated. Thanks for the help in advance! Quote Link to comment https://forums.phpfreaks.com/topic/262380-generate-a-unique-url-for-each-new-email-that-expires-after-a-given-time/ Share on other sites More sharing options...
xyph Posted May 11, 2012 Share Posted May 11, 2012 Let's take this step by step. First, we have to create a unique link. The easiest way to do this is through the query string! For example.. script.php?token=ABC123 Within script.php, 'ABC123' would be stored in the array $_GET['token']. You can use multiple variables in the query string, delimited by the '&' symbol. script.php?token=ABC123&foo=bar Within script.php, echo $_GET['token'] would output 'ABC123', and echo $_GET['foo'] would output 'bar' Follow me so far? Am I going too fast? Too slow? Quote Link to comment https://forums.phpfreaks.com/topic/262380-generate-a-unique-url-for-each-new-email-that-expires-after-a-given-time/#findComment-1344646 Share on other sites More sharing options...
ocpaul20 Posted May 11, 2012 Share Posted May 11, 2012 similar advice - in the email get them to click on the link script.php?token={date_form_submitted_in_some_format_maybe_a_number} then in script.php get the date in token and subtract it from today and find out how many days have passed and depending on whether this is over or under 15 days, then direct accordingly. Quote Link to comment https://forums.phpfreaks.com/topic/262380-generate-a-unique-url-for-each-new-email-that-expires-after-a-given-time/#findComment-1344687 Share on other sites More sharing options...
xyph Posted May 11, 2012 Share Posted May 11, 2012 You generally don't want a token to be predictable or guessable. One could easily feed any token in to that script that would be considered valid. Quote Link to comment https://forums.phpfreaks.com/topic/262380-generate-a-unique-url-for-each-new-email-that-expires-after-a-given-time/#findComment-1344795 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.