it depends how the session id is passed in the URL...
eg
index.php?sid=<sessionid>
then your session variable name is 'sid'
I'm guessing the session id is the 'referralCode', in which case:
Code:
function check_sess($sid, $refCode) {
if ($sid) {
if($sid == $refCode) return TRUE;
else return FALSE;
}else return FALSE;
}
// check session and give link
if(check_sess($_GET['sid'])) print"<referral code link here>";
else print"<non-referred link>";
not sure if that's what you were after!