|
||||
| 2.2) Perl scripts
"I am being told file not found" "I am being told No such file or directory" Upload your Perl script in ascii mode, not binary mode. Use rz -a for telnet users, or the ascii mode for ftp users. WARNING: Upload your Perl script in ascii mode, not binary mode. Use rz -a for telnet users, or the ascii mode for ftp users. Or, it could be that your script expects Perl in a different place than we have it. Make sure that the first line of the script starts #!/usr/local/bin/perl or #!/usr/bin/perl. "I get errors such as Literal @sdfsdf now requires backslash at ./test.rob line 2, within string Execution of ./test.rob aborted due to compilation errors." Place a "\" before such offending @ characters. This is an incompatibility between Perl 5 and Perl 4. Alternatively you could change the first line in your Perl program from #!/usr/bin/perl to #!/usr/bin/perl4 2.3) What is the path of date, mail, perl ...? To find the path of the program date, type 'which date'. Do this for any program that you need your cgi-bin script to access. I see lots of perls, which one should I use? They should all be the same. /usr/local/bin/perl should work nicely. 2.4) Feedback forms 2.4.1) formmail.pl This is the easiest and fastest way to handle form to email. If you wish to use formmail.pl, send E-mail to webmaster@modemswitch.com and your site(s) will be authorized to use the script. Simply create your .html form and start the form section as follows : <FORM METHOD="post" ACTION="/cgi-bin/formmail.pl"> Obviously, you would replace you@domain.com with the E-mail address for the person who is to receive the form data. Continue creating your form as usual. That's it, quick and easy. Some additional (optional) values can be set : To make certain fields required, add the following : <input type=hidden name="required" value="field1,field2"> In the above example, 'field1' and 'field2' are required fields. 2.4.2) cgiemail Cgiemail is a program written in the C language that takes the contents of fill-in boxes on a form and emails them to a specified destination. In addition to the form specification in the .html file, a mail specification in a .txt file is required to format the resulting email message. We provide cgiemail in the cgi-bin directory of each machine. Thus, it would be called with a URL such as /cgi-bin/cgiemail/mail.txt. Please understand that cgiemail will NOT be in your cgi-bin directory. We store it in the main cgi-bin directory of each machine. The instructions given will allow you to use it without copying it to your cgi-bin directory. Instructions are located at : CgiEmail Page. Cgiemail was developed at MIT and is copyright 1994, 1995. 2.5) Imagemaps 'Imagemap' refers to an interaction between a user's browser and the WWW server which allows clicking on an image to select hyperlinks. (Other implementations have a seperate /cgi-bin/imagemap program. Our server handles them internally. Use the reference style shown below, not one like /cgi-bin/imagemap/mymap.map.) Each designated portion of the image may select different links. Images that are to be used as imagemaps must be designated as "ISMAP". A companion .map file specifies the coordinates of the portions of the image that are hyperlinks, and the URL or local reference of the link. The extension .map is special; so be sure that's what your map description files end in. The .map file is a text file, so be sure to upload it in ASCII (text) mode. The following HTML: <A HREF="name-of-map-spec-file.map"> tell the browser that "name-of-image.gif" is to be displayed and used as an imagemap. The "name-of-map-spec-file.map" file contains the coordinates of the clickable areas in the image and specify the hyperlinks associated with each clickable area. The map specification file MUST have extension ".map". While this example assumes the file is located in your 'www' directory, it may be located anywhere under the 'www' directory. In such a case, the path from the www directory must be specified. If you put it in /home/your-id/www/map-directory, then use <A HREF="../map-directory/name-of-map-spec-file.map"> Please use the NCSA format for your .map file. A file named 'imagemap.conf' does NOT have to be edited when using our imagemap program. That complication has been removed from our version of imagemap. Here is a sample file named fo-abc.map: default http://your-domain.com/weblinks.html Note that the URL's are full URLs. You can't use relative URLs. The number pairs specify the X-Y coordinates in pixels of the points of the three hexagons that are the clickable areas in fo-abc.map. Clicks outside of the areas specified get the default link. 2.5.1) Imagemap issues "Hey! my imagemaps don't work!" This is a proper imagemap reference: <a href="djonly.map"><img src="djonly.gif" ISMAP> </A> Possible mistakes:
Here is index.cgi, which you would use to update a counter on your home page. Put this file in your main web directory; you don't need to put it in a special cgi-bin directory. It must, however, be called index.cgi to have the desired effect. If you are shift-clicking on the link to download the file to your machine, rename it in the dialog box your browser should present to you. If your primary audience is not North America, you may prefer to retrieve a European version of index.cgi, with commas and periods reversed. (Aside from a comment, the change is just two characters, BTW.) WARNING: Upload this file by using rz -a with telnet or in ASCII mode if you are using ftp. Otherwise you may run into unusual problems. NOTE: Because it is a program, the file must be executable to work. If you are telnetting in, use chmod +x index.cgi to make it so. If you wish to only use FTP, you'll have to type chmod 755 index.cgi after uploading it to have the same effect. After activating index.cgi as explained in the previous paragraph, create a file named .count with one line that contains the number 0. Then type chmod o+w .count to allow the counter to be updated. (chmod 666 .count if you're stuck with FTP.) The counter and index.cgi are in your main page in this example. When http://your-domain.com is referenced at the browser, instead of delivering the file index.html as normally expected, the program index.cgi is run instead. index.cgi reads the .count file, increments the number in that file by one, and writes the file back on disk. Then it reads in the index.html file, finds the string "#COUNT" imbedded somewhere in it, changes "#COUNT" to 1 + whatever value if found in .count, and sends the modified index.html to the browser. 2.7)Count.cgi - graphical counter/date software Here's how to call Count.cgi : <img src="/cgi-bin/Count.cgi?ft=9|dd=A|df=domain.dat"> Count.cgi has many options, the required ones are 'ft','dd' and 'df'. Here is a full list of options for Count.cgi : ft=9 ft means frame thickness. If you want to wrap the counter with a ornamental frame, you define the frame thickness like this. Here 9 is the thickness of the frame in pixel. This value can be any positive number more than 1. For nice 3D effect, use a number more than 5. If you do not want frame, just use ft=0. dd=A dd means digit directory. The 'A' tells the script which style to use. df=mydir/domain.dat df means data file. This file keeps track of the vistors. It also includes the IP address of the last visitor, this is to avoid that the same person gets counted as two visitors. If you wish to use Count.cgi, let us know which domain name you intend to use it on and the correct .dat file will be created for you. frgb=70;12;18 frgb allows you to customize the color of the frame. In this example, 70 is the red value, 12 the green and 18 the red. Each value is separated by a ';'. Think of it as defining colors in .html but in decimals (color=#447788). tr=0 If 'tr=1' is defined, it means that you want transparancy for the counter image. 'trgb' is used to define the transparant color. trgb=0;0;0 if 'tr=1' is set, the color defined in tfgb becomes transparent. In this case the transparant color would be black. md=6 md defines the maximum number of digits to display. The range is 5 to 10. If your counter number is less than md, the left digits will be padded with zeros. Here md=6 means, display the counter with maximum 6 digits. If you do not want to left pad with zeros, use pad=0 instead of md=6. Note you can either use md=some_number or pad=0, in this field, you can not use both. sh=1 If sh=0, then no digit image will be displayed. A transparent 1x1 transparent GIF image will be returned. It will seem as if nothing is displayed, but the counter will be incremented. To use Count.cgi to display the date : <img src="/cgi-bin/Count.cgi?display=date"> 2.8) SSI The 'SS' stands for Server-side and the 'I' stands for whatever your consultant tells you. 'Includes' and 'interface' are both popular. (SPML -- Server Parsed Markup Language -- is also used to refer to the code you write. Really, you can learn the entire small command set SSI provides before you learn the acronyms.) Basically, SSI is a mechanism whereby you can have our server do something to your HTML before sending it to the browser. SSI does some of the same things CGI does. Some differences are that SSI doesn't handle forms but CGI is much more involved if you just want another file or the output of a program included in your document. To have a document parsed for SSI directives, give it the extension .shtml instead of .html. You could also make it executable if changing the filename is too much trouble. (chmod +x file.html) Formal documentation is available from within the Apache manual. The following example should show you what sorts of things are possible: <html>
|