Welcome to WebmasterWorld Guest from 54.242.53.253

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

cgi script calling another cgi

syntax help and logic

     
1:13 am on Mar 4, 2009 (gmt 0)

New User

5+ Year Member

joined:Mar 2, 2009
posts:6
votes: 0


Hi,

I am calling 1 cgi script immediately upon executing another.
The first cgi is a forum script and the immediate one called is the captcha script to weed out bots...and spam.

The first script has a path to perl and then:

require "/usr/local/www/cgi-bin/cgi/captchatest.cgi";

which is the captcha script.
Is the above syntax the correct way to call it so that it branches out? I would like to set a variable back on the pc browsing the site / or set as cookie....and change the logic in the first script to something like...

if a variable is not set on remote pc..branch to captcha script....if it is set continue on.

I am looking for direction on how to do this....and if it's possible in an easy way.

I would then have to set the variable/cookie upon successfully keying in the captcha codes.

I have spent a couple hrs...googling it and am fumbling.

thanks...Jay

5:06 am on Mar 4, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 20, 2008
posts:92
votes: 0


Is the above syntax the correct way to call it so that it branches out?

Don't really know what you mean by branch, but when you call a script using "require" it pretty much is the same as if the required script is part of the main program.

You can't set a cookie and then check it without reloading the browser. You can check for a cookie when the perl script runs and if your script doesn't find what it needs then do a captcha, something like:


if (no cookie) {
require "captchatest.gic";
}

8:08 am on Mar 4, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10563
votes: 15


the require [perldoc.perl.org] perl function includes a library file but doesn't necessarily "execute" anything.
9:49 pm on Mar 4, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 20, 2008
posts:92
votes: 0


He was already using "require" to run the captcha script (see his example above) so it should work the same.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members