Jump to content

Cannot set cookies in Firefox, only in IE


JCS1988

Recommended Posts

Thanks for the reply. I tried that but I get a syntax error.

 

Parse error: syntax error, unexpected ',' in /whs2fs1_2us4_2/jcs5325aii/domains/jcs5325.aisites.com/public_html/member-index.php on line 6

 

The modified code:

<?php	
session_start();
require_once('auth.php');
$customer_id = $_SESSION['SESS_CUSTOMER_ID'];

setcookie("currentcustomer", $customer_id, time()+3600*24), '/', 'www.jcs5325.aisites.com';

?>

 

Link to comment
Share on other sites

Removing the ")" gives me an error.

 

Parse error: syntax error, unexpected ';' in /whs2fs1_2us4_2/jcs5325aii/domains/jcs5325.aisites.com/public_html/member-index.php on line 6

 

This is what I have

<?php	
session_start();
require_once('auth.php');
$customer_id = $_SESSION['SESS_CUSTOMER_ID'];

setcookie("currentcustomer", $customer_id, time()+3600*24, '/', 'www.jcs5325.aisites.com';
?>

 

 

Link to comment
Share on other sites

I didn't say remove it, I said it's causing the problem...

 

setcookie("currentcustomer", $customer_id, time()+3600*24, '/', 'www.jcs5325.aisites.com';

 

That's with it removed, do you see anything wrong? Maybe a mising ")" before the semi-colon?

 

The error even tells you the problem... unexpected ';'... that means there's something missing before the semi-colon. Geez. :D

Link to comment
Share on other sites

I just found this on PHP.net:

 

If output exists prior to calling this function, setcookie() will fail and return FALSE. If setcookie() successfully runs, it will return TRUE. This does not indicate whether the user accepted the cookie.

 

That's interesting to note... also it isn't deprecated.

Link to comment
Share on other sites

Thanks for checking that. Feeling a bit too lazy today to check it myself.

 

setcookie for settings cookies

$_COOKIE for retrieving cookies.

 

 

Good pickup on the setcookie returning false if output has occured already. One to keep an eye out for now... :o

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.