Cookies all over? :O

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

Post Reply
Terencentanio
Forum Commoner
Posts: 27
Joined: Mon Dec 06, 2004 10:32 am
Location: England

Cookies all over? :O

Post by Terencentanio »

Before anyone does, please don't lecutre me on how sessions are better than cookies... I know.. I just can't work with sessions yet without burning my house down.

Ok. I'm using cookies to identify logged users.

The cookie is set in the directory "/users/", however, it only identifies people in "/users/" and "/users/msgs/" .... so, how would I go about setting the cookie so it works all over the site?

Thanks,
me
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Before anyone does, please don't lecutre me on how sessions are better than cookies... I know.. I just can't work with sessions yet without burning my house down.
Well why don't you ask about how to properly use sessions, since they are, better. (in most cases)
Terencentanio
Forum Commoner
Posts: 27
Joined: Mon Dec 06, 2004 10:32 am
Location: England

Post by Terencentanio »

I know how to properly use them.. but like I said, they make me burn my house down.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Why..
Terencentanio
Forum Commoner
Posts: 27
Joined: Mon Dec 06, 2004 10:32 am
Location: England

Post by Terencentanio »

Dunno.. guess I don't understand them, they require too much code... and I'd have to do a <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> load of editing.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you're probably just setting the cookie like so:

Code: Select all

setcookie('name', 'value', 102137097157);
this will default the cookie to only work within the directory and domain the user was under at that time..

setting the path argument to / and the domain to '.yourdomain.com' should work best. Note the period before your domain name.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

is there any way to use cookies while using a iframe????
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

shiznatix wrote:is there any way to use cookies while using a iframe????
yes. sadly the how can be very complicated.
Post Reply