View Single Post
Old 2004-10-03, 01:13 PM   #5
Barron
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";
}
?>
Barron is offline   Reply With Quote