Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.