note 34878 added to ref.session
| From: | zombie at rack1 dot php dot net | Date: | Sat, 09 Aug 2003 21:42:17 +0000 |
| Subject: | note 34878 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53765@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34878
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34878&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34878&report=yes