Results 1 to 3 of 3
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Posts
    230
    Packy said in another thread:

    quote:
    for what ever reason my sites sales have dropped way down since the third week in December. I have no explanation.


    I'm not sure the following is relevant but a nasty probem hit my own site which I only found out about 36 hours ago. I'm not a merchant for CJ, just an publisher but use cookies in my site for my own tracking purposes as I run my own draw and private affiliate program. Fortunately no-one lost any money from the affiliate program but some of my members lost draw entries so I'm doing 2 draws in march instead of one to try to make up for it.

    The problem was in PHP and some kind of late Y2K problem in the mktime() function. Cookies in PHP can be a bit tricky (at least as far as I found anyway) and I used this programming function called mktime() to get the cookies to work. On the PHP website there is a message saying

    "take care: mktime() returns -1 when year is 0!
    This occurs until date is greater than 13-12-01 (DD-MM-YY). This can
    cause some "Y2K"-problems, when using year 00 or 01 instead of 2000
    or 2001, respectively."

    I'd eventually managed to get the cookies working fine from when my site was launched in October 2000, but from testing I was doing 36 hours ago, it was showing that mktime()+1166832000 was producing the wrong date. Instead of giving a date 1166832000 seconds in the future, it was producing a date of 13 December 2001. This was causing newly-set cookies which were set after 13th December 2001 to immediately expire because "today" is after 13th December 2001. I think this date problem only affected newly-set cookies, not those set prior to 13 december 2001 (although I'm not absolutely certain on that point).

    I've fixed the problem now on my site but would recommend anyone who uses mktime() to check what dates they are getting, particularly if they are trying to create a future date. I'm not well-versed in other programming languages but I believe mktime() may be used in other languages other than PHP.

    I've no idea how CJ set their cookies but thought I'd just share this as an example of how things which seem to work one moment can go gag-ga the next.

    Haiko - I wasn't too sure where to post this so apologies if this is in the wrong place - please feel free to move it if necessary
    [img]/infopop/emoticons/icon_smile.gif[/img]

    edited to correct spelling error

    [ 01-05-2002: Message edited by: futuresky ]

  2. #2
    ABW Ambassador
    Join Date
    January 17th, 2005
    Location
    ÄúsTrálíĺ
    Posts
    1,372
    cookies & php are fairly simple

    $cookiename = "loginname";
    $cookiedetails = "this is the login name";
    $site = "http://www.yoursite.com";

    setcookie ($cookiename, $cookiedetails, time()+3600, "/", ".".$site);

    This will set a cookie for an hour. Simply change the 3600 (60 seconds * 60 minutes) for longer durations.

    Cookies are automatically read when each page is open (unlike perl, where you have to do crazy stuff to get them read properly), so in this case each page will have a variable $loginname preset with the cookie information.

  3. #3
    Full Member
    Join Date
    January 18th, 2005
    Posts
    230
    Thanks Pete - I'm not sure if I tried that exact way but I know that when I first set up the site I tried simple methods but they didn't work reliably across all browsers. This was with PHP3 at the time, not PHP4.

    Basically there are different ways to cook an egg (or create a cookie). One of the ways is using mktime() somewhere in your code - all I'm saying is that it appears things can go a bit buggy if you're not careful.

    [ 01-05-2002: Message edited by: futuresky ]

  4. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP Cookies
    By sam_park in forum Programming / Datafeeds / Tools
    Replies: 0
    Last Post: November 25th, 2009, 03:40 PM
  2. Drugstore.com Transaction possibly not tracking
    By Infoseeker in forum Rakuten LinkShare - LS
    Replies: 3
    Last Post: August 7th, 2004, 07:40 AM
  3. tracking, cookies etc
    By Remy in forum Midnight Cafe'
    Replies: 7
    Last Post: November 17th, 2003, 01:40 PM
  4. Cookies and tracking id questions
    By popdawg in forum Commission Junction - CJ
    Replies: 1
    Last Post: November 28th, 2002, 04:07 PM

Posting Permissions

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