JavaScript Editor Ajax software     Free javascripts 



Main Page

{
$new_query_string .= ($new_query_string == ‘’ ? ‘?’ : ‘&‘)
. urlencode($name) . ‘=’ . urlencode($value);
}
}
// return the URL that doesn’t contain $param
return $url_path . $new_query_string;
}
?>
2.
In your
seophp
folder, create a new script named
aff_test.php
and type the following code:
<?php
// include URL utils library
require_once ‘include/url_utils.inc.php’;
// load configuration script
require_once ‘include/config.inc.php’;
// start PHP session
session_start();
// redirect affiliate links
if (isset($_REQUEST[‘aff_id’]))
{
// save the affiliate ID
$_SESSION[‘aff_id’] = $_REQUEST[‘aff_id’];
// obtain the URL with no affiliate ID
$clean_url = SITE_DOMAIN . remove_query_param($_SERVER[‘REQUEST_URI’], ‘aff_id’);
// 301 redirect to the new URL
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location: ‘ . $clean_url);
}
// display affiliate details
echo ‘You got here through affiliate: ‘;
if (!isset($_SESSION[‘aff_id’]))
{
echo ‘(no affiliate)‘;
}
else
{
echo $_SESSION[‘aff_id’];
}
?>
3.
Load
http://seophp.example.com/aff_test.php
and expect to get the results displayed in
Figure 5-3.
113
Chapter 5: Duplicate Content
c05.qxd:c05 10:41 113


JavaScript Editor Ajax software     Free javascripts