Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2000
Posts: 18
VJ
Offline
Junior Member
Junior Member
Offline
Joined: Feb 2000
Posts: 18
Okay, this should be simple enough: I am using a redirect cgi script that gets commands from a dropdown list on a web page. I'd like to use an URL string "-" as kind of a "menu separator" that does not do nothing, but makes the dropdown menu look better.

The problem is that whenever a "-" link is selected from the page, I get 500 error when the script goes haywire.I've tried adding some if's to avoid the situation, but I think the main reason is that script execution does not end properly, it "leaks" into the following subroutine or something? confused

Here's the script:

Code
code:

I've tried this, but it does not help. frown

Code
code:

Sponsored Links
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
It's not legal for a CGI script to "do nothing". The script must output a response header, such as a normal Content-type header or a Location header.

For the "-" case, you could redirect to the same page, or you could output an error page.

Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
P.I.T.A. / Programmer
Offline
Joined: Sep 2000
Posts: 755
Try it with CGI.pm instead of the gross readparse routine (which is old, outdated, and unsupported)

#!/usr/bin/perl

use CGI qw/:standard/;

my $gotourl = param('url');
redirect($gotourl) unless $gotourl =~ /-/;

# Remainder of code here.


(I dont have time to verify that all works ok, but that should be a starting point for you)
--mark

[ March 21, 2001: Message edited by: Mark Badolato ]


"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
Joined: Aug 2000
Posts: 1,290
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,290
Is the drop box on a page and that calls the script? If so try this:




Just add it to your page code for the drop box in the places you need it!


- Custom Web Development
http://www.JCSWebDev.com
Joined: Feb 2000
Posts: 18
VJ
Offline
Junior Member
Junior Member
Offline
Joined: Feb 2000
Posts: 18
Okay, I got it working by making a compromise, and redirecting user to my 404 page if he selected a non-existant link ... one final question:

How do I make my browser show the url where the script has redirected it into? Now the browser's url line says "http://www.b5itf-finland.org/redirect.cgi" ???

Edit: Add to that, on pages that I've gone into using the redirect script have "http://www.b5itf-finland.org/scripts" as their relative URL, so all relative href's on these pages had to be replaced with absolutes ... I'd like to use relative ones. frown

Part of the code here, just to clarify:

Code
code:

[ March 24, 2001: Message edited by: VJ ]

Sponsored Links
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
According to CGI Programming with Perl, URLs can be divided into three types:


The second case supposedly produces an internal redirect, which would result in the behavior you're seeing.

I've included all this detail because I've had trouble with it myself, and am hoping that someone more knowledgeable will jump in and expand on this smile

Joined: Feb 2000
Posts: 18
VJ
Offline
Junior Member
Junior Member
Offline
Joined: Feb 2000
Posts: 18
^ Bump ^ -- [beg mode] anybody? [/beg mode]

Joined: Mar 2001
Posts: 25
Junior Member
Junior Member
Offline
Joined: Mar 2001
Posts: 25
To do what you want, use Javascript!

Code
code:

Joined: Feb 2000
Posts: 18
VJ
Offline
Junior Member
Junior Member
Offline
Joined: Feb 2000
Posts: 18
I want to use Javascript as little as possible to overcome browser problems, hence the cgi redirect. Sorry, can't fo. frown

Joined: Apr 2001
Posts: 18
Junior Member
Junior Member
Offline
Joined: Apr 2001
Posts: 18
use html instead of
print "Location : $gotourl";

e.g.

print "";
such things like that~~~@_@


0--0--0--0--0--0
full stop = 。
comma = ,
exclamatn = !
questn mk = ?
other : …︰。·— etc.
0--0--0--0--0--0
Sponsored Links
Joined: Feb 2000
Posts: 18
VJ
Offline
Junior Member
Junior Member
Offline
Joined: Feb 2000
Posts: 18
Immidiate meta redirect? Why didn't I think of that. Thanks ... will try.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)