forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 permissions => Topic started by: demmel on November 16, 2016, 10:47:27 am

Title: "Achtung: Dein Browser akzeptiert nicht die Cookies dieses Skripts"
Post by: demmel on November 16, 2016, 10:47:27 am
Hi,

I've installed CM v1.5.20 to demmel.com/cm
As the normally to be used www.demmel.com is our company's website running Contao CMS, I have a little problem when entering demmel.com/cm only, as Contao tries to interprete a sub-folder with 2 digits as a language information (although demmel.com/cm does not contain anything regarding Contao), so I need to enter demmel.com/cm/index.php instead.

To avoid this I've created a subdomain pics.demmel.com pointing to demmel.com/cm to bypass the problem with needing to add the index.php file.
This works fine, but I'm unable to log in now, as I get the message "Achtung: Dein Browser akzeptiert nicht die Cookies dieses Skripts" (Caution: your browser does not support cookies of this script) and log in is not possible. Logging in under demmel.com/cm/index.php is still possible.

Any idea how to fix this issue ??

Best regards
Herbert Demmel
Title: Re: "Achtung: Dein Browser akzeptiert nicht die Cookies dieses Skripts"
Post by: gmc on November 16, 2016, 02:57:34 pm
By default when cookies are set - they are limited to the subdomain that set them - and won't be passed to other subdomains.
Because you are 'crossing' subdomains - the cookie by default isn't going to be shared.

CPG has a config setting that should allow you to override this behavior.
Login using the real URL (adding the index.php).
In config - expand the 'Cookie Settings' and set the 'Cookie path'.
In your case I would expect it should be 'demmel.com' (without quotes) - which will allow the cookie to be sent to www and pics subdomains (and any others).

I haven't tested this value - incorrect values will prevent you from logging in. 
You can reset the value directly in the database with SQL like:
Code: [Select]
UPDATE `cpg_config` SET `value` = '/' WHERE `name` = 'cookie_path';(change 'cpg_' to your cpg table prefix.)

A reference to how php sets cookies:
http://php.net/manual/en/function.setcookie.php (http://php.net/manual/en/function.setcookie.php)
The value of 'cookie_path' is sent as the domain name.

As an alternative - you could actually move the gallery to the 'pics' subdomain - rather than pointing across to www.
This would confine the use of the cookie to the pics subdomain - and the default CPG value of '/' for cookie_path will work.
(The same subdomain would be setting and using the cookie).