Questions tagged [setcookie]

The setcookie function sends an HTTP cookie to a client.

setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.

1196 questions
-2
votes
1 answer

$_COOKIE does not return all values on only one page

During the login process on my internal webpage I use setcookie() to write a cookie. setcookie("cookiewar",$loginname,time()+(3600*24*100)); On all pages (except one) var_dump($_COOKIE) shows me an array count of 2: array(2) { ["cookievar"]=>…
Klaus
  • 25
  • 2
  • 6
-2
votes
1 answer

Session cookie without http flag

Just received the results of a security audit - everything clear apart from two things Session cookie without http flag. Session cookie without secure flag set. So how I can set the httpOnly flag and secure flag through jQuery?
-2
votes
3 answers

PHP setcookie() doesn't work on several pages

I have some trouble understanding why setcookie() doesn't work on several pages. if (isset($_POST['group'])){ $group = stripslashes($_POST['group']); setcookie(GSgroup, $group, time()+3600); } I use the above code to set a cookie when a…
JeroenN
  • 1
  • 1
-2
votes
2 answers

PHP Password Protecting

I'm having difficulty trying to password-protect a section of my website. I'm not too familiar with php, so I'm using code from zubrag.com as a starting point. The problem I'm running into is that I get an error with the current code that states:…
pr-
  • 402
  • 2
  • 9
  • 18
-3
votes
1 answer

Cookie sets randomly

I am attempting to set a Cookie and sometimes it works and other times it does not. There is no obvious pattern. func quoteGetHandler(w http.ResponseWriter, req *http.Request) { parts := strings.Split(req.URL.Path, "/") csrfToken :=…
pigfox
  • 1,301
  • 3
  • 28
  • 52
-3
votes
1 answer

Set cookies to another domain by ruby

I have a problem, when I try to set cookies in controller it is not works def test cookies["test"] = { :value => 'a yummy cookie', :expires => 1.year.from_now, :domain => 'domain.com' } end But if I delete…
AzBest
  • 67
  • 5
-3
votes
2 answers

Setting cookie in php. Different ways to set cookie

In how many ways you can set a cookie in php. How to set using header(). I have tried to set cookie in chrome using setcookie but it is not working. Want to know how to set using header().
user2277147
  • 163
  • 1
  • 2
  • 9
-3
votes
2 answers

How to pass info from one page to another with cookies using php

Possible Duplicate: “Warning: Headers already sent” in PHP
-4
votes
1 answer

Cookie get deleted/set to null after redirect

I am using cookie in a page to record the user's input in a form. After the user login, i want to automatically fill in the form by using their old cookie. Basically, i want to record some cookies, and let user login, and output the cookies. In the…
jackhao
  • 3,457
  • 3
  • 22
  • 43
-5
votes
1 answer

Why google chrome does not write cookie with a special name?

I was testing some codes and write a cookie on my machine (MVC 5, .net 4.7), my test cookie name is "test". After a while google chrome (Version 63.0.3239.84) did not write my cookie with the name "test" anymore but if I change the cookie name, it…
motevalizadeh
  • 5,244
  • 14
  • 61
  • 108
-5
votes
1 answer

Warning: Cannot modify header information - headers already sent

Can anyone help with this? i need to get this working ASAP Warning: Cannot modify header information - headers already sent by (output started at /home/XXXXXXXXXXXX/public_html/advert5.html:445) in /home/XXXXXXXXX/public_html/advert5.html on line…
anon
1 2 3
79
80