开发者

$cookie_domain value causes access denied upon login

开发者 https://www.devze.com 2023-01-20 10:07 出处:网络
I have FCK editor installed, and trying to enable FCK file manager. It tells me that in order to use it, $cookie_domain must be set.

I have FCK editor installed, and trying to enable FCK file manager.

It tells me that in order to use it, $cookie_domain must be set.

Easy enough, I set it to www.mysite.com. I can log in, register, etc just fine. However I started seeing a number of people get Access Denied after logging in or trying to access any protected area.

Commenting out $cookie_domain, users can get in fine.

I am looking for one of the following:

A. A harmonious answer where FCK file manager and $cookie_domain can be set

-or-

B. An alternative to FCK editor (like 开发者_StackOverflow中文版CK) that allows in-place file uploading without requiring cookie domain to be set (and interrupting user experience).


Change $cookie_domain in your settings.php into this:

$cookie_domain = substr($_SERVER['HTTP_HOST'], strpos($_SERVER['HTTP_HOST'], '.'));


This is what wound up working for me (Domain Access is installed):

$base_domain = explode('.', $_SERVER['SERVER_NAME']);
unset($base_domain[0]);
$base_domain = '.' . implode($base_domain, '.');

$cookie_domain = $base_domain;


Try setting $cookie_domain to simply mysite.com instead of www.mysite.com. This will avoid problems if users are accessing your site via just http://mysite.com or http://some-subdomain.mysite.com.

Try as an experiment to use the FCK filemanager when logged in at http://mysite.com (no leading www) -- does it fail or work under the current settings?

See under Domain and Path on http://www.quirksmode.org/js/cookies.html


Check the spelling of the domain name. I left an 's' off the domain name in the settings.php file and it caused this problem. Darn, I hate when I do that...


Just clear your browser cache and delete cookies as described here

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消