0

我正在使用 atk4 基本身份验证,所以当我在这里登录时http://subdomain1.DOMAIN.pk/index.html

我看到了所有的细节

you are visiting: subdomain1
your site : subdomain2

This is not your site string(23) "abc@gmail.com" You are logged in as :abc@gmail.com

然后我访问这个 http://subdomain2.DOMAIN.pk/login.html

它重定向我登录

但我已经登录http://subdomain1.DOMAIN.pk/index.html

子域会影响 cookie 吗?

这是我的代码:

        $this->add('BasicAuth');
        $this->auth->setModel('User');
        //if site is a user site
        if ($this->api->skin != 'default' && !$this->auth->isLoggedIn()) { // && $this->privacy == $this->PRIVATE) {

            if(!$this->auth->isPageAllowed($this->page)){
                $this->auth->check();

            }
            echo 'you are visiting: '. $this->api->siteName;
            //echo $this->api->siteName;

            $m = $this->add('Model_Site');

            $tm = $m->loadBy('user_id', $this->auth->get('id'));
            $this->mySite = $tm->get('name');
            //->ref($this->auth->get('id'));
            echo '<br/>';
            echo 'your site : '. $this->mySite;

            echo '<br/>';

            if ($this->siteName == $this->mySite) {
                echo 'This is your site';
            } else {
                echo 'This is not your site';
            }

            //var_dump($this->auth->get('siteName'));

           // var_dump($this->auth->model->ref('theme_id')->get('name'));
            //if ($this->auth->get('sitename', skinName))
        }

        //maindomain
        if ($this->api->skin == 'default') {
            $this->add('BasicAuth');
            $this->auth->allowPage('index');
            $this->auth->allowPage('signup');
            $this->auth->setModel('User');

            if(!$this->auth->isPageAllowed($this->page)){
                $this->auth->check();




            }
        }

我看到了一些与此主题相关的 stackoverflow 帖子。我想知道如何在 atk4 中解决它。

以下是链接:

4

2 回答 2

1

查看 cookie 的“路径”参数 http://www.php.net/manual/en/function.setcookie.php

可能您需要指定它。

于 2013-11-21T22:13:08.327 回答
1

在敏捷工具包中解决这个问题的最好方法是在配置中添加这一行:

$config['session']['domain'] = '.DOMAIN.pk';
于 2013-11-21T20:50:15.660 回答