|
Joined: Oct 2000
Posts: 34
Power User
|
Power User
Joined: Oct 2000
Posts: 34 |
Hi Every one , first of all I was confused where i can post this problem, and I determined it as a hack, and I need your hand on this problem with my scritps I will explain what i need : let assume that I am running my UBB.Threads script under this url : http://ubb.mydomain.comand i have a chat script that i created it specially for UBB .. and its under this url : http://chat.mydomain.com Now my question is : how i can set the cookies to be readable to the both url's ? I tried the all possible ways that i know but nothing work fine with me Note : when i used "/" it will work for all directoris under that domain ,, but it will not work under the sub-domains !! Any one can help with this problem Thanks in advance 4 help Regards BMH
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
You would need to set the cookie using the main domain and a path of "/". If you have 3 subdomains: fun.mydomain.com shop.mydomain.com members.mydomain.com The cookie would need the domain "mydomain.com" with the path "/" to be used when setting. I haven't played with cookies in a long time (a good thing) lol but the last time I had been I was getting problems from Netscape (forget what version) because it didn't seem to pick up on "mydomain.com" but it did work when I used ".mydomain.com" for the main domain. (but the problems I seemed to have had with netscape could have just been me) LoL The syntax for setting a cookie is as follows: setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]]) By looking at this I *think it may be possible to just add your main domain into the cookie path, divided by a coma. Example: $config['cookiepath'] = "/,mydomain.com"; I hope this works for you. 
|
|
|
|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
$config['cookiepath'] = "/,mydomain.com"; Good idea, but that apparently doesn't work. That entire string gets interpreted as the 'path' parameter to setcookie(). By the way, if you try this, you may not be able to log in afterwards, so be prepared to manually edit config.inc.php to fix the path. Also, if the 'domain' parameter is provided to setcookie(), the initial period is required: '.example.com', not 'example.com'. I sent Rick another reminder yesterday that we need to be able to configure the cookie domain, or at least force it to be consistent. Let's all keep nagging him until this is done. 
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
posted by Dave_L: $config['cookiepath'] = "/,mydomain.com";
Good idea, but that apparently doesn't work. That entire string gets interpreted as the 'path' parameter to setcookie(). By the way, if you try this, you may not be able to log in afterwards, so be prepared to manually edit config.inc.php to fix the path. 
Also, if the 'domain' parameter is provided to setcookie(), the initial period is required: '.example.com', not 'example.com'.
Ahhh ok... well go figure that IE didn't need the initial period to use the cookies... lol Thanks for clarifying though. What would be needed is a seperate configurable variable such as $config['cookiedomain'] in the config.inc.php file and change all cookieset calls to use the domain variable. Thanks for testing Dave_L 
|
|
|
|
Joined: Oct 2000
Posts: 34
Power User
|
Power User
Joined: Oct 2000
Posts: 34 |
First of all thanks for JustDave & Dave_L Finally it's work Dave_L : Yes, what u said is right, but it will not work if u didnt specify the path , the domain only is not enough to solve the problem ... so I end with : setcookie ("TestCookie", "Myname", time() + 3600, "/", ".mydomain.com"); That will access all sub-domains & directories as u can see , we have to determine the path & domain but in our UBB.Threads script it's determined one of them !! either Path or Domain , I am not sure which one is determined any way , hope scream can update this small thing, to include the both strings and thank u again 4 help Best Regards BMH
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 254
Joined: January 2000
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|