#!/usr/bin/perl
use CGI;
# Sends Errors to Browser
use CGI::Carp qw(fatalsToBrowser);
$query = new CGI;
# File location of the member info
$prog_file = "programs.txt";
&pagestart;
open(PROGS,$prog_file);
@progs=;
close(PROGS);
$i = 0;
foreach $program (@progs){
chomp($program);
($filename, $title, $description, $author, $userid, $directory, $category, $filesize, $documentation, $docfile, $screenshots, $votes, $total, $dloads) = split(/\|/,$program);
&displayinfo($filename, $title, $description, $directory, $votes, $total);
$i++;
}
&pageend;
sub pagestart {
print $query->header;
print<
Windows Games
Windows Games
HEADING
open(PROGS,$prog_file);
@prog=;
close(PROGS);
$index = 0;
@list = ();
foreach $program (@prog){
chomp($program);
(@programs) = split(/\|/,$program);
@list[$index] = $programs[13] . "|" . $programs[0] . "|" . $programs[1] . "|" . $programs[11] . "|" . $programs[12];
$index++;
}
# Sorts Data
$length = scalar @list;
for ($p = 1; $p < ($length); $p++) {
for ($q = 0; $q < ($length-$p); $q++) {
($dloads, $file, $name, $vote, $tot) = split(/\|/,@list[$q]);
($dloads_a, $file_a, $name_a, $vote_a, $tot_a) = split(/\|/,@list[$q+1]);
if ($dloads < $dloads_a) {
$temp = @list[$q];
@list[$q] = @list[$q+1];
@list[$q+1] = $temp;
}
}
}
($dloads, $file, $name, $vote, $tot) = split(/\|/,@list[0]);
print<
Top Program:
$name
$dloads downloads
TOPPROG
print< -- Downloads program directly (.zip file)
DLOAD
print<
HEADING2
}
sub displayinfo {
print<
$title |
$description
|
INFO
}
sub pageend {
print<
Problems with this page?
Contact the Webmaster.