Jump to content

Php set cookie


NewGuy21

Recommended Posts

Ok so say I have this is the cookie after its set

(this is example cookie from Firefox)

name:user

Content:123456-%64%69%72%74%79%73%70%61%63%65%77

Domain:.domain.com

Path: /

Send For:any type of connection

Expires: when browser is closed

 

So how would I go about adding that info using set cookie. I wanted a before and after that way its easier to understand. I have tried this code thinking it should work

 

<?php

setcookie('user', '123456-%64%69%72%74%79%73%70%61%63%65%77', false , '/', '.domain.com', 0);

?>

 

But that doesnt work I know how to set a regular cookie.. But am having problem with this being a session cookie. Best I can figure all you do is set the time to 0 or False and it should go away once browser is closed.

 

I would appreciate any help can give

Link to comment
https://forums.phpfreaks.com/topic/50762-php-set-cookie/
Share on other sites

ok..... simply ,dont add the stuff thats specific.....

 

 

i dont see why you would bneed to specify the browser type, and if its only used for the one browser, then why do you need to specify the domain etc.?

 

 

all you need is name = value, and thats it......

 

if you want a cookie that expires, when someone logs out, then simply put in a system where if theyve been in for 20 minutes, get then to login again, this also helps to aviod auto scripts etc.

 

 

 

if you ned more help, lets me know

 

Link to comment
https://forums.phpfreaks.com/topic/50762-php-set-cookie/#findComment-249595
Share on other sites

I dont understand what your saying? I mean I only grabbed that as an example. So I show the output of the code. And have someone show me exactly how I would get that output. And the whole reason is to learn.

 

I would just like to know exactly what code I would need to give me that exact output.  To be honest your answer really doesnt help at all. But thank your for the suggestion.

 

 

Link to comment
https://forums.phpfreaks.com/topic/50762-php-set-cookie/#findComment-249666
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.