#!/bin/perl ######################################################## # # # DO NOT REMOVE THIS HEADER # # # ######################################################## # # # For Unix/Unix Compatible/Linux/FreeBSD servers. # # # # This script will NOT work on MSWin32 servers. # # # ######################################################## # # # Try changing the first line to #!/usr/local/bin/perl # # if the script does not work for you. # # # ######################################################## # # # COPYRIGHT NOTICE # # Copyright 2000 by Thomas J. Delorme # # All Rights Reserved. # # # # This script may be used provided that it is not # # changed beyond the configuration section. Failure to # # comply voids any and all support privledges. By # # using this script you agree to release the author # # from any liability or damages that might arise from # # its use. Redistributing/selling the code for this # # script without prior written consent is expressly # # forbidden. # # # ######################################################## # # # If you would like to make money with this script, # # please join The Psychosys Perl Affiliate program. # # Details are available at the Psychosys Perl website. # # # ######################################################## # # # EasySearch v1.2 by Thomas J. Delorme # # Website : http://www.getperl.com # # E-mail : webmaster@getperl.com # # Created : Sunday, July 11, 1999 # # Revised : Tuesday, February 8, 2000 # # # ######################################################## ############ ADJUST THESE VARIABLES ################ # Change this to the title of your search engine... # Don't forget to change the title in the head.txt and # foot.txt files too $sitetitle = 'Busca RioSerra'; # Change this to the url of your seach engine index page $searchurl = 'http://www.rioserra.com'; # Change this to your e-mail address # Depending on your version of PERL you may have to escape # the @ sign like this \@ # At first try just entering your straight e-mail address $searchemail = 'contato@rioserra.com'; # You may not need to change the $mailprogram variable. # Try it as is first. If it doesn't work try putting a # in # front of the first line below and remove the # on the # second line. If that fails, try the removing the # on # the third line and put a # in front of the other two. # If that fails, ask your administrator where the sendmail # program is on your system. #$mailprogram = '/usr/sbin/sendmail'; $mailprogram = '/usr/lib/sendmail'; # $mailprogram = '/usr/bin/sendmail'; # Change this to the PATH (not the URL) of the base.txt file # (include the filename) $base = '/www/saopaulo15/public_html/busca/base.txt'; # Change this to the PATH (not the URL) of the head.txt file # (include the filename) $headfile = '/www/saopaulo15/public_html/busca/head.txt'; # Change this to the PATH (not the URL) of the foot.txt file # (include the filename) $footfile = '/www/saopaulo15/public_html/busca/foot.txt'; # Change this to the PATH (not the URL) of the respond.txt file # (include the filename) $respondfile = '/www/saopaulo15/public_html/busca/respond.txt'; # Change this to the PATH (not the URL) of the smut.txt file # Any word found in smut.txt is assumed to be adult material # therefore you can control what is censored and what isn't # (include the filename) $smutfile = '/www/saopaulo15/public_html/busca/smut.txt'; # Change this to the URL of this script # (include the filename) $scripturl = 'http://www.rioserra.com/busca/easysearch.cgi'; # Edit this one to choose the font for the search results # DO NOT use " or any special characters # Use below for an example of what is allowed # Also do not set a font size as the script does this automatically $font = 'FACE=verdana,arial,helvetica COLOR=000000'; # Change this to the minimum search word length # This is to exclude searches for "the", "and", "a", etc. $minword = '2'; # Enter the maximum number of characters you want to allow for # the 'title' field for new site submissions $maxtitle = '50'; # Enter the maximum number of characters you want to allow for # the 'description' field for new site submissions $maxdescription = '190'; # Enter the maximum number of characters you want to allow for # the 'keywords' field for new site submissions $maxkeywords = '100'; # How many URLs do you want displayed on the New URLs page $numnew = '25'; # If you want to use flock to avoid corrupt files by double access # leave this line as is...if you don't then change the 1 to a 0 $uselock = '1'; # If you want to automatically send an autorespond e-mail to visitors # who submit their URL to the database then leave this line as is # If you don't, then change the 1 to a 0 $userespond = '1'; #################### STOP HERE! #################### # # # You may now upload this file to your server, using # # the instructions you received in the readme.txt file # # # ######################################################## # # # WARNING : Changing anything in this box or below # # may damage the script. # # # ######################################################## # Get the form variables if ($ENV{'REQUEST_METHOD'} eq 'GET') { $buffer = $ENV{'QUERY_STRING'}; } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } # Break em up into a format the script can read @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; $FORM{$name} = $value; } # Get the heading information unless (open (DATA,"$headfile")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @headinfo = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); foreach $headline (@headinfo){ $heading = $heading.$headline; } # Get the footer information unless (open (DATA,"$footfile")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @footinfo = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); foreach $footline (@footinfo){ $footer = $footer.$footline; } # Get the smut filter information unless (open (DATA,"$smutfile")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @smutinfo = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); foreach $smutline (@smutinfo){ $smutfilter = $smutfilter.$smutline; @smutwords = split (/::/,$smutfilter); } # Determine what part of the script we need if ($FORM{'action'} eq "showadd") { &showadd; } if ($FORM{'action'} eq "addurl") { &addurl; } if ($FORM{'action'} eq "newurls"){ &newurls; } if ($FORM{'action'} eq "randomurl"){ &randomurl; } # Assign shorter variable names # (Laziness on my part - but I find the longer # a script gets the more work typing long # variable names becomes.) $position = $FORM{'code'}; $addshow = 0; $noshow = 0; $match = 0; if ($FORM{'safe'} ne "on") { $safekey = "off"; } else { $safekey = "on"; } # Begin the search process and output the results unless (open (DATA,"$base")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @input = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); # Routine for 'words' search if ($FORM{'mode'} eq "words") { $searchstring=$FORM{'keywords'}; @words = split (/ /,$searchstring); foreach $word (@words) { $wordlength = length($word); if ($wordlength < $minword) { &stringshort; } } &heading; $entries = @input; if ($position == 0) { $currentline = $entries; } else { $currentline = $position; } $found="0"; print "
Resultados da Pesquisa : '$FORM{'keywords'}'

"; print "
"; print ""; until ($found > 9 || $currentline == 0) { foreach $word (@words) { if ($input[$currentline] =~ /$word/i) { @data = split (/::/,$input[$currentline]); if ($data[4] ne "") { if ($safekey eq "on" && $match == 0) { foreach $smutword (@smutwords) { if ($input[$currentline] =~ /$smutword/i) { $smut = 1; } } unless ($smut == 1) { print "$data[1]
"; print "$data[4]
"; print "$data[0]

"; ++$found; ++$match; } $smut = 0; } if ($safekey eq "off" && $match == 0) { print "$data[1]
"; print "$data[4]
"; print "$data[0]

"; ++$found; ++$match; } } } } --$currentline; $match = 0; } } # Routine for 'phrases' search if ($FORM{'mode'} eq "phrases") { $searchstring=$FORM{'keywords'}; $wordlength = length($FORM{'keywords'}); if ($wordlength < $minword) { &phrase; } &heading; $entries = @input; if ($position == 0) { $currentline=$entries; } else { $currentline = $position; } print "

Resultados da Pesquisa : '$FORM{'keywords'}'

"; print "
"; print ""; until ($found > 9 || $currentline == 0) { if ($input[$currentline] =~ /$FORM{'keywords'}/i) { @data = split (/::/,$input[$currentline]); if ($data[4] ne "") { if ($safekey eq "on") { foreach $smutword (@smutwords) { if ($input[$currentline] =~ /$smutword/i) { $smut = 1; } } unless ($smut == 1) { print "$data[1]
"; print "$data[4]
"; print "$data[0]

"; ++$found; } $smut = 0; } if ($safekey eq "off") { print "$data[1]
"; print "$data[4]
"; print "$data[0]

"; ++$found; } } } --$currentline; } } print ""; &footer; ################# SUBROUTINES ###################### sub heading { print "Content-type: text/html\n\n"; print "$heading"; } sub footer { $keyencode=$FORM{'keywords'}; $keyencode =~ tr/ /+/; if ($found > 9) { $position=$currentline; print "

Mais Resultados »



"; } else { unless ($addshow == 1) { print "
Fim dos Resultados.

\n"; } } unless ($noshow == 1) { unless ($addshow == 1) { print "

Busca Por :
Modo :PalavrasFrase
Segurança : Filtro Familiar

\n"; } if ($FORM{'keywords'} ne "") { print "
Faça busca por \"$FORM{'keywords'}\" nestes sistemas de busca...

AltaVista DejaNews Excite GO Network HotBot Lycos WebCrawler Yahoo!

\n"; } } &generate; print "$footer"; exit; } sub error { $noshow = 1; &heading; print "

File Access Error

You have an error in your PATH configuration variables in the $ENV{'SCRIPT_NAME'} file.

Your server reports that your BASE path is : $ENV{'DOCUMENT_ROOT'}
Note that this is reported as your BASE path, not the FULL path to your files.

If you require help installing this script please consider purchasing the professional version of this script. Your purchase includes full tech support and installation.

Get it at : http://www.getperl.com/easysearch/

\n"; &footer; } sub stringshort { $noshow = 1; print "Content-type: text/html\n\n"; &heading; print "

Palavra muito Curta

Desculpe...as palavras devem ter ao menos 3 characters

\n"; &footer; } sub phrase { $noshow = 1; print "Content-type: text/html\n\n"; &heading; print "

Frase muito curta

Desculpe...a frase deve ter pelo menos $minword caracteres

\n"; &footer; } sub generate { print "

Powered by : EasySearch - Copyright 1999 by Thomas J. Delorme

\n"; } sub showadd { &heading; $addshow = 1; print "

Incluir Site
\n"; print "Por favor, preencha o formulário abaixo e clique no botão Enviar
\n"; print "Por favor, preencha todos os campos.

\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
E-mail :
Título do Site :
Url :
Descrição :
Palavras Chave :
(Vírgulas, sem espaços)

\n"; print " Eu gostaría de receber informativos do Portal RioSerra.

\n"; print "\n"; print "

\n"; &footer; } sub addurl { &heading; $noshow = 1; unless ($FORM{'url'} =~ /http:\/\//) { &submiterror; } if ($FORM{'url'} eq "" || $FORM{'title'} eq "" || $FORM{'email'} eq "" || $FORM{'description'} eq "" || $FORM{'keywords'} eq "") { ∅ } unless (open (DATA,"$base")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @input = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); $entries = @input; $urlsearch = "$FORM{'url'}"."::"; $urltemp = $FORM{'url'}; chomp($urltemp); chop($urltemp); $urlsearchtwo = "$urltemp"."::"; $urlsearchthree = "$FORM{'url'}"."/::"; $currentline = 0; until ($currentline == $entries) { if ($input[$currentline] =~ /$urlsearch/i) { &exists; } if ($input[$currentline] =~ /$urlsearchtwo/i) { &exists; } if ($input[$currentline] =~ /$urlsearchthree/i) { &exists; } ++$currentline; } $testline = $input[$currentline-1]; $testline2 = $input[$currentline-2]; $testline3 = $input[$currentline-3]; $testline4 = $input[$currentline-4]; $testline5 = $input[$currentline-5]; $testline6 = $input[$currentline-6]; $testline7 = $input[$currentline-7]; $testline8 = $input[$currentline-8]; $testline9 = $input[$currentline-9]; $testline10 = $input[$currentline-10]; if ($testline =~ /$FORM{'description'}/) { &samestuff; } if ($testline =~ /$FORM{'title'}/) { &samestuff; } if ($testline =~ /$FORM{'keywords'}/) { &samestuff; } if ($testline =~ /$FORM{'email'}/i || $testline2 =~ /$FORM{'email'}/i || $testline3 =~ /$FORM{'email'}/i || $testline4 =~ /$FORM{'email'}/i || $testline5 =~ /$FORM{'email'}/i || $testline6 =~ /$FORM{'email'}/i || $testline7 =~ /$FORM{'email'}/i || $testline8 =~ /$FORM{'email'}/i || $testline9 =~ /$FORM{'email'}/i || $testline10 =~ /$FORM{'email'}/i) { &justsubmitted; } $newemail = $FORM{'email'}; if ($FORM{'send'} ne "on") { $newemail = "X"."$newemail"."X"; } $newtitle = substr($FORM{'title'},0,$maxtitle); $newdesc = substr($FORM{'description'},0,$maxdescription); $newkeywords = substr($FORM{'keywords'},0,$maxkeywords); $line = join ("::","$FORM{'url'}","$newtitle","$newkeywords","$newemail","$newdesc"); unless (open (DATA,">>$base")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 2; } print DATA "$line\n"; if ($uselock eq '1') { flock DATA, 8; } close (DATA); print "

Site Cadastrado

\n"; print "Os dados abaixo foram recebidos por $sitetitle :
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
URL :$FORM{'url'}
Título : $FORM{'title'}
Palavras-chave : $FORM{'keywords'}
Descrição : $FORM{'description'}
E-mail : $FORM{'email'}

\n"; if ($userespond eq '1') { unless (open (DATA,"$respondfile")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @respondinfo = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); foreach $respondline (@respondinfo){ $respondmessage = $respondmessage.$respondline; } open (MAIL, "|$mailprogram -t"); print MAIL "To: $FORM{'email'}\n"; print MAIL "From: $searchemail\n"; print MAIL "Subject: Site Cadastrado!\n\n"; print MAIL "Bem-Vindo à $sitetitle!\n"; print MAIL "Nosso endereço é $searchurl\n\n"; print MAIL "SUA SUBMISSÃO:\n"; print MAIL "------------------------------------------------------------------\n"; print MAIL "URL : $FORM{'url'}\n"; print MAIL "Título : $FORM{'title'}\n"; print MAIL "Descrição : $FORM{'description'}\n"; print MAIL "Keywords : $FORM{'keywords'}\n"; print MAIL "E-mail : $FORM{'email'}\n"; print MAIL "------------------------------------------------------------------\n\n"; print MAIL "$respondmessage"; print MAIL "------------------------------------------------------------------\n\n"; print MAIL "Obrigado pela participação,\n"; print MAIL "---------------------------------------------\n"; print MAIL "$sitetitle\n"; print MAIL "$searchemail\n"; print MAIL "$searchurl\n"; print MAIL "---------------------------------------------\n"; print MAIL "Powered by :\n"; print MAIL "EasySearch - Copyright 1999\n"; print MAIL "http://www.getperl.com\n"; print MAIL "---------------------------------------------\n"; close (MAIL); } &footer; } sub exists { $noshow = 1; print "

O Endereço já Existe


$FORM{'url'}
Desculpe, para cada endereço é permitido apenas um cadastro.

\n"; &footer; } sub samestuff { $noshow = 1; print "

ATENÇÃO


Você recentemente incluiu uma URL com ou o mesmo title, descrição, ou palavras-chave. Como esta é uma URL diferente, favor mudar o título, descrição e/ou palavras- chave.

\n"; &footer; } sub justsubmitted { $noshow = 1; print "

ATENÇÃO


Você acabou de cadastrar outro site. De forma a não sobrecarregar nosso banco de dados, pedimos que você cadastre este site
novamente mais tarde. Desculpe pela inconveniência

\n"; &footer; } sub empty { $noshow = 1; print "

Field Empty


Favor preencher todos os campos do formulário.

\n"; &footer; } sub submiterror { $noshow = 1; print "

URL invalida


Os endereços devem conter http://

\n"; &footer; } sub newurls { &heading; unless (open (DATA,"$base")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @input = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); $entries = @input; print "

Novos Cadastrados :
"; $currentline = $entries; print ""; $count = 0; until ($count == $numnew) { @data = split (/::/,$input[$currentline]); if ($data[4] ne "") { foreach $smutword (@smutwords) { if ($input[$currentline] =~ /$smutword/i) { $smut = 1; } } unless ($smut == 1) { print ("$data[1]
"); print ("$data[4]
"); print ("$data[0]

"); ++$count; } $smut = 0; } --$currentline; } print ""; &footer; } sub randomurl { &heading; unless (open (DATA,"$base")) {die (&error);} if ($uselock eq '1') { flock DATA, 2; seek DATA, 0, 0; } @input = ; if ($uselock eq '1') { flock DATA, 8; } close (DATA); $entries = @input; print "

Site Surpresa
"; $count=0; while ($count != 1) { srand (time + $$); $currentline = int( rand ($entries)); print ""; @data = split (/::/,$input[$currentline]); foreach $smutword (@smutwords) { if ($input[$currentline] =~ /$smutword/i) { $smut = 1; } } unless ($smut == 1) { if ($data[4] ne "") { print "$data[1]
"; print "$data[4]
"; print "$data[0]

"; $count=1; } } $smut = 0; } &footer; }