More php help needed :)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 4Pics
    Confirmed User
    • Dec 2001
    • 7952

    #1

    More php help needed :)

    I want to log clicks on a exit console as such

    http://www.blah.com/out.php?id=1
    http://www.blah.com/out.php?id=2
    http://www.blah.com/out.php?id=3
    http://www.blah.com/out.php?id=4
    http://www.blah.com/out.php?id=5

    The 2 ways I can log hits are either use cookies, or log the ip address and if its not used in last 1-24hrs then count it as a unique.

    If I am using cookies, how do I store it so I know what links are unique for them the easiest way?

    Like

    <?
    if (!isset($_COOKIE['$id']) ) {
    add click for id
    setcookieforid
    }
    ?>

    Is there a short way to store the id's? or will the cookie file be huge if I have like 500 id's they could click?

    Thanks
  • jwerd
    Confirmed User
    • Jun 2003
    • 1953

    #2
    Well, from the code shown you will be creating a new cookie for each entry... so that will be like 500 cookies with a value in each of them.. the problem with this is most comptuers will only receive 1 cookie per connection (URL) so ... that can turn into a problem... I'd just log the IP, and have it clear out daily... that is your best bet... store the ips in a database and then if it is the next day, it checks, and if it is, resets the ip address log and adds the value simple as that
    Yii Framework Guru - Seasoned PHP vet - Partner @ XXXCoupon.com

    Comment

    • 4Pics
      Confirmed User
      • Dec 2001
      • 7952

      #3
      It doesn't create a new cookie if one already exists for that domain. It just adds a the cookie variable.

      or atleast that is how it works with IE6.

      Comment

      • fris
        Too lazy to set a custom title
        • Aug 2002
        • 55679

        #4
        best way would be to create a mysql database and store the values in there. and go from there. its pretty much easy from there.
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

        Comment

        • Nightwork
          Registered User
          • Oct 2003
          • 61

          #5
          best way would be to create a mysql database and store the values in there. and go from there. its pretty much easy from there.
          That's what I think as well

          If you want to go with the cookie, store the data in an array...
          God may have created the world in 6 days, but you can bet your ass that while he rested on the 7th, a programmer coded it all.<br>ICQ:48322442

          Comment

          • 4Pics
            Confirmed User
            • Dec 2001
            • 7952

            #6
            Bump for anyone elses opinion

            Comment

            • Nightwork
              Registered User
              • Oct 2003
              • 61

              #7
              you got mine opinion, where the hell do you need some more for ;)
              God may have created the world in 6 days, but you can bet your ass that while he rested on the 7th, a programmer coded it all.<br>ICQ:48322442

              Comment

              Working...