Forum Moderators: phranque

Message Too Old, No Replies

URL Request Via CGI

         

sloth

7:42 pm on May 31, 2004 (gmt 0)

10+ Year Member



Hi,
Firstly, excellent website! Decided to sign up since there is people who know what they are talking about here! So from them to someone who doesn't know so much.

I'd like to ask the CGI elite if it is possible to link URLs from a CGI script. I'm wanting to avoid links to folders being displayed - to prevent unwanted browsing in folders/website rippers. Now, the .htaccess looks great but the site I'm working on doesn't have this enabled nor do they have PHP. They run Apache server. Can anyone advise? I have a PHP script for requesting images but as I say, PHP is not available but CGI is. Images are linked like this in HTML and poll the PHP script to get the image:
<img src = 'getme.php?image=image-12-800.jpg '>.

Basically, I'd like to do this in CGI. I've tried searching the site here but to no avail (as far as I'm aware). Below is a rough sample of the PHP script.

SAMPLE:
$path="../yourdirectory/"; // Path to protected directory

$mimetype="image/jpeg"; // Mime type of file

Header("Content-type: $mimetype");

readfile ( $path . $image );

}

Cheers,
sloth from Scotland

coopster

8:03 pm on Jun 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, sloth!

What language will you be using for your CGI programs/scripts (Perl, C, C++, TCL, BASIC, shell scripts, etc.)? Or I guess I should ask, is there a language you are comfortable with? Or are there further constraints by your hosting provider that limit your options?

claus

8:18 pm on Jun 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Uhm... i think you'll find a vast amount of CGI URL redirect scripts using any search engine. This is one of the classics - not exactly "hello world" but close.

Welcome to WebmasterWorld :)

sloth

3:03 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



Hey folks
Thanks very much for a reply. I've since been infomred that the .htaccess is going to be enabled - thank god! So I no longer need to persure the CGI route.

Thanks!
sloth