Forum Moderators: coopster & phranque

Message Too Old, No Replies

Dynamic link cgi-bin application?

         

Reflect

11:56 am on Sep 26, 2003 (gmt 0)

10+ Year Member



Hello,

I am searching for a tool/script but must be using the wrong keywords (Sort of like looking for love in all the wrong places ;)).

I am lookking for a cgi-bin script that will create a dynamic link call. Exactly like what Brett uses here for links in posts. This would be run on a Wind*ws server.

TIA as always,

Brian

sugarkane

8:36 pm on Sep 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's actually pretty simple to do a redirect:

#!/usr/bin/perl
$url="http://www.example.com";
print "Location: $url\n\n";

That's all there is to it unless you're looking to count clicks or whatever, where it may get a bit more involved ;)

Reflect

1:29 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



Hi,

Time to look like a complete newb on this one.

I do not understand how to set this up.

Do I use this code snippet for each hyperlink that I wan't to utilize it? Do I put it in an ASCII file in the CGI-BIN directory and if so how do I formulate the call? Also is this win server compatible?

Sorry for the most basic of questions.

Confessions of a Perl newb,

Brian

sugarkane

3:13 pm on Sep 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay, to expand a little on my last a-little-brief reply ;)

A few extra lines will give you a basic redirector that you can use for any link:

#!/usr/bin/perl
use CGI;
$query=CGI::new();
$destination=$query->param("go");
print "Location: $destination\n\n";

Upload that as a plain text file called redir.cgi (or whatever) to your cgi-bin, and chmod it to 755 / set it executable.

When you want to use a redirect, reference it like <a href="/cgi-bin/redir.cgi?go=http://www.example.com">Link</a>

Put the full URL of whatever page you want after the 'go=' part.

That should do the trick...

As to your win server question - I don't see why not as I believe the CGI module that the script uses is cross-platform, but I've never tried it.

Reflect

4:06 pm on Sep 30, 2003 (gmt 0)

10+ Year Member



:)

Most excellent.

Thank you for all the help on this one.

As always take care and thank you,

Brian