473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Understanding Cookies

Hello,
I have been trying to get cookies to work. It seems I can get this cookie to
be persistant in the browser but I want to write it to my Cookies Folder.
I have tried many variations but when I look in the folder there is nothing
there from my Domain.
This is a simlified version but, I have tried many things.
What am I missing?
Yes I allow all cookies
Thanks
Mike
Nov 8 '05 #1
12 1672
On Tue, 08 Nov 2005 01:17:09 GMT, "Mike" <am******@verizon.net> wrote:
I have been trying to get cookies to work. It seems I can get this cookie to
be persistant in the browser but I want to write it to my Cookies Folder.
I have tried many variations but when I look in the folder there is nothing
there from my Domain.
This is a simlified version but, I have tried many things.


What have you tried?

Presumably you have read and followed the examples at
http://uk.php.net/setcookie ?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 8 '05 #2
Yes,
Heres a perfect example;
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
?>
Can be found at:(My Domain)
http://www.ampsoft.com/B.php

I leave the browser open and check my Cookies folder and ...Nothing .
Thanks
Mike

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:4k********************************@4ax.com...
On Tue, 08 Nov 2005 01:17:09 GMT, "Mike" <am******@verizon.net> wrote:
I have been trying to get cookies to work. It seems I can get this cookie
to
be persistant in the browser but I want to write it to my Cookies Folder.
I have tried many variations but when I look in the folder there is
nothing
there from my Domain.
This is a simlified version but, I have tried many things.


What have you tried?

Presumably you have read and followed the examples at
http://uk.php.net/setcookie ?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Nov 8 '05 #3
On Tue, 08 Nov 2005 01:51:47 GMT, "Mike" <am******@verizon.net> wrote:
Heres a perfect example;
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
?>
Can be found at:(My Domain)
http://www.ampsoft.com/B.php

I leave the browser open and check my Cookies folder and ...Nothing .


That works for me, both on Firefox 1.5RC1 and Internet Explorer 6.

A cookie is set and stored; contents of the file from IE is:

TestCookie
something+from+somewhere
www.ampsoft.com/
1024
3124430464
29746191
1793278832
29746183
*

Add the following:

print "<pre>";
var_dump($_COOKIE);
print "</pre>";

Then you will be able to see what cookies the browser has accepted and sent
back.

If you're not getting anything, then you have a browser configuration problem.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 8 '05 #4
I'm getting:array(0) {
}
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:4d********************************@4ax.com...
On Tue, 08 Nov 2005 01:51:47 GMT, "Mike" <am******@verizon.net> wrote:
Heres a perfect example;
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
?>
Can be found at:(My Domain)
http://www.ampsoft.com/B.php

I leave the browser open and check my Cookies folder and ...Nothing .


That works for me, both on Firefox 1.5RC1 and Internet Explorer 6.

A cookie is set and stored; contents of the file from IE is:

TestCookie
something+from+somewhere
www.ampsoft.com/
1024
3124430464
29746191
1793278832
29746183
*

Add the following:

print "<pre>";
var_dump($_COOKIE);
print "</pre>";

Then you will be able to see what cookies the browser has accepted and
sent
back.

If you're not getting anything, then you have a browser configuration
problem.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Nov 8 '05 #5
Message-ID: <F%Tbf.4061$SV1.3415@trndny01> from Mike contained the
following:
I'm getting:array(0) {
}


Try refreshing it.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Nov 8 '05 #6
It seems to me that the cookie wont store on the client if there is no
expiration time,which contradicts the Documentation which says if there
is no exp. time it lasts until the browser closes.

Nov 8 '05 #7
am******@gmail.com wrote:
It seems to me that the cookie wont store on the client if there is no
expiration time,which contradicts the Documentation which says if
there is no exp. time it lasts until the browser closes.


They /are/ stored on the client computer. You just need to read *all*
of the manual page:

<quote>
Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.
</quote>

(Just below the table where the parameters are explained in detail.)

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 8 '05 #8
Yes, But they are not written to the Cookies folder unless there is an
expiration time.I tried this several times.
Run http://www.ampsoft.com/Doesnt.php
Refresh as much as you want---No cookie written to disk(Cookies Folder)
Run http://www.ampsoft.com/Does.php
Refresh - a cookie is written.

Doesnt:
<?php
$value = 'This cookie doesnt write';
setcookie("TestCookie", $value);
?>

Does:
<?php
$value = 'This cookie writes';
setcookie("TestCookie", $value,time()+3600); /* expire in 1 hour */
?>

Nov 8 '05 #9
am******@gmail.com wrote:
Yes, But they are not written to the Cookies folder unless there is an
expiration time.I tried this several times.
Run http://www.ampsoft.com/Doesnt.php
Refresh as much as you want---No cookie written to disk(Cookies
Folder) Run http://www.ampsoft.com/Does.php
Refresh - a cookie is written.

Doesnt:
<?php
$value = 'This cookie doesnt write';
setcookie("TestCookie", $value);
?>
It did, and I'm using Opera 8.5. Although it doesn't have a cookies
"folder", it does allow me to access all cookies set for all domains.

For the "expire" parameter of setcookie():
"If not set, the cookie will expire at the end of the session (when the
browser closes)."
Does:
<?php
$value = 'This cookie writes';
setcookie("TestCookie", $value,time()+3600); /* expire in 1 hour */
?>


--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 8 '05 #10
On 8 Nov 2005 10:55:38 -0800, am******@gmail.com wrote:
Yes, But they are not written to the Cookies folder unless there is an
expiration time.


If there is no expiration time, then the cookie is valid until the browser
window is closed.

So, why should the browser bother writing it to disk when it can just keep it
in the area of memory associated with that browser window?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 8 '05 #11
I'm using IE and there is definitly a difference
Anybody out there with IE, let me know, Please
am******@verizon.net
Thanks
Mike

Nov 8 '05 #12
am******@gmail.com wrote:
I'm using IE and there is definitly a difference
Anybody out there with IE, let me know, Please
am******@verizon.net
Thanks
Mike


I dont doubt that it is not working for you, but to say that it does not
work would be out of the question, because 1000s of people around the world
are using this method very successfully. There must be something else that
is wrong, e.g.

- php not installed correctly
- caching problem
- etc...

Nov 8 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
6
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a...
6
by: Stephane | last post by:
Hi, I have a login page where if the user wants his access codes to be saved are set into a cookie. In the logout page, I want to delete those cookies. I tried this and this is not working at...
5
by: rlueneberg | last post by:
I am totally confused. Can someone please illuminate what is going on under the hood in this piece of code from John Lewis. My main confusion is how the cookieContainer can be passed to the...
5
by: undbund | last post by:
Hi i have encountered a strange problem to which i am not able to figure out!. I have two separate databases, 1st stores user details, 2nd stores messages, they are on different ip address and...
5
by: mosscliffe | last post by:
I have the following code, which I thought would create a cookie, if one did not exist and on the html form being sent to the server, it would be availabe for interrogation, when the script is run...
0
by: krishna81m | last post by:
Could some one please explain why the session is not being maintained when I am doing a forward in a servlet after setting a cookie. I am even unable to set session attributes or parameters and...
11
by: rsbgm | last post by:
Dear All, Ok. Here I am again for some answers. I've gotten to understand more of things from here than other places. I hope I don't get spoiled. LOLZ... Associative Array is an array that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.