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
-1
votes
1 answer

How to use cookies for getting multiple value on laravel 5.6?

Actually, I am new on cookies (haven't work on it) what I am trying to do is Whenever clients visit my site and read an article get the id of that read article (without login). whenever clients came back on the same site form the same device which…
Dipendra Deshar
  • 65
  • 2
  • 12
-1
votes
1 answer

Set-Cookie not working on Opera/Firefox but it does on Postman. (express)

I've been reading for a whole day about people who had this same problem and i've tried everything I could, but cant seem to make it work. I think it's related to browser security policy, my server and client are running both on different localhost…
Maty
  • 65
  • 2
  • 10
-1
votes
1 answer

Access cookie values set by node server in the front end

Currently am using node package coockie to set cookies from the backend like below res.setHeader('Set-Cookie', cookie.serialize('token', token, { maxAge: 60 * 60 * 24 * 7 // 1 week })); so I can access the token from the…
-1
votes
2 answers

how can i test my script to delete cookies

I wrote a script in javascript to delete all cookies (except some included in a whitelist) within the current domain (using document.cookie). How can I make sure that it is working and indeed deleting the cookies? I ran it in the browser by…
ma p
  • 11
  • 3
-1
votes
2 answers

Set-Cookie (from AJAX) header not setting cookie in browser

I have a single page application that's using a web API. When a user logs in, I would want the server to set a cookie for further identification. AJAX requests are obviously HTTP, only with a small identifying header. For as far as I know, the…
fingeron
  • 1,152
  • 1
  • 9
  • 20
-1
votes
1 answer

Why is this code not throwing "Header already Sent" error?

Php Doc Says: "Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP." " This requires that you place calls to setcookie() prior to any output, including …
Mathews Mathai
  • 1,707
  • 13
  • 31
-1
votes
1 answer

Using Cookie Expire with IF and ELSE PHP, echo not working on ELSE

Why? I'm attempting to setup an Adword Campaign with my WordPress website, pretty easy stuff but I want to be able to SWITCH contact forms depending if they visited the site using AdWords or Bing/Google SERPS. So the idea is that if they visit…
Simon Hayter
  • 3,131
  • 27
  • 53
-1
votes
2 answers

setcookie() function not working

I am currently working on a little website on which I have to make an account creation system. In order to know whether the user is already connected or not I would like use cookies cuz this was looking like the easiest way. However, after checking…
FabienLge
  • 3
  • 1
  • 3
-1
votes
2 answers

Creating a cookie and setting the value

I am trying to create a cookie and set the value depending on a column called 'User_ID'. I then view the cookie in my browser and find that the value is: SELECT+Student_ID+FROM+%60tblaccounts%60+WHERE+Email%3D%27test%27 I want the User_ID to be…
hello
  • 29
  • 1
  • 8
-1
votes
1 answer

Token in HTTP Header?

currently I have read the RCF 6265 chapter 4.1.1 about the syntax of set-cookie headers. In 4.1.1 in the text: Each cookie begins with a name-value-pair, followed by zero or more attribute-value pairs. Servers SHOULD NOT send Set-Cookie headers that…
michael-mammut
  • 2,595
  • 5
  • 28
  • 46
-1
votes
1 answer

Golang setCookie() failed after template Execute()

As a beginner of GO, I've got a situation as following: t, err := template.ParseFiles("/template/login.tpl") err = t.Execute(w, nil) //if executed before SetCookie http.SetCookie(...) //failed, browser received nothing If the…
eleecn
  • 1
-1
votes
1 answer

send cookies from subdomain

I'm building a web app that uses http only cookie sent by the backend for session data. Now my backend is hosted at xyz.domain.com My client side is domain.com (note - m not using www.domain.com ) Now when the client receives cookie , the browser…
Ansh Agarwal
  • 171
  • 2
  • 13
-1
votes
2 answers

Display info box when user clicks only once in 24h

I want to display an info box, when a user clicks anywhere at my site. It works very well, but the info box should only be displayed once in 24 hours. So I need to set a cookie, but unfortunately I couldnt figure out how.