Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Re: SSI Question + Script Concept Recommendations

Expand Messages
  • Octavian Rasnita
    Hi, Using the log file is not a very good idea if you want to show the counter in the HTML page because you will need to parse all the log file for each page
    Message 1 of 1 , Dec 5, 2002
    • 0 Attachment
      Hi,

      Using the log file is not a very good idea if you want to show the counter
      in the HTML page because you will need to parse all the log file for each
      page request.

      You don't need cookies for creating a counter.
      You will need to get the DOCUMENT_URI environment variable if you will
      include the script using SSI, or the REFERER environment variable if you are
      including it using Javascript.

      You can use MySQL to keep the counters, or you can keep them in more text
      files.

      For example, you can create a separate directories with counters, and create
      text files with the name of each HTML page + a .txt extension.
      In each file, you can put a single line with the number of visits, the date
      of the first visit if you want, the path to the HTML page, etc.

      Then you can read the file, add 1, print on the screen and save the file.

      You will need to add some locking code for writing the files.

      If you have many visitors and the pages are very often visited, you might
      want to store them in MySQL.

      Teddy,
      Teddy's Center: http://teddy.fcc.ro/
      Email: orasnita@...

      ----- Original Message -----
      From: "Damien Carbery" <daymobrew@...>
      To: <perl-beginner@yahoogroups.com>
      Sent: Thursday, December 05, 2002 6:12 PM
      Subject: [PBML] Re: SSI Question + Script Concept Recommendations


      --- In perl-beginner@y..., Will <self_deprecated@y...> wrote:
      > Greetings,
      >
      > I am trying to build a script to track my sites'
      > visitors using SSIs and MySQL. For each html document
      > I want to set and SSI that will invoke a counter that
      > will track the number of visitors to a page, and,
      > then, log this information into MySQL.
      >
      > The concept seems flexible because I could generate a
      > generalized report stating the visitors to each page
      > on a day, week, monthly basis simply by drawing the
      > info from MySQL, but I am still just working on how to
      > do this.
      >
      > I would need to set a cookie, but I am not sure of how
      > I am going to do that using just yet. I was wondering
      > if it is possible set a cookie using an SSI? And,
      > then, on the same page - call a second SSI to read the
      > cookie and then update the DB?
      >
      > Any good advice much appreciated.
      >
      > Thanks,
      >
      > Will
      >

      Another idea would be to parse the log files and load the information
      into the database. This may not provide information that a cookie or
      some 'real-time' method but it is certainly simple to implement and
      has zero impact on your server.




      Unsubscribing info is here:
      http://help.yahoo.com/help/us/groups/groups-32.html

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    Your message has been successfully submitted and would be delivered to recipients shortly.