General information
Category:
CGI/HTTP - Internet Apps
Title:
Any Suggestions??? Appearently a bad script!
Hello all again ;
I am trying to write a cgi script that will be running under perl 5, but I am having a hard time getting the syntax right appearently. What this script is supposed to do is open a text file which contains ranges of control numbers, and the redirected http addresses. This script is supposed to take the control number which is coming from another form(http)and search the text file to get the correct redirect http address. When I run it, I dont get errors.. but just gives me the 404 error(page not found). Please look at my .Cgi script below:
#!/usr/bin/perl
$datafile = "httpdata.txt";
$control = $FORM{'CONTROL'} ;
print "Set-Cookie: CONTROL=$FORM{'CONTROL'}\n";
$searchstr = $control;
open(INF,$datafile);
@mydata = ;
close(INF);
print "This is working\n\n" ;
print "Content-type:text/html\n\n";
@results = grep(/$searchstr/i,@mydata);
if ($#results > 0) {
foreach $i (@results)
{
chomp($i);
($reference,$start,$end,$addr) = split(/; /,$i);
if ($start<= $control and $end>= $control)
{
print "location: $addr\n";
}
}
}
else
{
print "No results found\n" ;
}
print "location: $addr\n\n";
Any Ideas?
PLEASE HELP!!!!
Thanks
Rick
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only