derekstattin
asked on
problem with overwritting php cookie
I am having a problem with cookies using php.
I have pages that track what affiliate sent me traffic, and what the keyword for the add is.
ID is the affiliates ID
http://www.mysite.com/index.php?ID=100&keyword=abc
I have the code below on msyite.com/index.php, and mysite.com/someotherpage.p hp
When a user click thru to http://www.mysite.com/index.php?ID=100&wk=abc
, then goes to
mysite.com/someotherpage.p hp
that has the same code below,(the same code as mysite.com/index.php) the cookies are overwritten from ID=100&wk=abc to values of 0., and I can't capture the id when it is uploaded into a database.
<?php
$ID_club = $_GET['ID'];
$keyword = $_GET['keyword'];
setcookie("club_id_refer", $ID_club);
setcookie("club_id_refer", $ID_club, time()+3600); /* expire in 1 hour */
setcookie("keyword_refer", $keyword);
setcookie("keyword_refer", $keyword, time()+3600); /* expire in 1 hour */
?>
How can I make sure that this cookie is not overwritten from the page that the user first arrives at?
Thanks for the help!
I have pages that track what affiliate sent me traffic, and what the keyword for the add is.
ID is the affiliates ID
http://www.mysite.com/index.php?ID=100&keyword=abc
I have the code below on msyite.com/index.php, and mysite.com/someotherpage.p
When a user click thru to http://www.mysite.com/index.php?ID=100&wk=abc
, then goes to
mysite.com/someotherpage.p
that has the same code below,(the same code as mysite.com/index.php) the cookies are overwritten from ID=100&wk=abc to values of 0., and I can't capture the id when it is uploaded into a database.
<?php
$ID_club = $_GET['ID'];
$keyword = $_GET['keyword'];
setcookie("club_id_refer",
setcookie("club_id_refer",
setcookie("keyword_refer",
setcookie("keyword_refer",
?>
How can I make sure that this cookie is not overwritten from the page that the user first arrives at?
Thanks for the help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.