Is it more secure to use cookies to transfer session ids?



Is it more secure to use cookies to transfer session ids?..

Answer / Mubarak Hussain

Using cookies for transferring session IDs is considered relatively safe if you properly implement HTTP-only, Secure and SameSite attributes. However, it's essential to follow security best practices such as setting a session time-out, using a secure connection (HTTPS), and protecting against Cross-Site Scripting (XSS) attacks.nnHere's an example of how to set HttpOnly and Secure flags in PHP:nn```phpnsession_set_cookie_params(60 * 60, '/', '.', 'localhost', true, true);nsession_start();``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

hello all, I need some sample placement papers in lion bridge.. can anyone help me?

0 Answers   Lionbridge,


what is view?

0 Answers  


Who is the father of PHP and explain the changes in PHP versions?

2 Answers   Rushmore Consultancy,


What is the PHP predefined variable that tells the What types of images that PHP supports?

1 Answers  


Which is faster for or foreach php?

1 Answers  


This is regarding file uploading. 1. Who will be the owner of the uploaded file ? 2. What permission you will give for an uploaded file ? 3. What is mean by user, group and others and what kind of permission you will give for each user and explain the reason?

1 Answers   IBM,


how will i set pagination ?

2 Answers  


How long does a session last in php?

1 Answers  


What is difference between put and post method in http?

1 Answers  


Explain Type hinting in PHP?

1 Answers  


What are the __construct() and __destruct() methods in a php class?

1 Answers  


What are php loops?

1 Answers  


Categories