F
F
fStrange2013-12-17 23:27:33
PHP
fStrange, 2013-12-17 23:27:33

How to solve the problem with cookies in some browsers?

There is a simple script.
Sets a cookie and redirects.

<?php
SetCookie('cp', 'd5dt4345', time()+(60*15), '/', $_SERVER['HTTP_HOST']);
header('Location: /administrator/');

For some reason, the solution works for me in all browsers, and refuses to work for the client in some browsers.
Watching HTTP logs
My
client
Where to dig?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
maxaon, 2013-12-17
@fStrange

Maybe the client has the wrong time? Or timezone?
Try to put more lifetime. Or compare the time yourself with the server using JS.
Or maybe you ran into a bug. There are several of them related to setting cookies and redirecting. Search on google
stackoverflow.com/questions/1144894/safari-doesnt-...
stackoverflow.com/questions/612034/how-can-i-set-a...

A
Alexey Firsov, 2013-12-18
@lesha_firs

Perhaps the zones as mentioned above! Try to bypass it!

<?php
SetCookie('cp', 'd5dt4345', time()+(60*15), '/', $_SERVER['HTTP_HOST']);
$_COOKIE['cp'] = 'd5dt4345'; // он создаст куку на сессию, после перезатрется функцией SetCookie
header('Location: /administrator/');

M
maxaon, 2013-12-18
@maxaon

Another option is to disable cookies in the browser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question