Solved

CGI-Counter

Posted on 1998-09-28
3
227 Views
Last Modified: 2013-12-25
Can anyone help me with an example of a counter, to be placed in the cgi-bin? It has to run on a unix box, i self run NT.
0
Comment
Question by:jbrugman
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
zhongbing earned 50 total points
ID: 1828872
perl example:

#! /usr/bin/perl
$|=1;
print "Content-type:text/html\n\n";

$file = "count.txt";
open(FILE, "$filename")||die "open file $filename error $!\n";
line=<FILE>;
($name, $count)=split(/=/, $line);
$count = $count + 1;
close<FILE>
printf "you are the %d vistor\n" "$count"
$file = "count.txt";
open(FILE, ">$filename")||die "open file $filename error $!\n";
print "$name=$count"
close<FILE>
0
 
LVL 4

Author Comment

by:jbrugman
ID: 1828873
How does it work? Do i need Perl? How do i call it? Please explain, cince i am new to this.
Greetings,
Justus
0
 
LVL 3

Expert Comment

by:zhongbing
ID: 1828874
you are right , it's a perl cgi, to use it , for example you use unix box and netscape webserver. you should:
1. should install perl, and make a cgi dirctory in the web server setting, say "cgi"
2. in your html file, put a href:
   <a href="cgi/perlname.pl" > </a>
3. put the perl file to the cgi directory.


0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question