cookie path

Discussion in 'PHP' started by promotingspace.net, Aug 15, 2009.

  1. #1
    Hi
    When I send a cookie to a visitor's PC, with the file: public_html/resellers/savecookie.php
    1.Then can I detect that cookie when I'm reading the file: public_html/payments/detectcookie.php?
    2.how about public_html/phpfiles.php?
    3.and how about subdirectories? (like public_html/resellers/subdirectory/a_php_file.php?
    Thanks for your answers
     
    promotingspace.net, Aug 15, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, it depends on how you set the cookie path in your call to setcookie.

    
    setcookie("everywhere", "1", time() + 3600, "/");
    setcookie("subdirectory", "1", time() + 3600, "/subdirectory");
    
    PHP:
    So just set the cookie path to "/" and it will be available in your entire site.
     
    premiumscripts, Aug 15, 2009 IP