lse123
06-19-2007, 04:43 PM
first code is in home-page , well to use the second code in a subpage, this is correct[to use $_SESSION['affiliate'] = $affiliate ? Please note that between home-page_____subpage may exist one or two pages , is needed any session program or reference to these vars in these one or two sub-pages ?
<?php
session_start( );
$affiliate = '10000'; //default value
if (isset($_COOKIE['aff']) && ($_COOKIE['aff'] != Null))
{
$affiliate = $_COOKIE['aff'];
}
else if (isset($_GET['aff']) && ($_GET['aff'] != Null)) {
$affiliate = $_GET['aff'];
setcookie("aff", $affiliate, time()+60*60*24*90); // 3 months
}
$_SESSION['affiliate'] = $affiliate ;
?>
<?php
session_start();
$affiliate_id = $_SESSION['affiliate'];
$email_text = "You book through affiliate ID: {$affiliate_id}";
?>
<?php
session_start( );
$affiliate = '10000'; //default value
if (isset($_COOKIE['aff']) && ($_COOKIE['aff'] != Null))
{
$affiliate = $_COOKIE['aff'];
}
else if (isset($_GET['aff']) && ($_GET['aff'] != Null)) {
$affiliate = $_GET['aff'];
setcookie("aff", $affiliate, time()+60*60*24*90); // 3 months
}
$_SESSION['affiliate'] = $affiliate ;
?>
<?php
session_start();
$affiliate_id = $_SESSION['affiliate'];
$email_text = "You book through affiliate ID: {$affiliate_id}";
?>