Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Cookie not working

    Hello,

    I am using the zenid as a unique identifier for naming files that a user creates when he visits a page.

    I thought this was a good idea until I noticed that if a user creates several files without logging out the files get overwritten because the zenid only changes upon login.

    So I decided to make a simple counter cookie that would increment every time the page was refreshed. This coulter value would somply be appended to the zenid for a truly unique file identification.

    Now my problem is that cookies dont seem to be working within zen cart.

    I am creating it with the following:

    <?php
    if (!isset($_COOKIE['Counter_Cookie'])) $_COOKIE['Counter_Cookie'] = 0;
    $Counter_Cookie = $_COOKIE['Counter_Cookie'] + 1;
    setcookie('Counter_Cookie',$Counter_Cookie);
    ?>

    viewing cookies with javascript:alert(document.cookie); shows no cookie. The files created have the zenid with a 1 appended, but the 1 never incremements.

    anyone have any ideas?

    Thanks,

  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Cookie not working

    Using the zenID is a bad idea - try using time or a zen_get_random() - (I hope that's the right function :) )
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Re: Cookie not working

    I was origimally using time but we decided that there was a (however remote) chance 2 users could log in at the same time.

    I cannot find anything on zen_get_random(). Is that documented anywhere?

 

 

Similar Threads

  1. Replies: 1
    Last Post: 17 Mar 2012, 03:43 AM
  2. Replies: 7
    Last Post: 7 Apr 2011, 10:34 PM
  3. Cookie Usage Error - Customers Not Able to Add Item to Cart
    By pinkchalkstudio in forum Basic Configuration
    Replies: 3
    Last Post: 29 Jan 2011, 03:05 AM
  4. Replies: 0
    Last Post: 10 Aug 2009, 10:56 AM

Posting Permissions

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