Forum Moderators: coopster

Message Too Old, No Replies

Cookies on localhost, how?

         

one_mind

10:31 am on Oct 17, 2005 (gmt 0)

10+ Year Member



Hi,

I am learning how to set a cookie with php.

I have the following code at the top of my page:

setcookie("user", "name", time()+3600, "/", "", 0);

this works but i would like to know where the cookie is in my cookies folder. Its not named localhost, my computers name or my ip address. What would it be called if you don't set a domain name?

Also, is this the right way to set a cookie on local host? I tried putting localhost as my domain but since i'm using xp and ie6 it doesn't work.

Thanks for any info.

jatar_k

4:21 pm on Oct 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> where the cookie is in my cookies folder

no clue to be honest, sometimes I can't find them at all, which seems strange. I use my 'cookie manager' in mozilla to see them.

>> What would it be called if you don't set a domain name?

well that depends on how you called that script. What domain did you use?

domain name
localhost
127.0.0.1

>> Also, is this the right way to set a cookie on local host?

the right way to do it is to set it properly for the domain. There is almost never a real case where you need to set a cookie on localhost

coopster

7:43 pm on Oct 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I agree, FireFox or a Mozilla-based browser works great for troubleshooting during development, especially when working with cookies. There are different types of cookies and MSIE doesn't let us view them all with their base options. Firefox and other browsers allow us plenty of options. Here is a MS doc that starts you off with some basics ...

[support.microsoft.com...]

You can search their site using keywords like "persistent cookie" or "session cookie" for plenty of reading. But, it's a lot easier to just download a different browser ;)

one_mind

2:45 am on Oct 19, 2005 (gmt 0)

10+ Year Member



Thanks guys,

It turns out is was called local host in my cookies folder in documents and settings. I was just so tired i didnt see it.

Cheers