note 34878 deleted from ref.session by betz

From: Date: Mon, 25 Jul 2005 07:27:06 +0000
Subject: note 34878 deleted from ref.session by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-92397@lists.php.net to get a copy of this message
Note Submitter: zombie (at) localm (dotto) oh - arr-gee ---- I don't know if this is obvious or not, but since it took me forever to figure it out, i will post it... <? // If you want to share cookie/session info with a domain name and it's subdomains/Cnames, // the only thing you really should have to do is: ini_set("session.cookie_domain",".artattack.to"); session_start(); //see what we have in our session... print_r($_SESSION); ?> This will allow cookies/session info to be available to artattack.to as well as its Cnames (ex: www.artattack.to, zombie.artattack.to, squirrel.nut.artattack.to) All this does is set the domain attribute of the set_cookie() style function sessions use since a "session" is just a cookie on your computer that php looks for that contains your session id. I assume, therefor that you can do something of the like for cookies in javascript and such. The silly thing about all this is that it is a "feature" of cookies to be able to span c names/subdomains. This is exactly why set_cookie() has an option domain argument. However, it seems like most of the people have had my problem have not gone in that direction or at least not posted a correct solution on the web. Google just gave me lots of hacked solutions. In my quest, i read articles about apache hacks, setting the serverside session storage folder, using file() from a sub on a file doing a print_r on the session located ont he main server, etc etc. I guess if you really know how cookies work (which i thought i did before all this mess but obviously not) then this problem seems like not much of a problem at all and a simple missunderstanding of what cookies do and why they are cool. Wizards vs Hackers. I hope this helps someone. -- Blaine webmaster of the art attack http://artattack.to

« previous php.notes (#92397) next »