View Full Version : argh! redirection probs!
pqwabbit
04-10-1999, 02:21 AM
grr ok im annoyed I isntalled a redirect script and like it tells me when I do it this
error: no location specified
now man i did the forms exactly as the instructions said then i foolded with em like wassup with thsi? anyone have a clue? crappy script? adn ti does have a location cuz you can see it in the url :/ i did tell it where to go - (oh i sure could tell it wher else to go now!)
try it out at
http://www.massey.i-p-d.com/poems/index1.html
the poetry sites will give you 404's mostly or should but the site menu should rbign you to the pages - theoretically
*sigh*
Lea - running short on paitence at 1 am
------------------
Bunnies make life better.
Massachusetts House Rabbit Society, Inc.
http://www.MAHouseRabbit.org/
kteicher
04-10-1999, 09:14 AM
Lea: Let's see what redirect.pl looks like. That might be where the problem is.
pqwabbit
04-10-1999, 12:06 PM
hmm thats what my gues it I'm gonna go try another script adn see if that works - *sigh* it's been a while since I installed cgi - oh the joys!
------------------------------
minutes later http://www.aota.net/ubb/smile.gif
installed another script - adn that works great http://www.aota.net/ubb/smile.gif woohoo!!!
--------------------------
minutes later -
argh its still dong the same thing it just redirects to my homepage when a location isnt specified what is up with this? it has to be my forms
*sigh*
perl looks like this:
&FormInput(*input);
if($input{'goto'} eq "")
{
print "HTTP/1.0 302 Temporary Redirection\r\n" if $ENV{PERLXS} eq "PerlIS";
print "Content-type: text/html\n";
print ("Location: $main\n\n");
}
else
{
if ($input{'goto'} !~ m?://?)
{
$input{'goto'} = "http://" . $input{'goto'};
}
print "HTTP/1.0 302 Temporary Redirection\r\n" if $ENV{PERLXS} eq "PerlIS";
print "Content-type: text/html\n";
print ("Location: $input{'goto'}\n\n");
}
exit;
#-------------------------------------------------------------
# FormInput: Function
#-------------------------------------------------------------
sub FormInput
{
local (*qs) = @_ if @_;
if ($ENV{'REQUEST_METHOD'} eq "GET")
{
$qs = $ENV{'QUERY_STRING'};
}
elsif ($ENV{'REQUEST_METHOD'} eq "POST")
{
read(STDIN,$qs,$ENV{'CONTENT_LENGTH'});
}
@qs = split(/&/,$qs);
foreach $i (0 .. $#qs)
{
$qs[$i] =~ s/\+/ /g;
$qs[$i] =~ s/%(..)/pack("c",hex($1))/ge;
($name,$value) = split(/=/,$qs[$i],2);
if($qs{$name} ne "")
{
$qs{$name} = "$qs{$name}:$value";
}
else
{
$qs{$name} = $value;
}
}
return 1;
}
form looks like this:
<form NAME="Site Menu" action="/cgi-bin/clickgo.pl" METHOD="post">
<select NAME="site" SIZE=1 >
<option VALUE="http://www.massey.i-p-d.com/index.shtml">Home</option>
<option VALUE="http://www.massey.i-p-d.com/didmpd/">DID/MPD</option>
<option VALUE="http://www.massey.i-p-d.com/rabbits/">Rabbit Realm</option>
<option VALUE="http://www.massey.i-p-d.com/fruity4/">Fruity 4</option>
<option VALUE="http://www.massey.i-p-d.com/art/">Art</option>
<option VALUE="http://www.massey.i-p-d.com/poems/">Poetry</option>
<option VALUE="http://www.massey.i-p-d.com/survey/">PY303 Survey</option>
<option VALUE="http://www.massey.i-p-d.com/guestbook/guestbook.html">Guestbook</option>
</select>
<input TYPE="submit" VALUE="Go!" ></form>
i thought maybe it wants a full url but that didnt make any difference than when I just had the directories and files (ie "/art/") PITA!
Lea
------------------
Bunnies make life better.
Massachusetts House Rabbit Society, Inc.
www.MAHouseRabbit.org/ (http://www.MAHouseRabbit.org/)
------------------------
grrr ok i changed the select name to goto - adn it works - thats was problem? - its been a while since I made forms - specially mdrop down menus - I dont know why it works like that but it does. I dont recall putting that in any of my other drop downs but I guess redirection things are specific hmm but them again when I had the forms copied origially with the goto - it still wasnt working so I guyess I should stop complaining adn like just accept that whatever I tweaked works huh? a
[This message has been edited by pqwabbit (edited 04-10-99).]
jenili
04-10-1999, 04:16 PM
Yeah, that was your problem Lea. With a prefab script you can't arbitrarily change the names of the form fields you pass it. See the line that says:
print ("Location: $input{'goto'}\n\n");
That sends the browser a location header (a redirect) with the input you specified in the form field. In order to do that, the form field (in your case, the select) has to be called "goto". Otherwise, it's almost like trying to call a friend at a different (arbitrary) phone number -- what you want isn't there....
Glad you found and fixed your problem. Hope this helps in terms of understanding why the fix worked. http://www.aota.net/ubb/smile.gif
------------------
jeni
[The code tags are still broken, so ...
[This message has been edited by jenili (edited 04-10-99).]
pqwabbit
04-10-1999, 07:05 PM
yeh well at 1 am ya dont think about hat stuff DOH! :Þ~~~~~~ I dont even remeber why I changed it inthe first place!
Lea
------------------
Bunnies make life better.
Massachusetts House Rabbit Society, Inc.
http://www.MAHouseRabbit.org/
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.