Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP with setcookie()

Status
Not open for further replies.

solex

Programmer
Joined
Feb 28, 2003
Messages
91
Location
GB
hi, i want to use cookies in my php program, the folder tree goes like this:

members.lycos.co.uk/barrenlands/login/account

the cookie will be made with
setcookie($barrenlands_cookie_string,"$string");
in the /login dir

it will be then read and re set by pages in the /account dir using code:
setcookie($barrenlands_cookie_string,"");
setcookie($barrenlands_cookie_string,"$newstring");

but when i have done this, the files in the /login dir cant read it.

Any help on how to let the /login page read it , or y it cant.

p.s. the cookie must be able to be read by the /account after the login has reread it, and this could be repeated several times

thanx in advance

SOLEX
 
SOLEX,

setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]]);

You have only provided name and value. You should include expiration, path, and domain to have better control.

If you do not set a path the cookie is only valid within the folder the cookie is set in.

PHP Documentation:
 
Can you give me examples on the code ive given, i want the cookie to expire on browser close, and how should i say what the folders i want it to be in, /barrenlands , /barrenlands/ ? or another?
its not sucure

thanx

solex
 
i allredy have and it does not help me in this case, do i use /barrenlands , or , /barrenlands/ , or , barrenlands/


thanx
SOLEX
 
to say that i want the cookie to work in the dir /barrenlands and all dirs in side it, what do i put in the path section of the setcookie()?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top