0

I need to display all cookies that Joomla uses. I tried print_r(headers_list) and I got this

Array ( [0] => X-Powered-By: PHP/7.3.12 )

So I tried print_r($_COOKIE) and I got this:

Array ( [12ecc9e8acc559e29bf3fafd5f5fe3df] => mta3apurfklkcufan01svecgvv )

So, does Joomla normally use essential cookies? If so, how can I get them.

1 Answer 1

3

You retrieve cookies in Joomla 3 by:

JFactory::getApplication()->input->cookie->get('cookiename');

The cookie set in your print_r($_COOKIE) is the session cookie, this is usually referenced by:

$session = JFactory::getSession();
echo $session->getId();

Other cookies will be set depending if you the user is logged in, and a multitude of others depending on 3rd party extensions.

5
  • Thank you. The result I got: d2cm65jvet4r957n7fb024p7ru. So basically Joomla doesn't have any active cookie to track the user? Commented Jun 15, 2020 at 11:18
  • 1
    This is the session cookie; so yes, it is used to "track" the user while their session is alive. As per your Session Lifetime set in Global Configuration, the session will be destroyed and a new session created upon expiry.
    – Grant G
    Commented Jun 15, 2020 at 12:38
  • Ok thank you. I need to display a GDPR page that's why I asked this question. I didn't know what cookies Joomla uses. Commented Jun 15, 2020 at 12:57
  • 1
    Why not just use Joomla's native Privacy component for handling GDPR? You are GDPR compliant if you do not use user registration or any other component which captures data from the user because the session ID is pseudonymous.
    – Grant G
    Commented Jun 15, 2020 at 13:18
  • Oh thank you. I didn't know about this. No I don't use any component. If I do it's my own components. Commented Jun 15, 2020 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.