I’m running curl from PHP and I want to use cookies. Curl, in PHP, accept the option COOKIEJAR that specifies the location where to save the cookie. I wanted to set it to curl_setopt_array( …
Tag: cookies
Is session.cookie_secure in php.ini automatic?
Simple answer requested: If I put in the php.ini file for my website, will that automatically turn all the php cookies to secure and httponly, or will I still need to put in true, true into parameter slots 6 and 7 in the cookie itself? Answer The answer is yes. Setting this in php.ini is enough (however, I only saw
Turning YII_CSRF_TOKEN secure flag on
I have enabled CSRF Validation in Yii: ‘enableCsrfValidation’ => true, Everything works as expected however I’d like for the session cookie to have the secure flag turned on. With other cookies you can set the secure flag in the config: How do you do this for the YII_CSRF_TOKEN? Answer You can’t do that with the built in CHttpRequest component. You
PHP sessions don’t expire. Ever
I’m transferring my application to another server, but I have some issues with the PHP sessions that don’t seem to expire. In php.ini I’ve set: Cookies are enabled, of course. And still, after 5 minutes, if I refresh the page I’m still logged in. Even if I close the browser and reopen the page. Edit: actually, it seems that closing
How to delete cookie on codeigniter
I don’t know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie(“name”) but is not working. I think because the cookie I created by javascript. Please check my code to fix this problem. This is my sample text field: and this is the javascript Answer Using Codeigniter,
Setting cookie using header(“Set-cookie”) vs setcookie() function
I’m refactoring some code and found something I’ve never seen. the function is used for user to set cookie when user logs in: function setUserCookie($name, $value) { $date = date(“D, d M Y H:i:…
Can cookie values be set after html has loaded on a page?
I read that cookie values can be set after HTML content has been sent from a PHP script to the web server. However, when working with this, I have not been able to set the cookies as I had hoped. Can someone straighten out my discrepancy? Answer PHP can only set cookies while sending the headers of the page (that
Cookie is being seting to only one domainname but the website has multiple domain name
I have a website with two domain names which shows the same content from both domain names and it is also correct for sub-domain, but the problem is when I set a cookie for this website which is used in its sub-domain websites. The cookie is being set only to one domain name, not for both. What is the problem?
Check if a PHP cookie exists and if not set its value
I am working on a multilingual site so I tried this approach: The idea is that if the client doesn’t have an lg cookie (it is, therefore, the first time they’ve visited this site) then set a cookie lg = ro for that user. Everything works fine except that if I enter this page for the first time, the first
How to get the domain of a specific cookie?
There is a web site www.example.com All cookies are set to the www subdomain. Now there is a new subdomain and I want the cookies to be seen for all subdomains. The goal is to rewrite the www….