Evo pogledaj ovde naso sam sada jos nesto bolje nego obicni counter:
http://www.gagi03.f2s.com/cgi-bin/top/countdowntopten.htm
Samo sada imam jedan problem, kako da sredim da nepise samo naprimer file.exe . Nego da uz to mogu da ja dodam naprimer:
"Ime programa: Ovaj program vam je odlican za..."
i tako te informacije, d anebude samo obicni file name.
Evo ti code
--------------------------------------------------------------------
:#Location and name of the CountDown Script on your server
$CountDownLocation = '
http://www.home.com/cgi-bin/top/countdown.cgi';
# This is the directory location of the file(s) that will be downloaded
$DownloadFileDir = '
http://www.home.com/file';
# This is the counter log filename
$Counter = '/web/sites/user/home/cgi-bin/top/countdown.log';
#This is the HTML output filename
$HTMLFile = '/web/sites/user/home/cgi-bin/top/countdownlog.htm';
#This is the HTML output filename for the Top Ten List only
$TopTenFile = '/web/sites/user/home/cgi-bin/top/countdowntopten.htm';
##########################################################
# No changes need to be made after these lines
##########################################################
$File = $ENV{'QUERY_STRING'};
# Strip off anything up to, and including, the last "/", if present
if ($File =~ /\//) { ($File) = $File =~ /^.*\/([^\/]+)$/g; }
$DownloadFile = "$DownloadFileDir/$File";
# Add hit to main counter
open (CNT,"+<$Counter") || &endIt;
flock (CNT,2);
seek (CNT,0,0);
@infile = <CNT>;
# This will put the hits in order from max to min for each file added
$record = 0; # Starting record in the log is always 0
$correctspot = 'N'; # Tells script if this record is the one that was hit
# Proceeds as long as the record number is less than the total
# number of records in the file and the correct record hasn't been found yet.
while (($correctspot eq 'N') && ($record <= $#infile))
{ ($count,$filename,$eol) = split(/\|/,$infile[$record]);
if ($filename eq $File) #if this is the right record, hit it, trip correctspot
{$count++;
$infile[$record] = join ("\|",$count,$filename,"\n");
$correctspot = 'Y';
}
$record++;
}
if ($correctspot eq 'N')
{ $count = 1;
$newrecord = join ("\|",$count,$File,"\n");
push @infile, $newrecord;
}
@outfile = sort {($b =~ /(\d+)/)[0] <=> ($a =~ /(\d+)/)[0]} @infile;
seek (CNT,0,0);
print (CNT @outfile);
truncate (CNT,tell(CNT));
close (CNT);
#Create HTML File - Whole List
open (Out,"+>$HTMLFile") || &endIt;
flock (Out,2);
print {Out} <<TextOut;
<html>
<head>
<title>CountDown Log File Contents</title>
</head>
<body>
<table border="0" cellspacing="4">
<tr>
<td><strong>Downloads - </strong></td>
<td><strong>File</strong></td>
</tr>
TextOut
foreach (@outfile) {
($count,$filename,$eol) = split(/\|/,$_);
print {Out} <<TextOut;
<tr>
<td align="right">$count - </td>
<td><a href="$CountDownLocation?$filename">$filename</a></td>
</tr>
TextOut
}
print {Out} <<TextOut;
</table>
<hr noshade color="#0000FF">
<p><font face="Arial" size="1">Log created with <a href="
http://www.datatrendsoftware.com/cgi.html">CountDown</a> by <a href="
http://www.datatrendsoftware.com">Datatrend Software</a>.</font></p></body>
</html>
TextOut
#Create HTML File - Top Ten List
open (Out,"+>$TopTenFile") || &endIt;
flock (Out,2);
print {Out} <<TextOut;
<html>
<head>
<title>CountDown Log File Top Ten List</title>
</head>
<body>
<table border="0" cellspacing="4">
<tr>
<td><strong>Downloads - </strong></td>
<td><strong>File</strong></td>
</tr>
TextOut
if ($#outfile < 9) {
for ($i = 0; $i <= $#outfile; $i++) {
($count,$filename,$eol) = split(/\|/,$outfile[$i]);
print {Out} <<TextOut;
<tr>
<td align="right">$count - </td>
<td><a href="$CountDownLocation?$filename">$filename</a></td>
</tr>
TextOut
}
} else {
for ($i = 0; $i <=9; $i++) {
($count,$filename,$eol) = split(/\|/,$outfile[$i]);
print {Out} <<TextOut;
<tr>
<td align="right">$count - </td>
<td><a href="$CountDownLocation?$filename">$filename</a></td>
</tr>
TextOut
}
}
print {Out} <<TextOut;
</table>
<hr noshade color="#0000FF">
<p><font face="Arial" size="1">Log created with <a href="
http://www.datatrendsoftware.com/countdown.html">CountDown</a> by <a href="
http://www.datatrendsoftware.com/cgi.html">Datatrend Software</a>.</font></p>
</body>
</html>
TextOut
print "Content-type: text/html\n";
print "Location: $DownloadFile\n\n";
sub endIt # exit on error
{ exit;
} # end endIt
--------------------------------------------
Ajde ako mozes pogledaj, pa mi javi..
Hvala ti ko bratu!
[
Ovu poruku je menjao gagi dana 04-04-2001 u 11:14 PM GMT]
[
Ovu poruku je menjao gagi dana 04-04-2001 u 11:18 PM GMT]
DDSD!