validation link via email

前端 未结 7 994
盖世英雄少女心
盖世英雄少女心 2020-12-15 01:24

When a user subscribes to my newsletter via their email address, using php, how would I send them an \'Activation Link\' via email to confirm it is their email address and n

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 01:46

    Insert the user into a table with a 'pending' flag set (or a 'validated' flag not set). They should not be able to do anything until the flag is changed. If you want to be really thorough, actually put them into a users_temp table. Generate a totally random key and associate it with their user ID. The link you email to them should be http://yourwebsite.com/?activate=totallyrandomkeyigeneratedearlier. When you get an activation request, turn on the valid flag for the user with the corresponding random key.

提交回复
热议问题