Eugene Posted September 26, 2006 Share Posted September 26, 2006 I've tried LITERALLY, PHYSICALLY, TECHNICALLY, everything to get my cookies to set on my website. It just doesn't work. When I set them on my own PHPServer (EasyPhp 1.7) it works like a charm. When I do it on my online server, nothing happens? Help? All the code is in the headers, I don't get the problem... Link to comment https://forums.phpfreaks.com/topic/22101-cookies-help/ Share on other sites More sharing options...
trq Posted September 26, 2006 Share Posted September 26, 2006 You might want to show us some code. Link to comment https://forums.phpfreaks.com/topic/22101-cookies-help/#findComment-98916 Share on other sites More sharing options...
Eugene Posted September 26, 2006 Author Share Posted September 26, 2006 [code=php:0]<?phpclass cookies { // <start function> function bake($username, $password, $cname) { setcookie('username', $username, 60 * 60 * 24 * 60 + time()); setcookie('password', $password, 60 * 60 * 24 * 60 + time()); setcookie('cname', $cname, 60 * 60 * 24 * 60 + time()); } // </end function> // </start function> function eat($username, $password, $cname) { setcookie('username', $username, -60 * 60 * 24 * 60 + time()); setcookie('password', $password, -60 * 60 * 24 * 60 + time()); setcookie('cname', $cname, 60 * 60 * 24 * 60 + time()); } // </end function>} ?>[/code]Thats the cookie function itselfThe following is the code that initiates the cookies. It works on my server, but it doesn't actually set the cookies online.[code=php:0]if($this->_sql->myclass->_rows[2] == $this->_password) { if(!empty($this->_remember)) { $this->_cookie = new load("cookies"); $this->_cookie->rsnclass->bake($this->_username, $this->_password, $this->_sql->rsnclass->_rows['cname']); $this->_sql->rsnclass->DBQUery("UPDATE sometable SET login_time = '$this->_login_time' WHERE username = '$this->_username'"); $this->_login->rsnclass->redirect("index.php?go=cc/admin"); }[/code]Like I said, that code works fine, it's the cookies I have a problem with. Link to comment https://forums.phpfreaks.com/topic/22101-cookies-help/#findComment-98922 Share on other sites More sharing options...
Eugene Posted September 26, 2006 Author Share Posted September 26, 2006 Fixed. I just used ob_start(); function. Thanks a lot for the Headers tip. Link to comment https://forums.phpfreaks.com/topic/22101-cookies-help/#findComment-98984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.