CGI Scripts

Free Guestbook Script

If you've ever wanted to add a guest book to your web site you can thank the well-recognized Matt Wright for writing a wonderful Perl script and making it readily available via the web.

To install the Guestbook script:
  1. Locate and download the following files from Matt's Script Archive:

    • guestbook.pl - The Perl script which adds to the guestbook.html .
    • addguest.html - The form that users fill out to add their entry.
    • guestbook.html - The guestbook file that contained the users' entries.
    • guestlog.html - The short log of all guestbook entries. (optional)

  2. Create a subdirectory named "guestbook" within your web site and upload
    both guestbook.html and guestlog.html to the new director
  3. Delete the first line of the Perl script: #!/usr/local/bin/perl
  4. There are a few more things that need to be changed in the Perl script:

    # Set Variables

    $guestbookurl - The URL address of your guestbook.html file
    $guestbookreal - The system location of your guestbook.html file
    $guestlog - The system location of your guestlog.html file
    $cgiurl - The URL portion of the address to the guestbook.pl file


    The second and third variables call for a system path which is not the same as a URL. If your domain name was yourdomain.com the system path would be /wwwroot/yourname where "yourname" is the account userid. As such, the Set Variables section of the Guestbook script would follow this format:

    # Set Variables

    $guestbookurl = "http://www.yourdomain.com/guestbook/guestbook.html";
    $guestbookreal = "/wwwroot/your_userid/guestbook/guestbook.html";
    $guestlog = "/wwwroot/your_userid/guestbook/guestlog.html";
    $cgiurl = "http://www.yourdomain.com/cgi-local/guestbook.pl";


    Be sure to substitute your domain name and userid in the example above. The path to "date" is properly set. Although Matt's code is accurate, we recommend using the Perl Script checker within your account Control Panel when installing any Perl script.

  5. Upload the "guestbook.pl" script to your cgi-local directory in ASCII transfer mode. Cgi-local will place the appropriate permissions on files uploaded to this directory so you do NOT need to chmod a+rx the Perl script.
  6. Modify the form ACTION attribute within "addguest.html" to reference the guestbook script within cgi-local as shown below and upload to the "guestbook" directory
You can test the script by referencing either the addguest.html or guestbook.html file via the web.

Special Notes
  • Do NOT remove the tag with guestbook.html .
    This tells the Perl script where to insert new entries

  • Some possible causes of a SERVER ERROR:

      - Set Variables section within Perl script inaccurate
      - Perl script was not uploaded in ASCII transfer mode
      - Public-write permission not set for guestbook.html (see #7 above)

  • The reference to both the date and sendmail program are correct

  • You can modify the addguest.html and guestbook.html files to meet your own design standards

Few Options
  • Set the $separator variable to display either a horizontal line
    or insert a paragraph tag between guest book entries
  • Set the $allow-html variable to allow visitors to use HTML tags within their entries


[back]



Free WWWBoard Script

WWWBoard is an interactive message board which can allow visitors to read, post, and respond to messages in an interactive newsgroup type format. The site webmaster will have password protected access to an administrative interface to maintain board content. WWWBoard Installation Notes

The instruction contained herein is being provided for those whom wish to modify the scripts installed by the WWWBoard Installer or to install multiple versions of this application.

  1. Locate and download the following files from Matt's Script Archive:

    • wwwboard.pl - The main WWWBoard Perl script.
    • wwwadmin.pl - Admin tool to keep board content under control.
    • wwwboard.html - The web page containing message board and posting form.
    • data.txt - The data file contains an incremented log of numbers for messages.
    • passwd.txt - File containing password for wwwadmin.pl.

  2. Delete the first line of each Perl script: #!/usr/local/bin/perl
  3. There are a few more things that need to be changed in each Perl script:

    # Define Variables (wwwboard.pl)

    $basedir - The system location of your WWWBoard directory
    $baseurl - The URL to the WWWBoard directory
    $cgi_url - The URL to the WWWBoard script

    The first variable calls for a system path which is not the same as a URL. If your domain name was yourdomain.com the system path would be /wwwroot/yourdo where "yourdo" is the account userid. As such, the Define Variables section of the wwwboard script would follow this format:

    # Define Variables (wwwboard.pl)

    $basedir - "/wwwroot/your_userid/wwwboard";
    $baseurl - "http://www.yourdomain.com/wwwboard";
    $cgi_url - "http://www.yourdomain.com/cgi-local/wwwboard.pl";
    Be sure to substitute your domain name and userid in the example above.

  4. The Define Variables section of the wwwadmin script must also be set. Note the only difference is that the $cgi_url variable reflects the URL to the wwwadmin script instead.

    # Define Variables (wwwadmin.pl)

    $basedir - "/wwwroot/userid/wwwboard";
    $baseurl - "http://www.yourdomain.com/wwwboard";
    $cgi_url - "http://www.yourdomain.com/cgi-local/wwwadmin.pl";

  5. Upload the "wwwboard.pl" and "wwwadmin.pl" scripts to your cgi-local directory in ASCII transfer mode. Cgi-local will place the appropriate permissions on files uploaded to this directory so you do NOT need to chmod 755 either Perl script.
  6. Modify the form ACTION attribute within "wwwboard.html" to reference the wwwboard script within cgi-local as shown below and upload to your root ("home") directory.
  7. Create a subdirectory named "wwwboard" off the root directory of your web site and upload "wwwboard.html", "data.txt", and "passwd.txt" to the this directory in ASCII transfer mode.
  8. Create a directory named "messages" under the newly made directory "wwwboard".
    ( e.g. /wwwboard/messages )
  9. Next, click the directory name to display files within the wwwboard directory. Set public write access for both the wwwboard.html and data.txt files as well as the messages directory. This will allow the Perl script to append data to both wwwboard.html file and data file.


[back]



FREE Random Link Generator

If you've got a multitude of links and not enough space to display them all, how about using Matt's Random Link generator to mix it up a bit? This script randomly selects a URL from a database file within your web site and displays the URL link from your web page. Each time your web page loads a different link appears.

Installation Procedure

  1. Locate and download the following files from Matt's Script Archive:

    rand_link.pl - The Perl script which generates the random link.

  2. Delete the first line of the Perl script: #!/usr/local/bin/perl

  3. There are a few more things that need to be changed in the Perl script:



    # Define Variables

    $linkfile = The system path to the database containing the URLs. The system path is not the same as a URL. If your domain name was yourdomain.com the system path would be /wwwroot/yourdo where "yourdo" is the account userID. As such, the Define Variables section of the Links script would follow this format:

    # Set Variables

    $linkfile = "/wwwroot/userid/database.txt";

    Be sure to substitute your domain name and userID in the example above. Although Matt's code is accurate, we recommend using the Perl Script Checker within your account Control Panel when installing any Perl script.

  4. Upload the "rand_link.pl" script to your cgi-local directory in ASCII transfer mode. Cgi-local will place the appropriate permissions on files uploaded to this directory so you do NOT need to chmod 755 the Perl script.

  5. Create the database.txt file which contains the URL links and upload it to your root ("home") directory in ASCII transfer mode. Make one column of URLs and be sure to use absolute paths (e.g. http://www.randomsite.com). If desired, this script can be used in conjunction with the database file maintained by Matt's Free For All Link script.

    Here is a sample database.txt file:

      http://www.cnn.com
      http://www.news.com
      http://www.cnet.com
      http://www.yahoo.com
      http://www.lycos.com
      http://www.webcrawler.com
To test the script, add the following tags to your HTML document:

<a href="/cgi-local/rand_link.pl">Random Link</a>

Special Notes

  • Some possible causes of a SERVER ERROR:

      - Set Variables section within Perl script inaccurate
      - Perl script was not uploaded in ASCII transfer mode


[back]