Hi,
Not sure if I'm posting this in the right place but maybe a moderator can move it if not.
I'm having a problem with reading a cookie from an udt. It's a cookie I set for a captcha check. I can see the cookie if I check it with Firefox but CMSMS doesn't see it. Not with $_COOKIE or print_r($_COOKIE).
Anybody got an idea what I'm doing wrong?
thanks,
Garret
can't read cookie from udt
Re: can't read cookie from udt
Probably the way the cookie is set is wrong. check the code I used in my cookie consent tag how I set it up there. might help...
http://viewsvn.cmsmadesimple.org/filede ... onsent.php
http://viewsvn.cmsmadesimple.org/filede ... onsent.php
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
-
- New Member
- Posts: 7
- Joined: Thu Apr 17, 2014 3:18 am
Re: can't read cookie from udt
Thanks Rolf, I see you're using javascript to set the cookie. I would like to use php and am using setcookie("cookiename",$cookievalue) and trying to read it in the udt with $_COOKIE["cookiename"].
Is that not possible?
Is that not possible?
Re: can't read cookie from udt
Read http://php.net/manual/en/function.setcookie.php and have look at 'path' parameter.
-
- New Member
- Posts: 7
- Joined: Thu Apr 17, 2014 3:18 am
Re: can't read cookie from udt
Thanks velden, that was it. Should have read the documentation better. Set path to '\' and cookie could be read in udt.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: can't read cookie from udt
See the cms_cookies class here: http://apidoc.cmsmadesimple.org/
it takes care of those issues for you.
cms_cookies::set('foo','bar');
$foo = cms_cookies::get('foo');
die($foo); // outputs 'bar'
it takes care of those issues for you.
cms_cookies::set('foo','bar');
$foo = cms_cookies::get('foo');
die($foo); // outputs 'bar'
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.