Important alert: (current site time 7/15/2013 9:36:38 PM EDT)
 

VB icon

Website Hit Counter

Email
Submitted on: 8/3/2000 5:10:50 PM
By: Max Demian  
Level: Beginner
User Rating: Unrated
Compatibility: 5.0 (all versions), 4.0 (all versions), 3.0 (all versions)
Views: 25169
(About the author)
 
     Basic Hit Counter in Perl CGI
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
=**************************************
= Name: Website Hit Counter
= Description:Basic Hit Counter in Perl CGI
= By: Max Demian
=
=This code is copyrighted and has= limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=114&lngWId=6=for details.=**************************************

#!/usr/local/bin/perl
open(CURNUM, "counter.dat");
$num = <CURNUM>;
close(CURNUM);
$num++;
open(NEWNUM, ">counter.dat");
print NEWNUM "$num";
close(NEWNUM);
print "Content-type: text/html\n\n$num";


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
9/5/2000 9:44:51 AMno expert

Im no expert, but shouldn't you flock the the file for writing, to avoid everyone accessing the webiste at once screwing up the file.
(If this comment was disrespectful, please report it.)

 
9/16/2000 4:40:37 AMPaC

no need to post the same thing twice, i posted this 4 days before you.
(If this comment was disrespectful, please report it.)

 
9/29/2000 8:49:58 AMPaC

Dumb haha, don't you wish.
wow its what 3 char's smaller.
(If this comment was disrespectful, please report it.)

 
3/14/2001 10:29:01 AMRax

I love it when ppl argue about code
(If this comment was disrespectful, please report it.)

 
3/20/2001 8:43:46 AMFlanders

i think some servers dont support flock
not sure but i think its windows servers that dont support it
(If this comment was disrespectful, please report it.)

 
10/17/2003 9:10:19 PM

open(NEWNUM, ">counter.dat");
should be
open(NEWNUM, ">> counter.dat");
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.