SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Cookie Syntax

  1. #1
    SitePoint Addict -Ice-php's Avatar
    Join Date
    May 2002
    Location
    UK
    Posts
    260
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cookie Syntax

    Hey
    i could never work session so i just used cookies like:
    setcookie("clanname",$clanname);
    I didnt put a time because i wanted it to act like a session - when browser is closed - cookie expires
    but this doesnt seem to work now
    i cant echo $clanname
    what is the complete syntax for a cookie
    ive seen somethings about urls in cookies - what do they do?
    Thanks for your help
    -Ice

  2. #2
    lean mean coding machine cosmo's Avatar
    Join Date
    Aug 2001
    Location
    the cosmos
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont think you are going about it the right way. You will need to set an expiration date for a cookie and it will be really hard to guess when your user will close that browser.

    I would suggest you use sessions, instead of trying to make a cookie act like one.

    Anyway, to answer your question, a cookie takes six parameters. The first three are the most important:

    setcookie([variable name], [value of variable], [unix timestamp])
    Luthfur R. - Web Developer
    PHP Lite.com - Professional PHP Scripts and Web Applications
    Calendar Express 2 - Web Based Calendar and Event Publishing System


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •