I have a script for a basic login, and it only seems to work in Firefox. I've searched for a long time on this problem, and can't find a solution that works in IE or Safari (my other test browsers). I've pulled the cookie part out of my main login script, which explains why I'm being lazy and using GET. <? ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); $user = $_GET['1']; $pass = $_GET['2']; setcookie("username", $user, time()+36000000, "/xyz/", ".xxx.com", 1); setcookie("password", $pass, time()+36000000, "/xyz/", ".xxx.com", 1); ?> PHP: Every variation of this code seems to work in FF, but it absolutely will not work in IE or Safari. There is no cookie file being created. I have everything as unsecure as possible, and still the cookie isn't being created. I've tried every solution I could find on Google, but nothing changes. The correct values are in the 2 variables. halp:<
Try this: <?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); $user = $_GET['1']; setcookie("username", $user, time()+36000000); echo $_COOKIE["username"]; ?> PHP: I tested it myself, and it works in IE, I haven't tried it on Safari though. If it still doesn't work, you should try a better (and secure) alternative, PHP sessions.
Rainulf's code should work. But remember,its never a good idea to store passwords as cookies. Try storing something unique like a user ID as cookie instead. You can still retrieve username and password using the stored unique ID whenever required.