I
I
IvanIF2020-10-25 21:50:01
PHP
IvanIF, 2020-10-25 21:50:01

How to disable cookies in JS?

I have 3 cookies on my site: PHPSESSID and 2 that I create myself (id and token). How can I disable access to all cookies via JS?
I write in .htaccess:

php_value session.cookie_httponly 1
php_value session.cookie_secure 1
Then only id and token are displayed in JS. Those. PHPSESSID is no longer output via JS. How can I disable the use of other cookies? Specify httponly like this when creating or is there a way to do it in .htaccess?
setcookie('id', $user_info['user_id'], time()+60*60*24*14, '/', true, true);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2020-10-25
@SilenceOfWinter

you didn't specify $httponly, the function has more parameters

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question