I have a website in two languages: English and French. And I want to redirect people based on their browser languages: if there browser language is French, I redirect people on /fr, else they go to …
Tag: cookies
Laravel : Set cookie for parent domain
I’m trying to build an SSO that will be shared between different applications with the same parent domain. Say we have these domains : sso.example.com Unified login page app1.example.com Some other application that will redirect to the login page When I set SESSION_DOMAIN=.example.com in .env file of th…
What does this cookie line mean? (time()+1*24*60*60;)
I have a php code that says this time for the cookie to expire What exactly does this mean? Answer As hinted to in the comments – that’s a calculation of seconds from the current time. That’s 1 day (86400 seconds). 7 Days could be calculated similarly as: You can find a lot more explanation …
PHP: CURL fails to save cookie
I am using PHP from one host to connect to the API of another on the same subnet, which requires cookies to remember the login. It gives me a WARNING: failed to save cookies in /var/includes/cookie. I set up a short test script for myself as follows: The verbose log file gives me this output: The contents of …
How to save PHP session after browse closing? (without separate cookies)
There are a lot of Stack Overflow questions which advise using separate cookies to keep session parameters, but I don’t want to store any additional cookies on the client side. At the moment I have a new session with empty session parameters after each browser restart. Is there any way to keep the PHP s…
Cookies error when connect via ssh port forwarding
I have a PHP script running on the remote server inside private network. And I need to give only access to it via ssh port forwarding (ssh -L ….) remote port 80 to local 8080. The script sets …
PHP Login session with cookie
Please take a look at this code. Is it possible to use it to register the user through cookies if (isset($_COOKIE[‘rand_nm’]) && isset($_COOKIE[‘token’])) { $…
Cookie is not recognised in PHP
I get Notice: Undefined index: i during the first reload of page with cookies if( (isset($_COOKIE[“i”])) && !empty($_COOKIE[“i”]) ){ setcookie(“i”,$_COOKIE[“i”]+1); } else{ …
Can’t set cookie on different domain
This URL has the code below: https://trywifibooster.com/test/setCookiesFromAnotherDomain.html?param=SHOULD-SET-TO-THIS var params = new window.URLSearchParams(window.location.search).get(‘param’); $….
Php: Set header for cookie attribute SameSite=None;Secure is not working at all
I know there is many solutions given regarding the same question but I tried all of them and none of them working at all. I am tried following ways but none of them worked. My php version is 7.1 and Codeigniter framework I am using. By setting header in index.php header(‘Set-Cookie: HttpOnly; SameSite=N…