質問

Google+ had a pretty simple invite system where one invite link contained 150 sign ups. As users signed up via the invite link, the number of available seats went down and eventually the invitation link died when 150 sign ups were reached. I am building a service and would like to provide all new users with a link w/ x amount of invites to share. How would one go about replicating this system in its simplest form w/ PHP.

役に立ちましたか?

解決

Create a database table: "invites".

  • id
  • user_id
  • capacity

The registeration link will contain the inviter's user_id: www.domain.com/join.php?invited_by=14530

Then ,in the join.php you'll have 2 functions. 1 - decrease the capacity of user_id = 14530 by one. 2 - insert a new row to "invites" with the new user_id and a default of 150 invites.

You'll need to have a condition as well! This condition will check if the inviter's capacity isn't zero. If so , the invited visitor won't be able to join.

The simplest way , I guess.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top