0

I am developing a site in Drupal 7. I am doing the security audit for the same. in a security audit, I am getting the issue for Persistent Cookie. when I check the cookies for my site. there is one cookie name "text size" which is persistent. but I want session cookie only. how do I achieve this please help?

Thanks in advance.

Screen shot of cookie view

2 Answers2

0

You can unset the cookie in your module hooks e.g hook_boot or hook_init in your custom module.

There you can just write:

setcookie("text size", "{yourValue}", 1);

For more information refer below:

how to unset cookie in PHP?

http://php.net/manual/en/function.setcookie.php

Viswanath Polaki
  • 1,357
  • 1
  • 10
  • 19
  • You are welcome. If you had issues in implementing you can just add comment so that I could provide more info on module creation and setting time for cookie. – Viswanath Polaki Jul 12 '17 at 09:43
0

After 3 day's research on it and the help of the Answer provided by Mr. Vishwanath Polaki. Finlay I have reached at objective.

i have edited textsize.module file.

setcookie("textsize", $textsize_normal, time()+$textsize_cookie_expires, $textsize_cookie_domain, "");

in the above statement i only update the time()+$textsize_cookie_expires with value 0.

Before change the cookie cookie-screen-before-updation

After change the cookie cookie-screen-after-updation

expiration of the cookie is change from specific time to At end of session