Author Topic: Post signup integration for affiliates ( kind of )  (Read 5872 times)

mike2

  • Posts: 193
    • View Profile
Post signup integration for affiliates ( kind of )
« on: August 21, 2007, 09:50:38 am »
I have set up a site for my team members to use for lead generation and am using Listmail and small php files as a kind of like small affiliate system.

It works easily and there are only a few handful of members, so I just did it this way, but here is what I need:

I keep the users info in a small php file named say "12345.php" and when the member promotes the site, they use "index.php?ref_id=12345" as their ID tracking.  Listmail stores this ID as an optional field when prospects fill out the form for additional details via email.

The problem I need solved is that I would like Listmail/PHP to take the ID#, inspect the file associated with it, extract the Team members email address and also forward them a copy of the Lead so they can follow up with them.

I'd guess this could be done in signup-extra, but being a PHP noob, I could use a push in the right direction on the easiest way to make this happen.  
Oh yea, this should only be done for 1 of my lists.

Dean or any other PHP person got any pointers?

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Post signup integration for affiliates ( kind of )
« Reply #1 on: August 21, 2007, 05:36:46 pm »
Hi Mike,

You should really be using a MySQL database for this or at least be heavily sanitizing input to remove slashes, etc. [actually, just use if(!is_numeric($ref)) exit('error');] so an attacker can't include files you don't want them to.  If all affiliates are subscribed to LMP you could use the LMP database.
Quote
I would like Listmail/PHP to take the ID#, inspect the file associated with it, extract the Team members email address and also forward them a copy of the Lead so they can follow up with them.

For signup-xtra.php, example for list 3 with referral ID in custom field 1.
Code: [Select]
<?phpif($list=='3' && $user1){ if(is_numeric($user1)){  // get affiliate information, set $to_email  // depends where the user data is stored...  $to_email='';  // send an email  $from_name=''; // no quotes in string  $from_email='';  $bounce_email=$from_email; // or customize  $msg = "Test message";  $subject = "Test subject";  // NOTE: All message codes need to be processed manually using vars passed to or found by signup-xtra.php  $msg = eregi_replace('!fname',$fname,$msg);  $msg = eregi_replace('!affiliate_email',$to_email,$msg);  // send mail  mail($to_email,$subject,$msg,"From: \"$from_name\" <$from_email>\nReturn-path: $bounce_email"); } // else skip, not numeric}?>

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

mike2

  • Posts: 193
    • View Profile
Post signup integration for affiliates ( kind of )
« Reply #2 on: August 23, 2007, 01:46:53 pm »
I actually hadn't thought of putting all the affiliates into a list in Listmail, that would be way too easy, DUH...

Ok so I'll go do that, but then I will need the exact code to use in the signup-extra to email the affiliate a copy of the new signup email ( I just want it exactly like I get it but to go to them also ).

I'll also need some code to put in my web pages to display their info on them.  Right now I just use an include statement that grabs their .php file I create for them so their contact info is on the web page:

Code: [Select]
include 'users/' . $_GET['ref_id'] . '.php';

Let me know, thanks.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Post signup integration for affiliates ( kind of )
« Reply #3 on: August 23, 2007, 07:05:37 pm »
Hi Mike,

So your affiliates will now be on a ListMail list...  Will their affiliate ID be their auto-incrementing ListMail id or will it be stored in a custom fields? (If so, which one?)

Without hacking the ListMail code directly we will need to manually create the signup notification and process the message codes in it, which is fairly straightforward.
Quote
I'll also need some code to put in my web pages to display their info on them.

What should the affiliate see when they browse to their page?  If the affiliate is identified solely based on numeric ID it will be easy to change, so the page should not display sensitive user information.  You could, of course, add a password in another custom field... but that will take a whole 'nother script for them to be able to update it. :)

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

mike2

  • Posts: 193
    • View Profile
Post signup integration for affiliates ( kind of )
« Reply #4 on: August 24, 2007, 02:08:51 pm »
Ok I think I haven't been clear about what I need because I think you are talking about something that I'm not...  That or I just don't understand what you are saying ( which is very possible lol).

Let me try to explain in more detail... ( sorry to post these URL's, but it might help if you see what I am talking about ).

I have about 10 members that I am letting use a copy of my site to promote their own biz... here is a sample of mine:

http://www.fastestcashevermembers.com/movie.php?ref_id=12345

And one that I made for a member:

http://www.fastestcashevermembers.com/movie.php?ref_id=45404

Ok, you'll see at the end of the page it has MY or THEIR contact info.  Right now what I am doing is simply creating files in "/public_html/users" that are called, "12345.php" and "45404.php" respectively which correspond to the member ID in the URL.  Then I simply call this code to include that users info on the page so members know who to contact:  
Code: [Select]
include 'users/' . $_GET['ref_id'] . '.php';

This works great for the most part... now what I do is on the main page of the site, there is an opt-in form and it stores the ID# in a custom ListMail field, so on my followups I send them to the right members page, this way the follow ups work for any amount of people.  

Now all I need to do is:  When a potential lead fills out the opt-in form Listmail sends me the "List 24: New Signup! - test@test.com" email which is great.   But I also want this same exact email to goto the member whos ID# generated this signup.  So if that member is ID#45404 then the signup extra can open the "public_html/users/45404.php" file and extract the members email address in it and send the same notification email to them.

Now, I'm not opposed to putting the members in a separate Listmail List if that makes it easier.  The only problem with this is that I have one user that wants me to add her google conversion code in and by using the "45404.php" file included on the site I can easily do this just by adding her code to that file.  If they are in a Listmail List this might be more difficult? ( Unless I can store it in a custom field, but it's a lot of data ).

I don't need the member themselves to be able to change their info, etc.  They can just email me to do that ( now in the future if I do get more members it may be nice if they could ).

Let me know what you think, hope I made this more clear.

mike2

  • Posts: 193
    • View Profile
Post signup integration for affiliates ( kind of )
« Reply #5 on: August 27, 2007, 08:49:53 am »
Bump, any thoughts this, I kind of need this asap, thanks.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Post signup integration for affiliates ( kind of )
« Reply #6 on: August 27, 2007, 11:33:49 am »
Hi Mike,

I needed that bump... ok

The signup-xtra.php script may have trouble including the public_html/users/12345.php file as you describe.  There is a common restriction on PHP scripts accessing files in parent folders.  I recommend trying it yourself with a test script in the ListMail folder which simply includes a users file.

I'd have to see the structure to be sure how you're doing it... but instead of parsing the entire 12345.php file manually each time you could set a variable in it.  You could use some further variables to determine whether to suppress output (such as when including the file in signup-xtra.php to simply get the referral ID), but that seems a bit of a messy approach...  What exactly is the content of the file?

Are you averse to managing your users in PhpMyAdmin?  A better way to do this is by setting up a simple database table holding your affiliate data.  You could have fields for ID, name, phone #, extra page output, etc. then use one include file that detects the affiliates' ID from the filename or a URL variable (can also be passed by mod_rewrite rule, if you're familiar with that...)  We could indeed use the ListMail database as a backend, and you could store custom page output in a custom field (they hold up to 65535 characters) but it would have to be put on a single line (current interface restriction) unless you use PhpMyAdmin to enter it and don't edit the user in ListMail (in which case you might lose multi-line data...)

Let me know if you need further assistance.  You're really active around here so I don't mind going out of my way. :D
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

mike2

  • Posts: 193
    • View Profile
Post signup integration for affiliates ( kind of )
« Reply #7 on: August 28, 2007, 01:28:06 pm »
Ok you've pushed me in a better direction...

Here's what I've done...  In the users file instead of just having data, I now set everything as a variable like:
Code: [Select]
<?php //Set Affiliates Variables$aff_name="Michael Rogers";$aff_phone="937-687-3014";$aff_email="mike@tristateweb.com";$aff_tracking='';// Don't Edit below thisIF (isset($_get['email_lead'])) {$subj="New FCE Lead";$msg="You have a new lead:\n\nName: " . $_GET['fname'] . " " . $_GET['lname'] ."\nEmail: " . $_GET['email'] ."\nPhone: " . $_GET['phone'];$header ="From: FCE <info@fastestcashevermembers.com>\n";$header .= "MIME-Version: 1.0\n";mail($aff_email,$subj,$msg,$header);} else {echo $aff_name . "<br>" . $aff_phone . "<br>" . $aff_email . "<br><br>" . $aff_tracking; }?>



Now when called normally from the site it simply displays the affiliates information to the potential customer.

In signup-xtra.php I now simply call the above file setting email_user=1 which then just emails the affiliate giving them the lead info.  I use curl like this:  
Code: [Select]
<?phpif($list=='24'){ $ch = curl_init();curl_setopt($ch, CURLOPT_URL,"http://www.fastestcashevermembers.com/users/" . $user1 . ".php?email_lead=1&fname=" . $fname . "&lname=" . $lname . "&email=" . $email . "&phone=" . $user2);ob_start();      // prevent any outputcurl_exec ($ch); // execute the curl commandob_end_clean();  // stop preventing outputcurl_close ($ch);unset($ch);}?>



This seems to work real good for what I need at the moment.  If I start to get a lot of users I may move them to a Listmail DB then go from there.

Thanks for your help/guidance.