Jump to content

Does anyone know perl?


eaglelegend

Recommended Posts

Because I am having an issiue with my search engines Add URL file, I have to be honest, I dont know a great deal of perl, so I cannot be sure what is causing this file to give me an error 500... (internal server error) if anyone can help me, that would be marvoulous, and thanks in advance!

 

$list ='/home/el/labs/AVRsearch/lists/list.dat';
$urlsearch = 'http://labs.eaglelegend.com/AVRsearch';	

# Error Handler
sub error
{    print "Content-type: text/html\n\n";
print "<html><head><title>There was an Error</title></head>\n";
print "<body><center><h2>There was an Error with your data</h2></center>\n";
print "Press on the 'Back' button and re-submit\n";
print "</body></html>";
exit;
}

# Check to see what Request Method was used
if ($ENV{'REQUEST_METHOD'} ne "POST") {$error;
exit;
}

# Get Variables
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);

# Decode Form information
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

# Make sure http:// was included
if ($FORM{'url'}=~ /http:\/\//) {} else {&error};
&error unless $FORM{'url'};
&error unless $FORM{'title'};
&error unless $FORM{'description'};
&error unless $FORM{'keyword'};
&error unless $FORM{'email'};

# Add to Database
$line = join ("::","$FORM{'url'}","$FORM{'title'}","$FORM{'description'}","$FORM{'keyword'}","$FORM{'email'}");
open (DBASE,">>$list" );
print DBASE ("$line \n");


# start of HTML
print "Content-type: text/html\n\n";
print ("
<head>
<title>The following information has been indexed</title>
</head>
<body bgcolor=\"#FFFFFF\">
<p align=\"center\"><font size=\"7\" face=\"Arial\"><strong>
<img src=\"$urlsearch/main.gif\"></strong></font></p>
<hr>
<div align=\"center\"><center>
<table border=\"0\" cellpadding=\"5\" cellspacing=\"5\">
<tr>
<td>
<font size=\"2\" face=\"Arial\">
The following information has been indexed in our database:
</font>
<p>
<font size=\"2\" face=\"Arial\">Web's URL: </font>
<a href=\"$FORM{'url'}\">
<font size=\"2\" face=\"Arial\">$FORM{'url'}</font></a>
<font size=\"2\" face=\"Arial\"> 
<br> Title:	$FORM{'title'}
<br> Description: $FORM{'description'}
<br> Key words : $FORM{'keyword'}
<br> E-mail Address: $FORM{'email'}</font></p>
</td>
</tr>
</table>
</center></div>
<p align=\"center\">
<a href=\"$urlsearch/index.html\">
<font size=\"1\" face=\"Arial\">
<strong>Go back to the Search Page!!</strong>
</font></a></p>
<hr>
<center>
<a href=\"mailto:support\@eaglelegend.com\">
<font size=\"2\" face=\"Arial\"><b>Search Engine</b></font></a>
</font></p>
</center>
</body>
</html>

");

Link to comment
https://forums.phpfreaks.com/topic/147456-does-anyone-know-perl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.