I'll try to explain it as best as I can. I'm trying to solve this issue for days, and I just don't know what is wrong.

First of all, I'm opening an simple 'dialog' that I made by an function. Let's call it openDialog for now. In my sub-domain, I'm opening the register dialog with this function, and the function does, is using ajax to read the register dialog content. And with that, I can simply register without any issue .

The register is working on my main server (example.com), and the forum's sub domain. (forum.example.com)

The login works the same. I got query in the ajax and other stuff. Here is the problem: in the main site (example.com) the login is setting up the cookie. However, in the sub-domain (forum.example.com) the ajax does the same query to the mysql (last login date and etc..), but the setcookie isn't working.

I'm using chrome, and I saw that in the Network tab (Developer mode) I do see that the ajax response created the cookie, but the cookie isn't really created.

Here is the setcookie:

setcookie("mycoockiename", 'myvalue', time() + 60 * 60 * 24 * 365, '/', '.example.com');

When I go to the chrome developer mode (pressing on F12) then to the Network tab > the ajax request and in the Headers tab I can see:

Set-Cookie:mycoockiename=myvalue; expires=Sun, 18-Jan-2015 21:05:20 GMT; path=/; domain=.example.com

Great, so that means that I've successfully created the cookie right ? Well, no. It doesn't really create it.

And it is important that you guys know that. Its only happened in the sub-domain (forum.exapmle.com) in the (example.com) everything working perfectly. In the (forum.example.com) everything working except the setcookie.

Also note that, while I'm creating this cookie via the main site (example.com), I can also see this cookie in the (forum.example.com)

So, any idea about why ?

有帮助吗?

解决方案

Fixed it, I just created that missing cookie with javascript.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top