| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		mickey -
 
  Joined: 09 Dec 2002 Posts: 25
 
  | 
		
			
				 Posted: Sun Feb 23, 2003 3:08 pm    Post subject: How do I get cookies to work? | 
				      | 
			 
			
				
  | 
			 
			
				I am having a problem getting cookies to work on my computer, I have: 
 
 
1. made sure that the browser is set to accept them and 
 
2. changed my php.ini file (to what has been suggested in some of the other postings), as below:
 
 
session.use_cookies = 1
 
session.name = PHPSESSID
 
session.auto_start = 1
 
session.cookie_lifetime = 0
 
session.cookie_path = c:\Program Files\Abyss Web Server\tmp
 
session.cookie_domain = localhost
 
 
is there something else that I may have missed?   :?:  
 
 
this is the script that i am using:
 
<?
 
$cookie_name = "test_cookie";
 
$cookie_value = "test_string";
 
$cookie_expire = time()+900;
 
$cookie_domain = "http://localhost";
 
setcookie($cookie_name, $cookie_value, $cookie_expire, "/", $cookie_domain, 0);
 
?>
 
<html>
 
<head><title>Set Test</title>
 
</head>
 
<body>
 
 
<h1>cookie sent!</h1>
 
</body>
 
</html> | 
			 
		  | 
	
	
		| Back to top | 
		
			          | 
		
	
	
		  | 
	
	
		aprelium -
 
  Joined: 22 Mar 2002 Posts: 6800
 
  | 
		
			
				 Posted: Mon Feb 24, 2003 1:17 am    Post subject: Re: How do I get cookies to work? | 
				      | 
			 
			
				
  | 
			 
			
				Do not use http in $cookie_domain = "http://localhost";
 
Change it to $cookie_domain = "localhost"; _________________ Support Team
 
Aprelium - http://www.aprelium.com | 
			 
		  | 
	
	
		| Back to top | 
		
			           | 
		
	
	
		  | 
	
	
		mickey -
 
  Joined: 09 Dec 2002 Posts: 25
 
  | 
		
			
				 Posted: Mon Feb 24, 2003 4:02 am    Post subject:  | 
				      | 
			 
			
				
  | 
			 
			
				| Thanks for the help.  I changed the part indicated to "localhost" but this hasn't made a difference, any other ideas please. | 
			 
		  | 
	
	
		| Back to top | 
		
			          | 
		
	
	
		  | 
	
	
		aprelium -
 
  Joined: 22 Mar 2002 Posts: 6800
 
  | 
		
			
				 Posted: Tue Feb 25, 2003 3:23 am    Post subject: Re: How do I get cookies to work? | 
				      | 
			 
			
				
  | 
			 
			
				Mickey, there are a lot of incompatibilities between browsers regarding cookies. We managed to have them work using your example on both IE and Opera by avoiding refering to the domain name.
 
 
 
 	  | Code: | 	 		  
 
<?
 
$cookie_name = "test_cookie";
 
$cookie_value = "test_string";
 
$cookie_expire = time()+900;
 
setcookie($cookie_name, $cookie_value, $cookie_expire, "/", "", 0);
 
?>
 
<html>
 
<head><title>Set Test</title>
 
</head>
 
<body>
 
 
<h1>cookie sent!</h1>
 
</body>
 
</html> | 	  
 
 
We recommend reading the discussion in the PHP reference about SetCookie for more information about browser-cookies issues. _________________ Support Team
 
Aprelium - http://www.aprelium.com | 
			 
		  | 
	
	
		| Back to top | 
		
			           | 
		
	
	
		  | 
	
	
		mickey -
 
  Joined: 09 Dec 2002 Posts: 25
 
  | 
		
			
				 Posted: Tue Feb 25, 2003 1:58 pm    Post subject:  | 
				      | 
			 
			
				
  | 
			 
			
				Thankyou so much...made the changes and it works now.  I had tried in three browsers IE, Opera, and Netscape and it wouldn't work in either.  
 
 
 
will take a look at the PHP reference, 
 
 
Thanks again :D | 
			 
		  | 
	
	
		| Back to top | 
		
			          | 
		
	
	
		  | 
	
	
		 |