Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Counter of Visits in a HTML page

by Anonymous Monk
on Sep 19, 2002 at 17:40 UTC ( [id://199233]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am Ivette and i´m actually new with perl and I was wondering if anyone can help me with this, I am trying to do a counter on the entries of visiters in a page on the web with a CGI application using perl. Please anyone I need help.

Replies are listed 'Best First'.
Re: Counter of Visits in a HTML page
by ignatz (Vicar) on Sep 19, 2002 at 17:46 UTC
    If you want to see an example, check out the Text Counter script over at NMS.
    ()-()
     \"/
      `                                                     
    
Re: Counter of Visits in a HTML page
by sch (Pilgrim) on Sep 19, 2002 at 17:49 UTC

    As a relative newbie, I would think that:

    1. you'd need to be calling a .pl rather than .html
    2. when called the page would have to open a file which includes a current count
    3. increment that value
    4. write value back to file
    5. display that value- either as straight text or use some routine to output graphical equivalents of count
    of course the page would have to be displaying all the other content as well.

    I know this maybe a good learning exercise, but in real life there are plenty of sites that provide this kind of thing for free

    And of course, it may be better to do this through some other solution i.e. javascript (don't know if this would actually be possible)

      > i.e. javascript

      A client-side language wouldn't cut it for something like this. You need something that can maintain state across users and sessions.

      ()-()
       \"/
        `                                                     
      

        OK, bad example there - it would as you say have to be something on server-side.

        And of course, you'd have to be careful of race conditions - i.e. two people viewing the page at the same instant could get the same count unless you were fairly careful - although in this case I guess that's probably not a big worry but it shows how careful you have to be with this kind of stuff

Re: Counter of Visits in a HTML page
by Maclir (Curate) on Sep 19, 2002 at 18:50 UTC
    For a slightly different counter, have a look at the on at the bottom of my home page.

      ++ You have my favorite kind of counter!

      Counters are pointless so why not have a really pointless one!

Re: Counter of Visits in a HTML page
by DigitalKitty (Parson) on Sep 19, 2002 at 20:21 UTC
    Hi Ivette.

    Welcome to perl!
    I would try this site for additional help:

    http://perl.about.com/cs/counterscripts/

    or...

    http://www.hotscripts.com/Perl/Scripts_and_Programs/Counters

    I would also suggest you look at: Learning Perl 3rd. edition O'Reilly publishing
    http://www.oreilly.com

    Hope this helps,

    Katie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://199233]
Approved by Mr. Muskrat
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found