jcaptain007 Posted June 25, 2008 Share Posted June 25, 2008 any help out there?...please ???... Link to comment https://forums.phpfreaks.com/topic/111798-how-to-send-email-using-php-codes-for-account-activation/ Share on other sites More sharing options...
abrenecki Posted June 25, 2008 Share Posted June 25, 2008 Here's how I do it: Send an email with the sha1 hash of the email and a phrase only the webserver knows. An example (untested): <?php $secret = 'watermelon'; //Change this to something long and complicated $email = $_GET['email']; //Clean this variable first! $hash = sha1($email.$secret); $mailText = "To validate, click here: http://example.com/step2.php?email=$email&hash=$hash"; //Then use mail() or whatever to send $mailText ?> And on step2.php <?php $secret = 'watermelon'; //Same as in the last script $email = $_GET['email']; //Clean this variable first! $hash = sha1($email.$secret); $theirHash = $_GET['hash']; if ($hash == $theirHash){ //Add to your email list or whatever } ?> This is how xkcdmailer works, except the secret is a random number generated every 15 minutes, and stored in a text file blocked from clients using .htaccess. Link to comment https://forums.phpfreaks.com/topic/111798-how-to-send-email-using-php-codes-for-account-activation/#findComment-573988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.