First let me ask you a question, does the site your putting this on give you access to mysql?
If user2 comes into your site with address that ends in ?refid=123 or some other number this code checks it and sets a cookie OR it see if as cookie exists and if yes reads it and puts into a session variable.
PHP Code:
<?php
session_start;
$_SESSION["rewards"] = '';
if(isset($_GET['refid'])){
setcookie("njfailREWARDsystem", $_GET['refid'], time()+604800);
}else if(isset($_COOKIE["njfailREWARDsystem"])){
$value = $_COOKIE["njfailREWARDsystem"];
$_SESSION["rewards"] = $value;
echo $_SESSION["rewards"]; // ONLY here for show
}
?>
You should be having trouble with the code you published
, are you?