New Zenner
- Join Date:
- Jul 2008
- Location:
- San Diego, CA
- Posts:
- 45
- Plugin Contributions:
- 0
I want to set my own cookie or session variable
Here's what I an trying to do:
Affiliate has link on their site that comes to a custom landing page.Note: in these test I am linking straight to the login page until I figure out how to get this to work.
To make this link simple and relevant, the link is to mystore/theirName/index.php
This index file will then redirect to that customer's unique page (probably an EZ-Page).
In the index.php on the landing page, I want to set a cookie or session variable with the referral code, so if they get to the log in page, the referral code will be filled automatically from the cookie/session variable.
Here is the Session code.
<?php
session_start();
$_SESSION["cust_ref"] = "theirName;
header('Location: ' . 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?main_page=login' );
exit();
?>
```And for cookie. I also tried setrawcookie.
<?
header('Location: ' . 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?main_page=login' );
setcookie("cust_ref","[I]theirName[/I]");
exit();
?>
<? echo "REFERRAL CODE >> " . $_SESSION["cust_ref"] . " <<"; ?>
OR
<? echo "REFERRAL CODE >> " . $_COOKIE["cust_ref"] . " <<"; ?>
Both of these are empty.
Any suggestions are appreciated.
Or is there a better method that I have not considered.
Thanks