#!/usr/bin/perl
##########################################################################
## ##
## Smart Archive version 2.0 ##
## ------------------------- ##
## by Smart CGIs (http://www.smartcgis.com) ##
## ##
## Smart Search is not a free script. If you got this from someone ##
## please contact me. Visit our site for up to date versions. Most ##
## CGIs are over $100, sometimes more than $500, this script is much ##
## less. We can keep this script cheap, as well as free scripts on ##
## our site, if people don't steal it. If you are going to use a ##
## stolen version, please atleast DO NOT remove any of the copyrights ##
## or links to our site, they keep this CGI cheap for everyone. ##
## Thanks! ##
## ##
## (c) copyright 2001 SmartCGIs.com ##
##########################################################################
use CGI::Carp qw/fatalsToBrowser/;
require "vars.cgi";
use CGI;
$cgi = new CGI;
$v = $cgi->param('v');
$d = $cgi->param('d');
$r = $cgi->param('r');
$dlater = $cgi->param('dlater');
$dclear = $cgi->param('dclear');
$rate = $cgi->param('rate');
$rate2 = $cgi->param('rate2');
$rating = $cgi->param('rating');
$username = $cgi->param('username');
$password = $cgi->param('password');
push (@ahead, "\n");
push (@ahead, "
";
#gaw print <$rate is not a valid file ID.
$smartlink
@afoot
EOF
exit;
}
sub report {
open(DATA,"data/report.data");
@report = ;
close(DATA);
$found = 0;
foreach $line(@report) {
@data = split(/&&/, $line);
if($data[0] eq $r) {
$data[1]++;
$found = 1;
push(@newlist,"$data[0]&&$data[1]&&\n");
} else {
push(@newlist,$line);
}
}
if($found eq 1) {
open(DATA,">data/report.data");
print DATA @newlist;
close(DATA);
} else {
open(DATA,">>data/report.data");
print DATA "$r&&1&&\n";
close(DATA);
}
print $cgi->header;
print <Go Back
$smartlink
@afoot
EOF
exit;
}
sub checklogin {
open(DATA,"data/members.data");
@members = ;
close(DATA);
foreach $line(@members) {
chomp($line);
@mdata = split(/&&/, $line);
if($mdata[0] eq $username) {
$found = 1;
if($mdata[1] ne $password) {
print $cgi->header;
print <The password you entered is incorrect.
Go Back
$smartlink
@afoot
EOF
exit;
}
}
}
if($found ne 1) {
print $cgi->header;
print <The username $username was not found. Click here if you haven't created an account yet.
Go Back
$smartlink
@afoot
EOF
exit;
}
}
sub login {
print $cgi->header;
@nvpairs=split(/; /, $ENV{'HTTP_COOKIE'});
foreach $pair (@nvpairs) {
($name, $value) = split(/=/, $pair);
$cookie{$name} = $value;
}
print <
Before you can download any files you will need to get an account and add files to the archive.
The ratio is set to 1:$ratio
EOF
if($ratiotype eq 1) {
print "files. That means if you add 1 file to the archive you will be able to download $ratio.\n";
} else {
print "bytes. That means for every byte of data you add to the archive you will be able to download $ratio bytes worth of files from it.\n";
}
print <Enter your username and password below, click here if you don't have an account.
Note: Cookies must be enabled in your browser for this feature to work.
$smartlink
@afoot
EOF
exit;
}
exit;
}
sub dclear {
print "Content-type: text/html\n";
print "Set-Cookie: mydlist=; path=/; expires=Mon, 01-Jan-2003 00:00:00 GMT\n\n";
print <Go Back
$smartlink
@afoot
EOF
exit;
}