Web lists-archives.com

Re: [PHP] cookies not remembered between browser shutdown and browser restart.. :(




> On Mar 27, 2018, at 7:57 PM, Michelle Konzack <linux4michelle@xxxxxxxxxxxxxxx> wrote:
> 
> Good morning,
> 
> Am 2018-03-27 hackte Rene Veerman in die Tasten:
>> i have the following test script:
>> <html>
>> <body>
>> <?php var_dump($_COOKIE);?>
>> <script>
>> document.write (document.cookie);
>> document.cookie = 'abc=def';
>> </script>
>> </body>
>> </html>
> 
> I have codede JS 15 years ago and do not know about todays stuff,
> but can it be, that it is only a session cookie?
> 
> Thanks in advance
> 

It depends on what set the cookie to begin with.

If it was php, it is either a call to setCookie, or a session cookie.
I don't work with cookies accept for limited specific tasks. But
in calling setCookie one of the arguments is the time to live value.
If there is no time to live value passed, the cookie expires when 
the browser closes... as I understand it. Look at the php manual:

http://php.net/manual/en/function.setcookie.php (or find it in your
preferred language, this the english version. You can use the search
box at the upper right hand corner. But it may be different for languages
written and read right to left)

Javascript should have nothing to do with it unless there is javascript
code sourced and run in the browser to effect cookies. They can be
set and remove or changed with javascript. But it is more complicated
than php. The cookies are read as a string and have to be parsed
and analysed by javascript and added to, removed or revised.

JK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php