The answer to a unique email to verify that someone has an inherent flaw can be faked (if you do not check the headers and ip). For example, I visit your site to register. You tell me to reply to us ers-sc.1496854427.ckdpbmhncdlkjadkajfpecc-mylist=yourdomain.net@ listdomain.com . I use the mail() function, using a spam bot to respond. Game over. The goal is defeated.
Instead, you can send me a link to check on my register identifier. Something like example.com/verify?userid=1&hash=67gk65fs6714fgsHguj
In the users table:
id|username|status|onetimehash --+--------+------+------------------------- 1|testuser| 0 |67gk65fs6714fgsHguj
Now in your test call, check the user id and hash. If they match the values ββin your db, you can safely check the user. To generate the hash, you can take the value md5 or sha1 of the username mixed with some salt timestamp or some random number.
UPDATE If you intend to use the previous solution, that is, capturing the user's response for checking email, you will have to configure your own mail server. Fetchmail can help you. You will need to programmatically read the email headers and extract the necessary information from the <to>,<from> or <subject> fields. Like userid = 1496854427 and hash = ckdpbmhncdlkjadkajfpecc. In this process, you may need a regular expression. Once you have these values, its pretty simple, check them for database values.
Bottom line: the previous method is not just tedious, but also more vulnerable than the last. Most webapps use the second solution as it is cleaner and wiser.
jerrymouse
source share