Jump to content


Photo

Cookies help?


  • Please log in to reply
3 replies to this topic

#1 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 September 2006 - 02:09 PM

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...

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 26 September 2006 - 02:14 PM

You might want to show us some code.

#3 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 September 2006 - 02:18 PM

<?php
class 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>
}
	

?>

Thats the cookie function itself
The following is the code that initiates the cookies. It works on my server, but it doesn't actually set the cookies online.
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");
			}

Like I said, that code works fine, it's the cookies I have a problem with.


#4 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 September 2006 - 03:03 PM

Fixed. I just used ob_start(); function. Thanks a lot for the Headers tip.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users