Jump to content

Advanced "Tell A Friend" script


jimmyp3016

Recommended Posts

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

well i've used this before...
Bascally make a table for your invites.

id - INT
invite_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 author=xyn link=topic=114419.msg465576#msg465576 date=1163102914]
well i've used this before...
Bascally make a table for your invites.

id - INT
invite_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 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 - INT
invite_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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.