About this project
This project attempts to perform different CGI and dynamic web operations in a variety of languages. The languages are all configured to use CGI, so we can use Apache to serve them up without a lot of extra configuration.
The project does these functions and activities: HTML tables and forms, server directory and file access, and MySQL database access.
How to use it
To use the project, select a language or technology from the upper list, then select an activity or function from the lower list.
The databases are live, so any changes or additions you make will be visible to other users of the site.
Languages and Technologies
PHP can present the dynamic code inline with the regular HTML. The other languages must print out all the HTML as dynamic code, or else include it from template files.
Perl, Python, Ruby
These interpreted script langauges can be used for CGI by doing these steps:
- Specify the program that runs them on the first line: e.g. #!/usr/bin/perl
- Make the script file executable
- Modify the .htaccess file to allow the pertinent file extensions to run as CGI.
Ajax, JSON, and XML
The Ajax version transfers the entire HTML content of the "content" div on every page change.
The JSON version transfers only the data, which is assembled into HTML content by the client. The data transferred is smaller, but more work is done on the client.
The XML version transfers only the data, which is assembled into HTML content by the client. The XML data is larger than the JXON data.
C++ and Java
C++ and Java code must be compiled before use, instead of executing as a script.
In addition, Java code must be called from a wrapper script that invokes the Java interpreter, because Java does not compile to native code.
Functions and Activities
The project attempts to perform the following basic functions in each language:
- Draw a table that has dynamic data.
- Read a list of image files from a directory, and draw the images with captions.
- Read data from a file and draw it in an HTML table.
- Write data from an HTML form into the same table.
- Read data from a MySQL database and draw it in an HTML table.
- Write data from an HTML form into the same MySQL database.
This demonstrates the basic functions necessary for any web site:
- Arrays and loops
- Forms and form handling
- Files and file permissions
- Database and MySQL access
Servers and Installation
After copying the code to a new server, the following must usually be done:
- Install the MySQL tables using the scripts in the data directory. Some adjustments to the connect scripts may be necessary.
- Compile the C++ and Java code. Some adjustments to the make scripts for C++ and Java may be necessary.
- Determine if Ruby and C# (Mono) are installed on the server. (PHP, Perl, Python, g++, and javac are usually already installed.) Some adjustments to the warnings on the Ruby and Java pages may be necessary.
|PHP files (used for Ajax server also)||67|
|HTML and CSS files||26|
|Total code files||171|