#!/usr/bin/perl5 ################################################################################### ## Rank 'Em v1.30 ## ################################################################################### ## Created On: July 11, 1998 ## ## Last Updated: September 21, 1998 ## ## cgiworks@hotmail.com ## ## http://www.cgi-works.net ## ## Copyright © 1998 CGI Works. All Rights Reserved ## ################################################################################### ## ## ## Copyright Notice ## ## ---------------- ## ## This script is not freeware. Any redistribution of this script without ## ## the written consent of CGI Works is strictly prohibited. Copying ## ## any of the code contained within these scripts and claiming it as your ## ## own is also prohibited. You may not remove any of these header notices. ## ## By using this code you agree to indemnify CGI Works from any ## ## liability that might arise from it's use. ## ## ## ## Technical Support Notice ## ## ------------------------ ## ## You will not be eligible for technical support if you modify this script ## ## in any way other than the variables in the config.pl file. If it is ## ## required that we fix any scripts after you have modified them, you will ## ## be charged before any work is performed. ## ## ## ################################################################################### ## rankem.cgi ## ## ---------- ## ## This file controls all the main counting functions for the script. ## ## No editing needs to be done to this script. ## ################################################################################### require "config.cgi"; &parse; &parse_query; ############################## if($query{'action'} eq "in") { $id = "$query{'id'}"; if($use_double_cgi) { print "Content-type: text/html\n\n"; print <

$site_title

If you wish to enter
$site_title, click on the link below.

ENTER HTML } else { &giveHit; unless($useCron) { &checkTime; } } } ############################## elsif($query{'action'} eq "out") { $id = "$query{'id'}"; &giveOutHit; } ###################################### elsif($query{'action'} eq "incheck") { $id = "$query{'id'}"; $referer = $ENV{HTTP_REFERER}; if($referer =~ /rankem.cgi\?action\=in/g) { &giveHit; unless($useCron) { &checkTime; } } else { print "Content-type: text/html\n\n"; &printErrorHeader("Possible Cheating Attempt", "18", "rankem.cgi", "1"); print <

Continue to $site_title HTML exit; } } else { print "Content-type: text/html\n\n"; &printErrorHeader("Malformed Query String", "18", "rankem.cgi", "1"); print <There has been an error in the way this page was accessed!

Continue to $site_title HTML exit; } # # ############################ END MAIN PROGRAM ############################ ################################ ## Give a hit to the member ## ################################ sub giveHit { if(-e "$data_dir/$id") { $curIP = $ENV{'REMOTE_ADDR'}; open(IP, "+<$backup_dir/$id.lip") || &problem("Cannot access the IP log file", "31", "rankem.cgi", "1"); seek(IP, 0, 0); $ip = ; $ip =~ tr/.//; $curIP =~ tr/.//; if("$ip" eq "$curIP") { close(IP); print "Content-type: text/html\n\n"; &printErrorHeader("Multiple Click Throughs", "26", "rankem.cgi", "1"); print <You just clicked through for that member! Please only click through once.

Continue to $site_title HTML exit; } else { truncate(IP, 0); seek(IP, 0, 0); print IP "$ENV{'REMOTE_ADDR'}"; close(IP); open(DATA, "+<$data_dir/$id") || &problem("Couldn't open the data file for account $id", "23", "rankem.cgi", "1"); flock(DATA, 2); ($in, $out, $totalIn, $inactive, $url, $title, $descrip, $email, $banner, $password) = split(/\|/, ); $in++; $totalIn++; truncate(DATA, 0); seek(DATA, 0, 0); print DATA "$in|$out|$totalIn|0|$url|$title|$descrip|$email|$banner|$password|"; close(DATA); print "Location: $html_url/$listPage\n\n"; } } else { print "Content-type: text/html\n\n"; &printErrorHeader("No Account For That ID!", "22", "rankem.cgi", "1"); print <No account could be found for the ID provided.

Continue to $site_title HTML exit; } } ########################################## ## Give an outgoing hit to the member ## ########################################## sub giveOutHit { if(-e "$data_dir/$id") { open(DATA, "+<$data_dir/$id"); flock(DATA, 2); ($in, $out, $totalIn, $inactive, $url, $title, $descrip, $email, $banner, $password) = split(/\|/, ); $out++; truncate(DATA, 0); seek(DATA, 0, 0); print DATA "$in|$out|$totalIn|$inactive|$url|$title|$descrip|$email|$banner|$password|"; close(DATA); print "Location: $url\n\n"; } else { print "Content-type: text/html\n\n"; &printErrorHeader("No Account For That ID!", "22", "rankem.cgi", "1"); print <No account could be found for the ID provided.

Return to $site_title HTML exit; } } ####################################################### ## Check to see if it is time to update/reset list ## ####################################################### sub checkTime { open(TIME, "+<$cgi_dir/timechk.dat") || &problem("Cannot access the time log file", "47", "rankem.cgi", "1"); flock(TIME, 2); seek(TIME, 0, 0); @times =