Solved

CGI-Counter

Posted on 1998-09-28
3
224 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now