Jump to content


Photo

Problem With Cookies


  • Please log in to reply
14 replies to this topic

#1 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 26 May 2006 - 04:25 PM

hi all, can anyone help me?
setcookie('user_id',1,mktime(0, 0, 0, 12, 32, 2030));

when i try to display the valeu of $_COOKIE['user_id']
in IE it works,
in Opera it doesn't

In Opera it some how disappears [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]

#2 gerkintrigg

gerkintrigg
  • Members
  • PipPipPip
  • Magician
  • 828 posts
  • LocationBristol, UK
  • Age:37

Posted 26 May 2006 - 04:40 PM

have you tried changing the ammount of time it's set by?
for example set it in seconds??

Try the tutorials to find out how...
Then again i never use opera.
Neil Trigger - http://www.ghostlypublishing.co.uk - Ghostly Publishing - Children's Fantasy Books

#3 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 26 May 2006 - 04:49 PM

the strange thing when i try to display in in IE:
Array
(
[user_id] => 1
)
it works.....

but Opera:
Array
(
)

cookie is gone :(


#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 26 May 2006 - 05:24 PM

maybe you have your opera browser settings set to not accept cookies.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 27 May 2006 - 08:03 AM

Browser settings is ok, it accepts cookies.
In opera it creats the cookie and it working wile the page is up, when i close opera and try to open it again the cookie is gone...
[img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]

#6 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 30 May 2006 - 09:26 AM

So... will iget any help?

#7 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 June 2006 - 02:46 PM

can anyone help me with this???? please?????

#8 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 June 2006 - 03:59 PM

Make sure you dont have the setting "Delete new cookies when exiting Opera" is ticked. You can check this by going to Tools -> Preferences Avanced Tab -> Cookies

Thats the only thing I ahve come up as to why Opera is deleting the cookie.

#9 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 June 2006 - 05:53 PM

The setting is ok....

I don't know why i have this problem and it's pissing me off.



#10 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 June 2006 - 06:20 PM

Intresting! I have tried your script and it works fine for me. I have no idea what else might be the problem. This is the code I used:
<?php

// check that cookie hasnt been set
if(!isset($_COOKIE['user_id']))
{
    // set the cookie
    setcookie('user_id',1,mktime(0, 0, 0, 12, 32, 2030));

    echo "Cookie has been set. Refresh the browser window";
}
else
{
    // get the cookie
    echo "Retrieving cookie...<br />\n";
    echo $_COOKIE['user_id'];
}

?>


#11 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 14 July 2006 - 03:36 PM

wildteen88 make one page with this code:
<?php

// check that cookie hasnt been set
if(!isset($_COOKIE['user_id']))
{
    // set the cookie
    setcookie('user_id',1,mktime(0, 0, 0, 12, 32, 2030));

    echo "Cookie has been set. Refresh the browser window";
}
?>
and enother page with this code:
<?php

// check that cookie hasnt been set
if(isset($_COOKIE['user_id']))
{
    // get the cookie
    echo "Retrieving cookie...<br />\n";
    echo $_COOKIE['user_id'];
}
?>

do the folowing:
1) activate the first page.
2) go to the second page.
3) close the opera.
4) open the opera and open the second page ""WITHOUT THE FIRST ONE""!!!
5) do refresh and you will see that the cookie is not set any more


#12 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 July 2006 - 03:39 PM

Did what you said and it works fine for me. Cookie is still set.

EDIT: Heres a short video

#13 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 14 July 2006 - 08:11 PM

I found the problem....
Opera doesn't save cookies from local files, when i uploaded the files to a host, the cookie worked...
:-\  i wish it would work on local files too

#14 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 July 2006 - 08:38 PM

It does work with local files. Look at the attached video, you'll see the files are being served locally.

#15 [)OBER]V[AN

[)OBER]V[AN
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 14 July 2006 - 08:41 PM

yeah but mine some how doesn't work  ???




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users