adwarm — 2011-09-11T09:27:02-04:00 — #1
I'm having a little problem with Cookies when being used with Internet Explorer, i don't have this problem with any other browser, just Internet Explorer so your help would be very much appreciated.
Here is my code:
//do nothing because of duplicate lead from same IP for same campaign
//CHECK IF COOKIE EXISTS BEFORE ADDING LEAD TO DATABASE
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$query = sprintf("INSERT INTO affleads VALUES ('','%s',%s,'%s',%s,%s,%s,%s,%s,%s,'%s','%s','%s','%s')",
mysql_query($query) or dies(mysql_error());
For some reasons leads are not being added to the database if the browser they are using is Internet Explorer which leaves to be think it has something to do with the code that checks to see if the cookie exists or not.
Does IE block checks to see if there are cookies on the users PC or something, if you guys could help me out that would be great. Like i said it works 100% for all other browsers, just not IE.
silversurfer5150 — 2011-09-11T17:21:28-04:00 — #2
Try removing the @ from @mysql_select_db($database), sometimes other browsers are more forgiving than IE. Did you mean to put this in there and if so what does it do, I am curious as I have never seen it before?
felgall — 2011-09-11T17:41:49-04:00 — #3
That wouldn't make any difference to how the code runs as that code runs on the server and is completely valid - it suppresses any error messages that would be otherwise generated from the database call if it were to fail for any reason.
Removing it temporarily may result in your being able to see an error message to help you to work out what is wrong.
adwarm — 2011-09-13T06:41:56-04:00 — #4
I've been looking into this and add the php code to view all errors and warnings and this is what is displayed:
Notice: Undefined index: lnm_lead_affid in /home/loud/public_html/track/lead.php on line 30
Notice: Undefined index: lnm_lead_subid in /home/loud/public_html/track/lead.php on line 31
Notice: Undefined index: lnm_click in /home/loud/public_html/track/lead.php on line 32
But i know the cookies are being set as it works 100% fine in all the other browsers, just not IE.
chris_upjohn — 2011-09-13T07:52:59-04:00 — #5
Could you please post the rest of your code as the errors refer to three undefined variables/array items which your first snippet of code doesn't have.
adwarm — 2011-09-13T07:57:48-04:00 — #6
Its on about the following code:
But on click.php it stores the data in the cookies and creates the cookie. Like i said it works 100% fine in all other browsers, just not IE.
I use tools to view the cookies and can confirm the cookie exists and the data is added fine (i dont know about IE as the tool only works firefox). Below is the code on the click.php that sets the cookies
setcookie("lnm_click", "$ip", $expire);
setcookie("lnm_lead_subid", "$subid", $expire);
setcookie("lnm_lead_affid", "$affid", $expire);
starlion — 2011-09-13T08:28:41-04:00 — #7
Stupid question, i'm sure, but... is the IE you're using to test set to reject cookies?
adwarm — 2011-09-13T08:34:24-04:00 — #8
I've made 2 simple php pages, 1 that sets cookies and 1 that reads cookies and when i visit each one of them it sets the cookies fine and reads the cookies fine. How ever when i load the lead.php in an iframe on another site it can not find the cookies.
Why is that?
starlion — 2011-09-13T08:36:50-04:00 — #9
adwarm — 2011-09-13T08:43:53-04:00 — #10
Interesting, but if i add the below to lead.php then wont it will cause a problem for the code under it as the header as already been set?
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
Thanks for your help StarLion, i was Googleing by the way, 24hrs actually but i never searched for that Term and i do actually remember reading about p3p on a comment someone wrote on php.net but didnt think it would have been that. Guess next time i should try everything i read
starlion — 2011-09-13T08:44:59-04:00 — #11
You can call header more than once - so long as the headers dont mutually exclude one another, and no output has been sent to the browser.
adwarm — 2011-09-13T09:04:53-04:00 — #12
Thank you StarLion once again!
Thank you very much!