开发者

PHP friend invite link

I am implementing an invite feature. So in a database I have the following fields: invite_number, person_sending, user_receiving, and email_to_send_to.

Invite_number is basically id for the request, person_sending is the id of the person sending the request, user_receiving is the id of the person in the users account but has 开发者_如何学运维not registered at the site, and email_to_send_to is the email the mail was sent to.

Now when I am sending the link to the user in email, how do I let the user know that the person he sent an email to has created an account?

Is sending the email link as domain.com/signup.php?id=$invitenumber the right way?

And then would I use the $invitenumber to inform the user?


Sounds about right to me, use the invite number to inform the correct user his invitation lead to a sign up, and mark it with some field to make sure someone won't use it more than once.

Though, I really recommend you name your database columns a bit more clear - invite_number could be simply 'id' - as the table is 'invitations' and the id is the invitation(row) id. Also, try to name fields that refer to another table field to be clear enough for someone to understand. For example, person_sending could be sender_id, receiver_id, etc. Just my 2 cent.


yes, that is the right way. but don't forget to encrypt the invite number or use invite_number field as a GUID. otherwise you will allow users to copy the link, modify (increase/decrease) id number and accept other invitations. other than that, your method is ok.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜