Solved

CGI-Counter

Posted on 1998-09-28
3
225 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a good Angular tutorial 5 81
Need script to search multiple files in one drive 13 44
ROBOFTP UNZIP 1 40
Show tab when enter div and change underline color 3 24
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

776 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