LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2003, 03:09 PM   #1
jimval7
Member
 
Registered: Jan 2002
Location: Dallas, TX
Distribution: RedHat 7.0 - Kernel 2.4.17
Posts: 95

Rep: Reputation: 16
Post Web counter


I need the html or cgi code for a web counter, I do not want to use someone else's or the "free" web counters to use on the web. Thanks, Jimmy
 
Old 10-20-2003, 03:20 PM   #2
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 33
Code:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "<html> <title> counter </title>";
print "<body>";
print "<b>";
print "<font size=10 color=green>";
open(INFO, "/usr/locale/apache2/cgi-bin/counter_familie.txt");
@lines = <INFO>;
$lines[0]=($lines[0]+1);
close(INFO);
open(OUTPUT,">/usr/locale/apache2/cgi-bin/counter_familie.txt");
print OUTPUT "$lines[0]";
close(OUTPUT);
print "<center>";
print " $lines[0] ";
print "</center>";
print "</b>";
print "</body>";
print "</html>";
This should do it for you , I suppose.

Last edited by SaTaN; 10-20-2003 at 03:21 PM.
 
Old 10-20-2003, 05:15 PM   #3
Claus
Member
 
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Rep: Reputation: 15
This is a PHP way to do it

Code:
Visita Nº <?php
        $c = fopen( "counter.dat", "r");
        $nm = fscanf($c, "%i", $num);
        $num++;
        echo $num;
        fclose($c);
        $c = fopen("counter.dat", "w");
        fwrite($c, $num);
        fclose($c);
?>.
I know that the two "fopen"s can be done in just one, but i cant remember how to do it :S

Bye!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hit counter dragon Programming 6 07-04-2005 10:06 PM
What's Packet Counter? mrpc_cambodia Red Hat 3 10-02-2004 10:21 PM
Counter-strike,[color=orange]H ë L F - L I F E ²[/color],Counter-strike: Source. Dennisgoop Linux - Games 2 08-10-2004 03:03 AM
Counter AMMullan Programming 5 10-23-2003 02:11 PM
looking for a web counter fly.fisher Programming 3 07-16-2001 05:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration