|
|
|
|
|
|
|
![]() |
|
Thread Tools | Search this Thread |
Rating: ![]() |
Display Modes |
![]() |
#1 |
"Without evil there can be no good, so it must be good to be evil sometimes" ~ Satan
Join Date: Aug 2004
Location: Motor City, baby, where carjacking was invented! Now GIMME THOSE SHOES!
Posts: 2,385
|
Looking for a way to insert affiliate codes into links
I need to find a method (as simple as possible) to script a page to add affiliate codes to links on the page by grabbing the affiliate code from the incoming URL. Basically the same thing our friendly sponsors use for FHGs and FH sites.
If I can get some direction I'm willing to do the work to learn what I need to. |
![]() |
![]() |
![]() |
#2 |
Eighteen 'til I Die
|
Check your private messages.
|
![]() |
![]() |
![]() |
#3 |
Eighteen 'til I Die
|
MadMax, resend your reply. My private messages box was full.
|
![]() |
![]() |
![]() |
#4 |
Shut up brain, or I'll stab you with a Q-tip!
Join Date: Nov 2003
Posts: 115
|
Assuming you're changing the links on a dynamically generated free hosted gallery, eg. you're changing the links on:
http://www.fhgdomain.com/fhg.php?id=cocksmoker On fhg.php: PHP Code:
|
![]() |
![]() |
![]() |
#5 |
You tried your best and you failed miserably. The lesson is 'never try'
Join Date: Oct 2004
Posts: 166
|
This is the first script I created. Its since been rewritten several times, but it will get you started with *static* FHG's. There is only basic error checking included. You can do more if you need to.
Put the template tag where your tour links are. <a href="%%url%%">Click here for great sponsor</a> Assumes FHG link: http://www.fghdomain.com/index.php?id=affiliate&tour=membership_tour Put the code in a file called index.php Watch for line wrap. <?php // Gallery you want to show $fhg_path='/path/to/fhg.html'; // // Declare template tag $tpl_tag="%%url%%"; // // Default Gallery just in case $default_gallery_path='/path/to/default/fhg.html'; // // Starting building your link $link_url="http://www.sponsordomain.com/clickthrough.php?"; // // We need dummy value anyway so lets // track hits to fhg galleries $link_url .="fhg=1"; // // Extract affiliate info from URI // and rebuild for link foreach ($HTTP_GET_VARS as $key=>$aff_info) { if ($aff_info) { $aff_info=addslashes($aff_info); $link_url .="&".$key."=".$aff_info; } } // // Default tour // /**** DANGER WILL ROBINSON! ****/ // Change the tour variable to whatever variable // clickthrough.php looks for // if (!$_GET['tour']) { $link_url .="&tour=mytour"; } // // Get contents of fhg.html $fhg_gallery=@file($path); // // If fhg.html doesnt exist get default if (!$fhg_gallery) { $fhg_gallery=@file($default_gallery_path); } // // If default doesnt exist // show the surfer something! if (!$fhg_gallery) { // watch for line wrap header("Location: $link_url"); header("Expires: Mon, 26 jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("P3P: CP=NOI DSP CURa PSAa PSDa OUR STP COM NAV STA"); header("Pragma: no-cache"); die(); } // // Do what we came here for. // Replace the template tag // and send gallery to browser // foreach ($fhg_gallery as $key=>$lines_in_fhg_gallery) { $lines_in_fhg_gallery=@str_replace($tpl_tag, $link_url, $lines_in_fhg_gallery); echo "$lines_in_fhg_gallery"; } ?> |
![]() |
![]() |
![]() |
#6 | |
Internet! Is that thing still around?
Join Date: Oct 2004
Location: NYC
Posts: 3
|
Insert affilate codes into links
Quote:
PHP Code:
$link_url = "http://www.sponsordomain.com/clickthrough.php?id=$affiliate_id "; Also if you want to use this script to insert codes into links from a form (so a reseller can insert his code and then have his ID insterted into all of your links, you can use the following: PHP Code:
This script can also serve as the basis for a POTD script using iframes. |
|
![]() |
![]() |
![]() |
#7 |
Shut up brain, or I'll stab you with a Q-tip!
Join Date: Nov 2003
Posts: 115
|
Sorry about that, I just whacked it out and didn't test it before I posted.
![]() |
![]() |
![]() |
![]() |
#8 |
"Without evil there can be no good, so it must be good to be evil sometimes" ~ Satan
Join Date: Aug 2004
Location: Motor City, baby, where carjacking was invented! Now GIMME THOSE SHOES!
Posts: 2,385
|
Hey, no problem, and thanks for the help. Seems there are more ways of doing that then I thought |rasta|
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|