www.pudn.com > madengine.zip > madmin.cgi


#!/usr/bin/perl 
 
    require './network.pl';                             ## required for www.pl 
    require './www.pl';                                 ## main routines 
    require './filter.pl';				## filter routines 
    require './config.pl';	                        ## Configuration file 
##################################################################### 
##guestpost.cgi v1.0 Copyright  1998, Tom and Linda Myro, 
##all rights reserved.  Permission granted to use and modify 
##for any good use, as long as you agree to hold Tom and Linda  
##Myro and cyber-nurse.com harmless, in the event of any disaster 
##either real or imagined, resulting from the use of this software. 
##Modification and/or installation of this software shall be  
##considered agreement of you, the user with the above conditions. 
#####################################################################  
 
## Make any configuration changes in config.pl 
 
##Fabrication 
$title = $madmintitle; 
$thisscripturl = $madminurl; 
$password = $madminpass; 
$urllist = $datadirectorypath . "/" . "urlbase\.dat"; 
 
#This business here was borrowed from Dave Palmer  
 
read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); 
 
	# split the input 
	@pairs = split(/&/, $input); 
 
	# split the name/value pairs 
	foreach $pair (@pairs) { 
 
	($name, $value) = split(/=/, $pair); 
 
	$name =~ tr/+/ /; 
	$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 
	$value =~ tr/+/ /; 
	$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 
	$value =~ s/<([^>]|\n)*>//g; 
 
  $FORM{$name} = $value; 
    } 
################Translation 
$url = $FORM{ 'url' }; 
$action = $FORM{ 'action' }; 
$pass = $FORM{ 'pass' }; 
$deletethis = $FORM{ 'deletethis' }; 
 
 
 
if($action eq ""){ 
	&starthtml; 
	print "

$title Login


\n"; print "
\n"; print "Type Your Password Here\: \n"; print "\n"; print "
\n"; &endhtml; exit; } if($action eq "menu"){ &passcheck; &starthtml; print "

Welcome to $title


\n"; print "

These are the $title Choices Available\:


\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "
Start URL update engine\, which will access all of the pages in the URL list database\, and index their results\. \(NOTE\!\!\! Your Connection MAY time out during this operation\, if your URL list is Very Long. This has no effect on the updating itself\, You may simply continue using $title as if it never occured\. This is caused by slow network times during internet overcrowding\.
\n"; &formstarter; print "Add a URL to the List of URL\'s to access\, and define filter type\.
\n"; &formstarter; print "Remove a URL from the List of URL\'s to access
\n"; &endhtml; exit; } if($action eq "refresh"){ &passcheck; open(URLBASE, "$urllist"); &starthtml; print "

Updating URL Indexes


\n"; $endhtml; $line = ; while($line ne ""){ @urlline = split(/\|/, $line); $entrynumber = @urlline[0]; $url = @urlline[1]; $filtertype = @urlline[2]; $webfile = $datadirectorypath . "/" . "webfile" . $entrynumber . "\.dat"; $datfile = $datadirectorypath . "/" . "indexfile" . $entrynumber . "\.dat"; ($status, $memo) = &www'open_http_url(*IN, $url); ## connect open(WEBFILE, ">$webfile"); print WEBFILE while ; close(WEBFILE); ## dump contents &filter; $line = ; } &formstarter; print "\n"; print "

to return to the main menu\.

\n"; &endhtml; exit; } if($action eq "addurl"){ &passcheck; &starthtml; print "

Add a URL to the URL Database


\n"; &formstarter; print "\n"; print "Type Your URL Here \(Starting with http\:\/\/\)\:
\n"; print "
\n"; print "\n"; &endhtml; exit; } if($action eq "geturl"){ &passcheck; &starthtml; $webfile = $datadirectorypath . "/" . "webtestfile\.dat"; print "

Attempting to fetch URL


\n"; &formstarter; print "\n"; print "\n"; print "\n"; &endhtml; ($status, $memo) = &www'open_http_url(*IN, $url); ## connect open(WEBFILE, ">$webfile"); print WEBFILE while ; close(WEBFILE); ## dump contents exit; } if($action eq "urlcheck"){ &passcheck; &starthtml; print "

$title URL test results


\n"; print "

$url

\n"; $webfile = $datadirectorypath . "/" . "webtestfile\.dat"; $filesize = -s $webfile; if($filesize < 1000){ print "There seems to have been a problem in fetching your file\. It may have been entered incorrectly\, or other problems may have occured\. Use your Browser\'s Back button and check your entry\.
\n"; } else{ print "Your URL seems to have fetched correctly\.
\n"; &formstarter; print "\n"; print "\n"; print "Click \n"; print " to continue.\n"; } &endhtml; exit; } if($action eq "writefiltercondat"){ &passcheck; $countfile = $datadirectorypath . "/" . "entrycount\.txt"; open(LISTCOUNT, "$countfile"); $urlcount = ; ++$urlcount; open(URLBASE, ">>$urllist"); $entryline = "$urlcount\|$url\n"; print URLBASE ($entryline); close(URLBASE); close(LISTCOUNT); open(LISTCOUNT, ">$countfile"); print LISTCOUNT ($urlcount); close(LISTCOUNT); &starthtml; print "

OK...URL has been entered in the Database


\n"; &formstarter; print "\n"; print "

to return to the main menu\.

\n"; &endhtml; exit; } if($action eq "deleteurl"){ &passcheck; open(URLBASE, "$urllist"); &starthtml; print "

Delete a URL resource from the URL Database


\n"; print "\n"; &formstarter; print "\n"; $line = ; while($line ne ""){ @splitemup = split(/\|/, $line); $deadurl = $splitemup[1]; print "\n"; print "
Delete\: $deadurl<\TD><\TR>\n"; $line = ; } print "
\n"; &endhtml; exit; } ##Ugly nasty routine to wipe the responsefile of the response if($action eq "wipeem"){ &passcheck; $deletescratch = $datadirectorypath . "/" . "deletescratch\.txt"; open(URLBASE, "$urllist"); open(SCRATCHPAD, ">$deletescratch"); $urlline = ; while($urlline ne ""){ unless($urlline eq $deletethis){ print SCRATCHPAD ($urlline); } $urlline = ; } close(URLBASE); close(SCRATCHPAD); open(SCRATCHPAD, "$deletescratch"); open(URLBASE, ">$urllist"); $scratchline = ; while($scratchline ne ""){ print URLBASE ($scratchline); $scratchline = ; } &starthtml; print "

SUCCESS\!\!

Your Request has been Successfully Deleted\.


\n"; &formstarter; print "\n"; print "

to return to the main menu\.

\n"; &endhtml; close(SCRATCHPAD); close(URLBASE); exit; } #here's the subroutines sub formstarter { print "
\n"; print "\n"; } sub passcheck { if($pass ne $password){ &starthtml; print "

OOPS!!


The password you entered was incorrect\, please use your browser\'s back button and remedy this\.\n"; &endhtml; exit; } } sub starthtml { if ($colororimage eq "0"){ $backgroundtag = "BACKGROUND\=$bgimageurl"; $bgcolortag = ""; } else { $backgroundtag = ""; $bgcolortag = "BGCOLOR\=$bgcolor"; } print "Content-type: text/html\n\n"; print "$title\n"; print "\n"; } #here's another sub endhtml { print ""; }