Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Oct 2000
Posts: 34
bmh
Offline
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.com

and 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

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
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
Offline
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
Offline
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
bmh
Offline
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

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)