Thomisback Posted June 22, 2008 Share Posted June 22, 2008 Hi, I'm trying to set some cookies in PHP, in firefox it works perfectly but in Internet Explorer it just creates a loop. This is my code: $check = mysql_query("SELECT * FROM phaos_users WHERE UID='$userid'") or die(mysql_error()); while($row = mysql_fetch_array($check)){ $PHP_PHAOS_USER = $row['username']; } $PHP_PHAOS_MD5PW = md5($userid); setcookie("PHP_PHAOS_USER",$PHP_PHAOS_USER,time()+17280000); // ( REMEMBERS USER NAME FOR 200 DAYS ) setcookie("PHP_PHAOS_MD5PW",$PHP_PHAOS_MD5PW,time()+172800); // ( REMEMBERS USER PASSWORD FOR 2 DAYS ) setcookie('lang',$lang,time()+17280000); // ( REMEMBERS LANGUAGE FOR 200 DAYS ) setcookie("PHP_PHAOS_PW",0,time()-3600); // remove cookie used in version 0.88 $result = mysql_query("SELECT * FROM phaos_characters WHERE username = '$PHP_PHAOS_USER'"); if ($row = mysql_fetch_array($result)) { $PHP_PHAOS_CHARID = $row['id']; $PHP_PHAOS_CHAR = $row['name']; } else { $PHP_PHAOS_CHARID=0; } Quote Link to comment https://forums.phpfreaks.com/topic/111312-solved-cookie-not-working-in-internet-explorer/ Share on other sites More sharing options...
trq Posted June 22, 2008 Share Posted June 22, 2008 but in Internet Explorer it just creates a loop. PHP has no idea what a browser is let alone has the ability to run code differently depending on browser. Explain what exactly you meen by IE creates a loop? Quote Link to comment https://forums.phpfreaks.com/topic/111312-solved-cookie-not-working-in-internet-explorer/#findComment-571400 Share on other sites More sharing options...
Thomisback Posted June 22, 2008 Author Share Posted June 22, 2008 Well, my code tries to sets cookies and goes to the members area but if there is no cookie it will try to set them again. Quote Link to comment https://forums.phpfreaks.com/topic/111312-solved-cookie-not-working-in-internet-explorer/#findComment-571403 Share on other sites More sharing options...
Thomisback Posted June 22, 2008 Author Share Posted June 22, 2008 Solved it! I added this to the beginning of the page: header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); Quote Link to comment https://forums.phpfreaks.com/topic/111312-solved-cookie-not-working-in-internet-explorer/#findComment-571432 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.