#!/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. ## ## ## ################################################################################### ## add.cgi ## ## ------- ## ## This file controls the addition of members to your top list ## ## No editing needs to be done to this script. ## ################################################################################### require "config.cgi"; &parse_html; &parse_query; if($query{'action'} eq "") { print "Content-type: text/html\n\n"; print <

Add Your Site To The $site_title

HTML open(DATA, "$cgi_dir/addsite.dat"); while() { print; } close(DATA); print < HTML if($num_of_banners > 0) { print < HTML } print <
E-Mail Address:
Site Title:
Site URL:
Site Description:
Banner URL:
Desired Password:
HTML &scs_footer; } elsif($query{'action'} eq "add") { &addMember; &printConfirm; } elsif($query{'action'} eq "edit") { print "Content-type: text/html\n\n"; print <

Edit Your Account

Username:
Password:

HTML &scs_footer; } elsif($query{'action'} eq "stats") { print "Content-type: text/html\n\n"; print <

View Your Stats

Username:
Password:

HTML &scs_footer; } elsif($query{'action'} eq "printstats") { print "Content-type: text/html\n\n"; if(-e "$data_dir/$form{'id'}") { open(DATA, "$data_dir/$form{'id'}"); (@info) = split(/\|/, ); close(DATA); $pass = crypt($form{'password'}, "aa"); if("$info[9]" eq "$pass") { &printStats; } else { &printErrorHeader("Invalid Password", "18"); print <You entered an invalid username/password combination. HTML exit; } } else { &printErrorHeader("No Account Exists With Those Parameters", "18"); print <You entered an invalid username, and no account could be found. HTML exit; } } elsif($query{'action'} eq "printedit") { print "Content-type: text/html\n\n"; if(-e "$data_dir/$form{'id'}") { open(DATA, "$data_dir/$form{'id'}"); $data = ; close(DATA); (@info) = split(/\|/, $data); $pass = crypt($form{'password'}, "aa"); if("$info[9]" eq "$pass") { &printEdit; } else { &printErrorHeader("Invalid Password", "18"); print <You entered an invalid username/password combination. HTML exit; } } else { &printErrorHeader("No Account Exists With Those Parameters", "18"); print <You entered an invalid username, and no account could be found. HTML exit; } } elsif($query{'action'} eq "fedit") { open(DATA, ">$data_dir/$form{'member'}"); print DATA "$form{'in'}|$form{'out'}|$form{'totalin'}|$form{'inactive'}|$form{'url'}|$form{'title'}|$form{'descrip'}|$form{'email'}|$form{'banner'}|$form{'pass'}|"; close(DATA); open(DATA, ">$backup_dir/$form{'member'}.dat"); print DATA "$form{'url'}|$form{'title'}|$form{'descrip'}|$form{'email'}|$form{'banner'}|$form{'pass'}|"; close(DATA); print "Content-type: text/html\n\n"; print <

Account Successfully Updated

Back To The List HTML &scs_footer; } ################################ ## Adds a member to the list ## ################################ sub addMember { if($ENV{'REQUEST_METHOD'} eq "GET") { print "Content-type: text/html\n\n"; &printErrorHeader("Invalid script request method", "95"); print <This script was accessed with an invalid request method! HTML exit; } foreach $name (keys(%form)) { if($form{$name} eq "") { unless($num_of_banners > 0 && $name eq "banner") { print "Content-type: text/html\n\n"; &printErrorHeader("Some fields were left empty", "45"); print <You forgot to fill in one or more of the form fields. Go back and try again. HTML exit; } } } if ($form{'email'} !~ /^[\w\d][\w\d\,\.\-]*\@([\w\d\-]+\.)+([a-zA-Z]{3}|[a-zA-Z]{2})$/) { print "Content-type: text/html\n\n"; &printErrorHeader("Invalid E-Mail Address", "12"); print <You entered an invalid e-mail address! Go back and try again. HTML exit; } if ($form{'url'} !~ /^http:\/\/[\w\d\-\.]+\.[\w\d\-\.]+/) { print "Content-type: text/html\n\n"; &printErrorHeader("Invalid Site URL", "45"); print <You entered an invalid site URL! Go back and try again. HTML exit; } if(length($form{'password'}) > 8) { print "Content-type: text/html\n\n"; &printErrorHeader("Invalid desired password", "52"); print <Sorry, your password cannot be longer than 8 characters! HTML exit; } } ####################################### ## Prints the page to confirm the ## ## site has been added to the list ## ####################################### sub printConfirm { $randGen = time; srand($randGen); $username = int(rand(99999)); while(-e "$data_dir/$username") { $username = int(rand(99999)); } $password = crypt($form{'password'}, "aa"); &sendConfirmMail; open(DATA, ">$data_dir/$username") || &problem("Cannot create the user data file", "81", "add.cgi", "1", "1"); print DATA "0|0|0|0|$form{'url'}|$form{'title'}|$form{'descrip'}|$form{'email'}|$form{'banner'}|$password|"; close(DATA); open(BACKUP, ">$backup_dir/$username.dat") || &problem("Cannot create the user backup file", "34", "add.cgi", "1", "1"); print BACKUP "$form{'url'}|$form{'title'}|$form{'descrip'}|$form{'email'}|$form{'banner'}|$password|"; close(BACKUP); open(LIP, ">$backup_dir/$username.lip") || &problem("Cannot create the user IP log file", "79", "add.cgi", "1", "1"); close(LIP); chmod(0666, "$data_dir/$username"); chmod(0666, "$backup_dir/$username.dat"); chmod(0666, "$backup_dir/$username.lip"); print "Content-type: text/html\n\n"; print <

Addition Successful

Your information has been recorded and you
may now begin sending hits to our top list.

Here\'s your information:

USERNAME $username
PASSWORD $form{'password'}
SITE TITLE $form{'title'}
SITE URL $form{'url'}
BANNER URL HTML if($num_of_banners > 0 && $form{'banner'} ne "") { print "$form{'banner'}"; } else { print "NO BANNER"; } print <
E-MAIL ADDRESS $form{'email'}
DESCRIPTION $form{'descrip'}

BANNER
HTML if($num_of_banners > 0 && $form{'banner'} ne "") { print qq||; } else { print qq|NO BANNER|; } print <

Linking Information

Now just place a link on your site that points to:
$cgi_url/rankem.cgi?action=in&id=$username

Follow the link below to get acceptable banners
and text to use for your links.

Banners And Text Links HTML &scs_footer; } ################################ ## Send confirmation E-Mail ## ################################ sub sendConfirmMail { open (MAIL,"|$mailCmd -t"); print MAIL "To: $form{'email'}\nFrom: $myEmail\n"; print MAIL "Subject: Welcome To The $site_title\n\n"; print MAIL "Welcome to the $site_title Top List.\n"; print MAIL "You can begin sending hits to the list at any time\n"; print MAIL "and you will be listed, if you send enough hits, at the\n"; print MAIL "next update. Below is your linking information.\n\n"; print MAIL "URL to send hits to:\n"; print MAIL "$cgi_url/rankem.cgi?action=in&id=$username\n\n"; print MAIL "URL to get banners and text links:\n"; print MAIL "$recip_url\n\n"; print MAIL "Edit Your Data:\n"; print MAIL "$cgi_url/add.cgi?action=edit\n\n"; print MAIL "Check Your Stats:\n"; print MAIL "$cgi_url/add.cgi?action=stats\n\n"; print MAIL "Your User ID: $username\n"; print MAIL "Your Password: $form{'password'}\n\n"; print MAIL "Thanks for joining,\nWebmaster, $site_title\n"; print MAIL "$html_url/$listPage"; close (MAIL); } ################################### ## Print edit page for members ## ################################### sub printEdit { print <

Current Account Information

SITE TITLE
SITE URL
BANNER URL HTML if($num_of_banners > 0) { print qq||; } else { print "NOT USING BANNERS"; } print <
E-MAIL ADDRESS
DESCRIPTION

HTML &scs_footer; } #################################### ## Print stats page for members ## #################################### sub printStats { print <
STATS FOR: $form{'id'}
SITE TITLE $info[5]
HITS IN TODAY $info[0]
HITS OUT TODAY $info[1]
TOTAL HITS SENT $info[2]
HTML &scs_footer; }