Sessions Cookies - Saving for Domain Path

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Sessions Cookies - Saving for Domain Path

Post by tecktalkcm0391 »

I have my login page located at http://www.URL.com/Login and inside that folder the session cookie is saved, but how to i make it so that the cookies applys to http://www.URL.com and any folder after it, or is this done automatically. Also, how do I make a user say logged in, even after they exit the browser?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Have you looked at manual?

http://us3.php.net/manual/en/function.setcookie.php
path

The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.

domain
The domain that the cookie is available. To make the cookie available on all subdomains of example.com then you'd set it to '.example.com'. The . is not required but makes it compatible with more browsers. Setting it to http://www.example.com will make the cookie only available in the www subdomain. Refer to tail matching in the spec for details.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Why do you keep opening TWO threads for ONE topic?

viewtopic.php?p=271331
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Sorry I forgot about that one! But this is asking just a part of what wa in the other one.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

tecktalkcm0391 wrote:Sorry I forgot about that one! But this is asking just a part of what wa in the other one.
The other thread covers this, so stick to that thread. This is the second set of threads where you've done so - in violation of the forum rules. Try to "remember" better.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Locked.
Locked