#!/usr/bin/perl # Top Sites version 2.0 # Web: http://solutionscripts.com eval { require "variables.pl"; }; if ($@) { print "Content-type: text/html\n\n"; &header; print <
Something is wrong with your variables.pl file. Please look carefully at the error listed below and double check the settings in the variables.pl file.

The error is:
$@

EOF &error_footer("error_variables.shtml"); exit; } $version ="2.0"; print "Content-type: text/html\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($fields{$name}) { $fields{$name} = $fields{$name}.",".$value; } else { $fields{$name} = $value; } } unless ($ENV{'CONTENT_LENGTH'}) { &header; print < Fill out the following form to join
$topsite_name

Web Site Name   
Web Site URL   
Your Email address   
URL for your sites banner   


EOF &footer; exit; } unless ($fields{'url'}=~/\http:/) { $error_url =1; } unless ($fields{'email'}=~/\@/) { $error_email =1; } unless ($fields{'name'}) { $error_name =1; } if ($error_email || $error_url || $error_name) { &header; print "Errors have been detected in your sign up form.

\n"; print "Please go back and fix the following:
\n"; if ($error_name) { print "You must enter a name for your web site
"; } if ($error_email) { print "Invalid email address: $fields{'email'}
"; } if ($error_url) { print "Invalid website url: $fields{'url'}
"; } print "


"; &footer; exit; } open (ID,"counts.txt"); if ($use_flock) { flock ID, 2; } $new_id = ; $new_id++; close (ID); open (NEWID,">counts.txt") || &error(1); if ($use_flock) { flock NEWID, 2; } print NEWID "$new_id"; close (NEWID); $newline = join ("\|",0,0,0,$fields{'url'},$fields{'banner'},$fields{'name'},$fields{'email'},0,0,$new_id); $newline .= "\n"; open(DB, ">>members.db") || &error(2); if ($use_flock) { flock DB, 2; } print DB $newline; close (DB); $code = "\n"; $code .= "\n"; $html_code = $code; $html_code =~ s//\>\;/g; $html_code =~ s/\n//g; &header; print <Thank you for joining the
$topsite_name


For your site to be ranked, you need to complete the following three steps.

1. Put this html code into your web pages. The more places the better.

$html_code

2. Once the above html is on your web site, click the image that appears once to activate your account.

3. Get as many of the visitors to your web site to click the image, and check your rank here and watch your site move up, up, up....

4. No forced popups or other forms of cheating will be tollerated.

Any and all questions should be directed to $your_email

EOF &footer; if ($mail_prog) { open(MAIL,"|$mail_prog -t") || &error(3); print MAIL "To: $fields{'email'}\n"; print MAIL "From: $your_email\n"; print MAIL "Subject: Welcome to $topsite_name \n\n"; print MAIL "Thank you for submitting your site to $topsite_name \n\n"; print MAIL "You need to put the following html code on your web site:\n\n"; print MAIL "$code\n"; print MAIL "Once this has been done, click on the image that appears to activate your account.\n\n"; print MAIL "You site will then be included in $topsite_name in the next update\n\n"; print MAIL "View the $topsite_name rankings at $topsite_location/topsites.shtml \n\n"; print MAIL "\n\n"; close (MAIL); } exit; sub error{ $errors = $_[0] ; &header; if ($errors == 1) { print <An error has occured trying to write/create to counts.txt

More information on the problem:
$!

EOF &error_footer("wc_counts.shtml"); } elsif ($errors == 2) { print <An error has occured trying to write/create the file members.db

More information on the problem:
$!

EOF &error_footer("wc_members.shtml"); } elsif ($errors == 3) { print <An error has occured trying to send out the welcome email

More information on the problem:
$!

EOF &error_footer("mail_prog.shtml"); } exit; } sub header { # --- Load header.htmf --- $html = "\n"; open (HEAD, "/home/www/rpghost/header.htmf"); @head = ; close (HEAD); foreach $line (@head) { $html .= "$line"; } print "$html\n"; # --- print < $topsite_name
EOF2 } sub error_footer { $error_url = $_[0]; print < http://solutionscripts.com/man/top_sites

or you jump straight to the page containing more information on your error at: http://solutionscripts.com/man/top_sites/$error_url

We also host a Help Forum where people can come and ask questions about Solution Scripts' scripts and questions they are having about them. The url for the Help Forum is:
http://solutionscripts.com/forum

Who knows, someone might have the posted the same question you have and the answer might already be there.


EOF } sub footer { $error_url = $_[0]; print <
Top Sites v$version, created by Solution Scripts
EOF # --- Load footer.htmf --- $html = ""; open (FOOT, "/home/www/rpghost/footer.htmf"); @foot = ; close (FOOT); foreach $line (@foot) { $html .= "$line"; } print "$html\n"; # --- }