Foros del Web » Programación para mayores de 30 ;) » Programación General »

Error en código

Estas en el tema de Error en código en el foro de Programación General en Foros del Web. Quiero corre un cgi en Netfirms y me da error (linea 22)..tiene algo que ver con que netfirms no permite personalizar el .htaccess ? a ...
  #1 (permalink)  
Antiguo 13/04/2002, 04:08
Avatar de ||Dj||  
Fecha de Ingreso: enero-2002
Mensajes: 2.349
Antigüedad: 22 años, 3 meses
Puntos: 1
Error en código

Quiero corre un cgi en Netfirms y me da error (linea 22)..tiene algo que ver con que netfirms no permite personalizar el .htaccess ? a alguien se le ocurre como setear el codigo para que funcione correctamente?
abajo lo dejo
gracias de antemano.
  #2 (permalink)  
Antiguo 13/04/2002, 04:15
Avatar de ||Dj||  
Fecha de Ingreso: enero-2002
Mensajes: 2.349
Antigüedad: 22 años, 3 meses
Puntos: 1
Re: Error en código

Cita:
#!/usr/bin/perl
# You must modify the the location of PERL in the first line above to match #
# the location on your server. Your system admin must help you with this. #
# You must also modify the following variables to match your preferences. #

# This is the counter log filename
$Counter = '/usr/home/yoursite/download.log';

# This is the location of your files
$Path = 'http://yoursite.com/downloads/';

# uncomment the line below, if you want to make it
# so that only some domains can download files
# change domain1 domain2 etc to the domains allowed
# to download files

#@okaydomains=("http://www.domain1.com", "http://209.66.79.225", "http://www.winfiles.com", "http://downloadfast.com", "http://www.downloadfast.com");

# This is the file to go to when a site has stole one of your links
# This has no effect if the line above is commented
$403 = 'http://yoursite.com/notallowed.shtml';


################################################## ########
# No changes need to be made after these lines
################################################## ########
$File = $ENV{'QUERY_STRING'};
$DownloadFile = "$Path$File";

# This will check if the link was stolen

if (@okaydomains == 0)
{return;}
$DOMAIN_OK=0;
$RF=$ENV{'HTTP_REFERER'};
$RF=~tr/A-Z/a-z/;
foreach $ts (@okaydomains)
{
if ($RF =~ /$ts/)
{ $DOMAIN_OK=1; }
}
if ( $DOMAIN_OK == 0) {

print "Content-type: text/html\n";
print "Location: $403\n\n";

exit;
}

# Add hit to main counter

open (CNT,"+<$Counter") || &endIt;
flock (CNT,2); seek (CNT,0,0);
@infile = <CNT>;

# This will put the hits in order from max to min for each file added
$record = 0; # Starting record in the log is always 0
$correctspot = 'N'; # Tells script if this record is the one that was hit
---sigue abajo
  #3 (permalink)  
Antiguo 13/04/2002, 04:16
Avatar de ||Dj||  
Fecha de Ingreso: enero-2002
Mensajes: 2.349
Antigüedad: 22 años, 3 meses
Puntos: 1
Re: Error en código

# Proceeds as long as the record number is less than the total
# number of records in the file and the correct record hasn't been found yet.
while (($correctspot eq 'N') && ($record <= $#infile))
{ ($count,$filename,$eol) = split(/\|/,$infile[$record]);
if ($filename eq $File) #if this is the right record, hit it, trip correctspot
{$count++;
$infile[$record] = join ("\|",$count,$filename,"\n") ;
$correctspot = 'Y';
}
$record++;
}
if ($correctspot eq 'N')
{ $count = 1;
$newrecord = join ("\|",$count,$File,"\n");
push @infile, $newrecord;
}

@outfile = sort {($b =~ /(\d+)/)[0] <=> ($a =~ /(\d+)/)[0]} @infile;

seek (CNT,0,0);
print (CNT @outfile);
truncate (CNT,tell(CNT));
close (CNT);

print "Content-type: text/html\n";
print "Location: $DownloadFile\n\n";

sub endIt # exit on error
{ exit;
} # end endIt
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:47.