jimmyp3016 Posted November 9, 2006 Share Posted November 9, 2006 Hey everyone,I am looking for an advanced tell a friend script. what i basically want the script to do is this:1. Member of my site tells a friend about the site through a form.2. If Friend joins, member gets "credit" for it (a sql statement autoincrements a number in a field. otherwise sql statement is not run.Does anyone have this type of script? Link to comment https://forums.phpfreaks.com/topic/26717-advanced-tell-a-friend-script/ Share on other sites More sharing options...
xyn Posted November 9, 2006 Share Posted November 9, 2006 well i've used this before...Bascally make a table for your invites.id - INTinvite_to - (who was invited)invite_by - (Who invited this person)Then when they send their invitation. INSERT this to the table.Then when they register, in your registry code check this table..$sql = mysql_query("SELECT * FROM invites WHERE invite_to='".$_POST[email]."'");if(mysql_num_rows( $sql ) =="1"){//do your credit thing.} Link to comment https://forums.phpfreaks.com/topic/26717-advanced-tell-a-friend-script/#findComment-122245 Share on other sites More sharing options...
obsidian Posted November 9, 2006 Share Posted November 9, 2006 [quote author=xyn link=topic=114419.msg465576#msg465576 date=1163102914]well i've used this before...Bascally make a table for your invites.id - INTinvite_to - (who was invited)invite_by - (Who invited this person)Then when they send their invitation. INSERT this to the table.Then when they register, in your registry code check this table..$sql = mysql_query("SELECT * FROM invites WHERE invite_to='".$_POST[email]."'");if(mysql_num_rows( $sql ) =="1"){//do your credit thing.}[/quote]The only problem with that approach is that if you have multiple people that are members all invite the same person, you typically want to allow only one to receive the credit. I like to generate a hash that is appended to the URL in the email they receive. Typically, it is simply an MD5 of the inviting user encrypted with a salt that I have on my server. That way, when they hit the URL you sent, you can tell based on the hash exactly who it is that sent the invitation that they [b]acted upon[/b] and give them credit for it. Link to comment https://forums.phpfreaks.com/topic/26717-advanced-tell-a-friend-script/#findComment-122250 Share on other sites More sharing options...
jimmyp3016 Posted November 9, 2006 Author Share Posted November 9, 2006 Thanks for the input guys.It pointed me in the right direction! Link to comment https://forums.phpfreaks.com/topic/26717-advanced-tell-a-friend-script/#findComment-122254 Share on other sites More sharing options...
xyn Posted November 9, 2006 Share Posted November 9, 2006 [quote author=obsidian link=topic=114419.msg465581#msg465581 date=1163104189][quote author=xyn link=topic=114419.msg465576#msg465576 date=1163102914]well i've used this before...Bascally make a table for your invites.id - INTinvite_to - (who was invited)invite_by - (Who invited this person)Then when they send their invitation. INSERT this to the table.Then when they register, in your registry code check this table..$sql = mysql_query("SELECT * FROM invites WHERE invite_to='".$_POST[email]."'");if(mysql_num_rows( $sql ) =="1"){//do your credit thing.}[/quote]The only problem with that approach is that if you have multiple people that are members all invite the same person, you typically want to allow only one to receive the credit. I like to generate a hash that is appended to the URL in the email they receive. Typically, it is simply an MD5 of the inviting user encrypted with a salt that I have on my server. That way, when they hit the URL you sent, you can tell based on the hash exactly who it is that sent the invitation that they [b]acted upon[/b] and give them credit for it.[/quote]That it a very good point. Link to comment https://forums.phpfreaks.com/topic/26717-advanced-tell-a-friend-script/#findComment-122256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.