SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    May 2006
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Create flash cookie and read using PHP

    I want to create a cookie, set its value and read using php. I know how to create cookie, will you help me reading it using PHP?

    Thanks!

  2. #2
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code PHP:
    x = $_COOKIE["name"];

  3. #3
    SitePoint Zealot
    Join Date
    May 2006
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ferrari_chris View Post
    Code PHP:
    x = $_COOKIE["name"];
    Thanks a lot. It means I can access flash cookie as js/php cookie. Am I right?

  4. #4
    SitePoint Zealot
    Join Date
    May 2006
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using this code to create a cookie:

    user = SharedObject.getLocal("user");
    user.data.signedup = true;
    user.flush();

    and, accessing it using php:

    $x = $_COOKIE['signedup'];

    But, unable to access. It throws an error:
    Message: Undefined index: signedup

    How should I access the cookie created? Please help.

    Thanks

  5. #5
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aryandelhi View Post
    Thanks a lot. It means I can access flash cookie as js/php cookie. Am I right?
    No. That code is for a PHP cookie. It might not be a PHP cookie specifically, but a webserver (http?) cookie.

    I don't know if you can create a Flash cookie and read it with another language. I know that Flash cookies are stored in the filesystem (in a different place to web cookies) and so they may be unreachable by the browser and the webserver.

    Maybe it will be easier to have Flash call a PHP script to create the cookie and another PHP script to read it?

  6. #6
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,554
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Flash cookies (local shared objects) are not accessible other than through actionscript. If necessary you can use the ExternalInterface class to exchange data with javascript, so it would be possible for an html page to query a swf on the status of a LSO via javascript.


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
  •