Khawer Zeshan Khawer Zeshan - 1 year ago 88
PHP Question

Referrer URL in case if the link was clicked from email

I have a user registration process in which I send an email to the user for email verfication and to activate their account. Now when the

activate link
from the email is clicked, How do I get the referrer that tells me whether or not the user came to the page by clicking the link from the email?

Answer Source

Before you generate the email, you generate a unique token for that user. Then you'd append that token to the URL, and the page that does the verification checks the username and the verification token. If they match, then the user has verified their email.

For example, your email would contain a link to Then your process.php page would check to make sure that the foo user's validation token is actually bar. If it is, then the user foo has had their email address validated.