Design Studio
Web Tools
  • FTPSync
  • SSB
  • Random
  • Links
     
    Z Cars Ring
    FTPSync
      


     
      Random  

    Download Random V1.0 (file: random.zip size: 1,255 bytes)

    Random CGI application is useful for banners, random images or random quotes. To use it first you need to compile source code. You can do this using following command under UNIX:

    cc random.c -o random.cgi

    Then you need to create data file (default name for it is random.dat). This file should start with contents type followed by number of choices and the list of alternative texts. Contents type can be text if alternatives are in the plain text format or html - if they are in HTML format. Contents type and number should be separated by single new line character and number and different choices in the list should be separated by double new line character. Here is a sample random.dat file for random images:

    html
    3

    <html><head><title>Front View of my Z car</title></head>
    <body><img src="images/z-front.jpg"></body></html>

    <html><head><title>Side View of my Z car</title></head>
    <body><img src="images/z-side.jpg"></body></html>

    <html><head><title>Back View of my Z car</title></head>
    <body><img src="images/z-back.jpg"></body></html>


    And another one for banners:

    plain
    2

    <a href="http://www.ZTurboRoadster.com">
    <img border=1 src="banners/z-turbo-roadster-com.gif"></a>

    <a href="http://www.ZCar.com">
    <img border=1 src="banners/zcar-com.gif"></a>


    Now you can either

  • add a link to random.cgi. Here is an example of HTML code:
    <a href="cgi-bin/random.cgi?images/random.dat">Clik here for random image</a>

  • or using Server Side Include (SSI) place random banner in your HTML page. Here is an example of HTML code:
    <!--#include virtual="cgi-bin/random.cgi?banners/random.dat"-->

    As you can notice from the examples above random.cgi takes data file name as a parameter. You can omit this parameter in which case random.dat will be used as a default.


    © 1999 dch@iname.com