我正在使用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中解决它。
以下是链接:
答案 0 :(得分:1)
在agiletoolkit中解决此问题的最佳方法是在config中添加以下一行:
$config['session']['domain'] = '.DOMAIN.pk';
答案 1 :(得分:1)
查看cookie的'path'参数 http://www.php.net/manual/en/function.setcookie.php
您可能需要指定它。