I'm having other sites send visitors and need to track where the visitors are from so I use a variable to carry the "affiliate" ID number of the referrer in the url. I settled on using cookies (rather than sessions) to store that value because I wanted to 1) give the visitor freedom to roam around a bit before registering but mostly to 2) protect the commission of the affiliate if the visitor left, for example, and came back later from other than the affiliates site. I think I'll use a 30 day expiration, not that it matters much.
With all that said, I had never worked with cookies before but I do have them working, sort of. I was wondering if someone would double check the coding for me? It seems like they work sometimes while at other times they don't seem to work. To see them in action,
1) go to BungeeBones.com through the following link
http://bungeebones.com/index.php/5/ (the "5" would be the var of the affiliate so you are entering the site as if referred there by affiliate #5).
You will notice in the upper left of that index page the error tracking echoes of 1) the affiliate var value and 2) the variable values of two cookies. The code that generates the cookies is as follows:
setcookie ("cookie1", "Bungee Bones", time()+3600);
setcookie ("cookie2", "Bungee Bones rocks $upline_num times", time()+3600,"/bungee_jumpers");
The error tracking code shows that cookie one is set, but cookie 2 is empty as I think it should be because by the code I used I'm telling the cookie2 to apply to the bungee_jumpers folder, right? So far so good, I think, but this morning when I went to the site it seemed to have a hard time reporting a cookie.
Next, at the top of the page is a link http://www.bungeebones.com/bungee_jumpers/register.php/
under the button "Add A Site". If I go there, there are also error tracking echoes of the cookie2 variable. I just went there and cookie2 isn't showing a value. I did a lot of debugging and had begun reporting it here in this post too but cut it out. It took a lot of playing around with deleting cookies but now the cookies are working and I haven't a clue why? I don't know if they are working consistently or not. Does anyone have any ideas what is causing this problem? Thanks

Reply With Quote
