Web Hosting Talk







View Full Version : setcookie()


linux-tech
05-09-2005, 03:08 PM
Having a rather difficult time with this one, maybe someone could help me out a bit here.
The project:
Setting torrentbits up to use phpnuke users. While phpnuke isn't the best out there for this, it's what I started the project with a few years back, and it's secure enough for me ;)
The dilemna:
The nuke install is called using domain.com
The tracker install should be called using tracker.domain.com
I've written the import script (really not that complicated), and adjusted phpnuke's login stuff to set the tracker cookies, but they're not taking unless they're set directly, as such:

setcookie("uid", $row["id"], time()+2592000, "", "");
setcookie("pass", $row["passhash"], time()+2592000, "", "");

Obviously what that does is set the cookie up as www.domain.com
I've tried

setcookie("uid", $row["id"], time()+2592000, "", "tracker.domain.com");
setcookie("pass", $row["passhash"], time()+2592000, "", "tracker.domain.com");

with no luck. I've even tried:

setcookie("uid", $row["id"], time()+2592000, "/tracker/", "");
setcookie("pass", $row["passhash"], time()+2592000, "/tracker/", "");

Again, with no luck
Is it even POSSIBLE to set the cookie using setcookie() from www.domain.com to be tracker.domain.com? And if so , how? I've read numerous places that most browsers will stop this (thinking it's forgery of some kind), but is there a way around that somehow?

t3r0
05-09-2005, 04:55 PM
Hi,


try to change the cookie domain to ".domain.com"

example:

setcookie("pass", $row["passhash"], time()+2592000, "/", ".domain.com");



That should make the cookie available on all subdomains...


- Tero

linux-tech
05-09-2005, 05:00 PM
hrrrm
Thought I tried that, but I guess I didn't successfully try it. Thanks, for whatever reason it didn't work the first time I tried it but it did this time.