"A publicidade é a vida do negócio." - Calvin Coolidge
"A beleza de um corpo nu só a sentem as raças vestidas." - Fernando Pessoa
"Trate seus amigos como quando você faz seu retrato: coloque-os sob a melhor luz" - Churchill
"A natureza detesta o vazio." - Blaise Pascal
"Viagem é o movimento de pessoas entre locais relativamente distantes, com qualquer propósito e duração"
"É autor de estilo tão pessoal que está impossibilitado de escrever cartas anônimas." - Mário da Silva Brito
"O amor é uma função fisiológica, que o espírito reveste de um sentimento puramente decorativo." - Coelho Neto
adicionar aos favoritos:
compartilhar:
#!/usr/bin/perl
##############################################################################
# Visitor Counter Version 2.51 #
# Copyright 1998-99, UtilMind Solutions info@utilmind.com #
# http://www.utilmind.com #
# Created: Nov 3, 1998-99 Last Modified: May 03, 2000 #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1998-99, UtilMind Solutions All Rights Reserved. #
# #
# VisCounter may be used and modified free of charge by anyone so long as #
# this copyright notice and the comments above remain intact. By using this #
# code you agree to indemnify UtilMind Solutions from any liability that #
# might arise from it's use. #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of our programs. #
# #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact.#
##############################################################################
# Set Variables
$counterfile = 'contadoraks.txt';
# Get the input
$link = $ENV{'DOCUMENT_NAME'};
# Begin Code
open(FILE, $counterfile) || die Can't locate counter file $!;
@DATA = ;
close(FILE);
$SIZE = @DATA;
if ($SIZE eq 0) { exit; }
for ($i=0;$i<$SIZE;$i++) {
($counter, $baselink) = split(/'/, $DATA[$i]);
chop($baselink);
if ($baselink eq $link) {
&UpdateStats;
}
}
# Add new link to database file
open(FILE, ">>$counterfile") || die Can't locate database file $!;
flock(FILE, 2); # blocking write lock
print FILE "1'$link\n"; # First time
flock(FILE, 8);
close(FILE);
$counter = '1';
&LocateLink;
# Increase through-link counter
sub UpdateStats {
@DATA = sort {($b =~ /(\d+)/)[0] <=> ($a =~ /(\d+)/)[0]} @DATA;
$counter++;
open(FILE, ">$counterfile") || die Can't locate database file $!;
flock(FILE, 2); # blocking write lock
for ($j=0;$j<$SIZE;$j++) {
if ($j eq $i) {
print FILE "$counter'$link\n";
}
else {
print FILE "$DATA[$j]";
}
}
flock(FILE, 8);
close(FILE);
&LocateLink;
}
sub LocateLink {
print "Content-Type: text/html\n\n";
print $counter;
exit;
}