Sample CGI Scripts

Note these scripts are old basic perl scripts as examples. They may have security issues, and hence may not work on some servers. See the help file for the information you need to write you own, or just use Crossword Compiler's Web Publish button (hosting on where everything is automated for you.

This is an advanced topic and you will need access to a web server with CGI enabled to make use of these scripts. The scripts are supplied AS IS, and I take no responsibility for anything that happens as a result of you using them.

Download the files
(This is a ZIP file containing all the sample scripts and the sample HTML template, see below.)

You can see a sample crossword using these scripts. A brief explanation of how to use them for yourself is given below. When uploading .pl files to your server make sure you upload in ASCII mode, and set the files to be executable. All files need to reside on the same web server, easiest if they are all in the same folder (but some web sites only allow perl scripts in your cgi-bin folder). You may wish to write your own scripts to implement these features in other ways, for example using server-side includes, using cookies, or feeding results into a database.

Submit Script

This sample sends results submitted from a crossword to you by e-mail. It assumes you have installed the FormMail script, freely available from Matt's Script Archive and already installed on many web servers.

You need to modify the script in the download: change "myname\" to the address you want submitted results sent to (don't forget the "\" before the @ sign). You may also need to edit the script for the location of (give the full URL on your server) and possibly the location of perl on your server. Make sure FormMail is configured to allow emails to the address you specify (it has anti-spam measures).

You need to set the location of the script in Crossword Compiler: set the "Submit URL" setting in the Applet options (under File, Web page export, Interactive crossword, Applet options, URLs) to the name of the script on your server, with "%SUBMIT%" as a placeholder where you want the submit information to be. In this case something like

Then just use Web Page Export to export your interactive puzzle, including the "Submit" button option.

If you don't want to submit the answer by e-mail, but mark the answers automatically online, you can use the "Mark Answers" HTML template supplied with Crossword Compiler which will export a puzzle set-up correctly to do that.

Save Scripts

For security reasons applets cannot save data directly to the user's hard disk. You therefore need to install two scripts, one to generate a file for the user to save, and one to show the puzzle when the user clicks on the link in the saved file. You also need to put a placeholder in the HTML file for the saved information.

In the puzzle HTML file put a "<!--[CCPROGRESS]-->" placeholder between the APPLET tags. There's a sample HTML template that you can install to generate the HTML file automatically (save the HTML file to your "Crossword Compiler/Templates/Java" folder, then select the template when you export).

Set the "Save URL" in the Applet options (under File, Web page export, Interactive crossword, Applet options, URLs) in Crossword Compiler to the location of the script, plus a question mark, plus the location of, plus a question mark, plus the name of the puzzle HTML file plus another question mark, plus the "%PROGRESS%" placeholder. The location of should be a full URL. The puzzle HTML file must be a file name local to the script. For example, if you have and in your cgi-bin folder, and a crossword page called "MyPuz.html" in your "Puzzles" folder, all on, it would be
(all on one line)

If you can run scripts from folders other than cgi-bin, everything can be in the same folder, like in the sample crossword. In this example everything is in the "users/appletdemo" folder, and the Save URL is

Back to Top