![]() |
![]() |
|
|
||
As you can imagine, at WillMaster.com we receive a lot of questions -- about our scripts and about CGI in general. Questions are posted on the Q&A Forum at http://MasterCGI.com/ and questions arrive as personal emails. This article contains questions and their answers that I believe some WillMaster Possibilities readers might learn from. Most are paraphrased:
A. Yes, you can install multiple copies of Master Daily Content. If appropriate in your situation, install them in separate directories, like /cgi-bin/mdc1/ and /cgi-bin/mdc2/ On the other hand, if the installations are in the same directory then the program names must be different and the data directories they use must have different names.
A. Zeb, while only one action="_____" can be specified, dual action can be forced with the JavaScript onClick command. Like this: <form method="POST" action="script.cgi" onClick="MyJS()"> MyJS() can be a function to do whatever, including creating a popup with a message. MyJS() must, however, return the value "true" -- if "false" is returned then the normal action="_____" tag won't execute.
A. Your path to Perl might be /usr/bin/perl instead of /usr/bin Also, there is a list of things to check at the http://mastercgi.com/faq/ page.
A. Check:
A. In order to use the recommend form in an email and have it work every time, the referrer check must be disabled. Here is how to to it: At about line 47 of the script, you'll see:
unless($ENV{HTTP_REFERER})
Immediately above that line, type: return 1; You'll end up with:
return 1;
unless($ENV{HTTP_REFERER})
A note of WARNING: If you disable the referrer check, anyone can use your installation of the script to spam people. All they have to do is save the form to their own hard drive (or create their own form) and fill in people's names and addys, paste in their spam message, and click the button. They could send it to hundreds of people at a time.
A. Your script will first need to retrieve a template page. That can be done by opening and reading the file or by using the get function of module LWP::Simple. Once the page is in your program (we'll assume the page is in variable $Page), search $Page for placeholders and replace them with custom information. For example, all [[NAME]] placeholders might be replaced with a name obtained via a form, with code similar to:
$Page =~ s/\[\[NAME\]\]/$FORM{name}/sg;
Once replacements are complete, the script prints the page to the browser. Simply use: print "Content-Type: text/html\n\n"; print $Page; The HTML source code of template pages must use complete http://... URLs instead of relative URLs for images, style sheets, etc., because the server location of the CGI program may be different than usual web pages (thus breaking relative URLs).
A. If the program works otherwise, then it is almost certainly the path to sendmail that is in error. Use Master Pre-Installation Tester from http://willmaster.com/master/pit/ to see if the location you were given is indeed correct.
Note that the path to sendmail almost always begins with
a Also, when you type the location in the globals.cgi file, don't put it into quotes and don't follow it with a semi-colon. You're correct, Master Recommend can use sendmail whether or not you specify the -t flag.
A. The page http://search.cpan.org/search?mode=module&query=LWP has several different distributions. Probably the one your hosting company will decide to install on their servers is "libwww-perl-5.53_94" by Gisle Aas. Details about that particular distribution are at http://search.cpan.org/search?dist=libwww-perl LWP::Simple is a module used by many Perl programs to fetch pages from the net. I'm sure HostPro will see the benefit of having it available for their hosting customers.
A. Browsers tend to send the contents of the selection label to the CGI program when no specific value is specified. In other words, "-Choose One-" is being sent to the CGI script as the value of the form field. Thus, Master Form thinks the required field has been satisfied. The solution is to specify a value="" (2 quotation marks with nothing between them) for the form field labeled "-Choose One-" When a field is required, Master Form checks to see that there is at least one word character (alphanumeric and a few other printable characters) in the form field. A value="" ensures there is no word character.
__________ By: Will Bontrager Copyright 2001 Bontrager Connection, LLC
| ||