• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month
Page
  1. 1
    1
  2. 2
    2
  3. 3
    3
  4. 4
    4
  5. 5
    5
  6. 6
    6
  7. 7
    7
  8. 8
    8
  9. 9
    9
  10. 10
    10
  11. 11
    11
  12. 12
    12
  13. 13
    13
  14. 14
    14
  15. 15
    15
  16. 16
    16
  17. 17
    17
  18. 18
    18
  19. 19
    19
  20. 20
    20

3ISE517 Internet Application Programming - CGI

Extracts from this document...

Introduction

Coursework for:

Internet Application Programming

3ISE517

MalN

2007xxx

CONTENTS

        PageNo

Introduction        3                

Basic HTTP Requests        5

Using the Common Gateway Interface        

        Basic Overview of the use of CGI        6

        Explanation of how CGI is used        7

References        9

Appendix A:

        Program listing of HTML Form        12

        Program listing of CGI Script        14        

Appendix B:

        Screenshots of validation performed by CGI Script        16

Appendix C:

        Additional Features         18

Introduction

        Every time we request a web page on our browser, the browser would have created a connection with a web server, sent a request and received the required page before displaying it on our screens. A basic representation of such a request in shown in the diagram below:

image00.png

[Reference: http://computer.howstuffworks.com/web-server1.htm, 23/11/08]

        Generally pages requested by web browsers are static web pages which would be held in the web server’s local repository.  All the web server has to do is, locate the requested web page and return it to the browser. What one means by a static web page is that its content does not change until its owner modifies it.

        But some applications or scenarios require information not from pages that have been pre-written but from pages that are generated based on user input. For example, when searching for an article on the web, the results are generated based on the search words entered by the user. Such web pages are known to be generated dynamically.

...read more.

Middle

http://computer.howstuffworks.com/cgi2.htm

How CGI Scripting Works - Forms: Sending Input

http://computer.howstuffworks.com/cgi4.htm

How CGI Scripting Works - Summary

http://computer.howstuffworks.com/cgi7.htm

Common Gateway Interface

http://hoohoo.ncsa.uiuc.edu/cgi/intro.html

The Client-Server Architecture

http://www.webdevelopersnotes.com/basics/client_server_architecture.php3

Web and Database Integrating Using CGI

http://www.ncsi.iisc.ernet.in/raja/netlis/wise/cgi/webcgi.htm

CGI

http://www.webopedia.com/TERM/C/CGI.html

How CGI Scripting Works - The CGI Mechanism

http://computer.howstuffworks.com/cgi2.htm

Web Server

http://www.webopedia.com/TERM/W/Web_server.html

APPENDIX

APPENDIX A:

        Program listings of Form.html

<!--

Written by : Malshani Nanayakkara

StudentID: 2007020

-->

<html>

<head><title>HTML Form</title></head>

<body bgcolor="#ADDFFF">

        <font color="blue">

        <h2><center>Welcome to</center></h2>

        <h2><center>Online Surveys</center></h2>

        <p align=center><b>Hi, we are conducting a survey to see which is currently the popular drink in the country.<br/>

        If you are between the ages of 14 and 50, we kindly request just a minute of your time to fill out the form below.</b></p></font>

        <br />

        <form method=POST ACTION="http://localhost/cgi-bin/mycgi.pl">

...read more.

Conclusion

image03.png

image04.png

- reads from the text file and displays survey results

Using this text file, the survey results can be viewed:

image05.png

The page that mycgi,pl returns, contains a button which runs another script which will read the file and display the survey results.

And a page like the one below will be generated:

image06.png

 A program listing for the survey.pl file is given below:

Program listing of survey.pl

#!C:/Perl/bin/perl.exe

use CGI qw(:standard);

print "Content-type: text/html\n\n";

print "<html><head><title>CGI Scripting Results</title></head>";

print "<body bgcolor=\"#ADDFFF\"><font color=\"blue\"><br/>";

open(INFILE, 'survey_results.txt');

@drinks=("Soda", "Pepsi", "Sprite", "Fanta", "Ginger Beer", "Cream Soda", "Portello", "Coca-Cola", "Fruit Juices", "Water");

@drinks_score=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

while ($line=<INFILE>)        #reads file line by line

{

        ($name, $age, $email, $survey) = split(/\t/, $line);        #seperates each line into seperate data

        $survey =~s/\+/ /;        #if the drink has two words, the '+' sign will be replaced by a space

        $i=0;

        while ($i<10)

        {

                if($survey=~/$drinks[$i]/)

                {        $drinks_score[$i]++;        }                #the line is compared with an array containing all the drinks

                $i++;

        }

}

print "<br/><font size=\"+1\"><b> Survey Results:</b></font><br/><br/>";

$i=0;

while ($i<10)

{

        print "<b> $drinks[$i]</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$drinks_score[$i]";

        print "<br/>";

        $i++;

}

print "</body></html>";

...read more.

This student written piece of work is one of many that can be found in our University Degree Software Engineering section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related University Degree Software Engineering essays

  1. Programming Concepts. Andora Video is a small shop selling videos. The owner, Raul, wishes ...

    subtotal for a video title double vdSubtotalAll Holds calculated subtotal for all video titles double dSubtotal Holds calculated subtotal of all the videos after relevant discount has been taken off double discount Holds the relevant discount depending upon the whole video quantity order double total Holds calculated total of whole

  2. MS Office solutions. Fantasy mobiles require: ...

    2.4 Functional Testing Test No. Test Details Expected Result Actual Result 1. Click 'Show' Button Clicking of the 'Show' button should display all the model numbers in the list box Pass 2. Select item in list box The item within the list box should now display within the 'Model' textbox Pass 3.

  1. Rich Internet Applications

    'Unlike traditional applications software installation is not required' [http: 1]. Depending on the machine that is being used to view the RIA however might need Activex, Flash, Java or a similar plug-in installed. There are many different types of RIA development packages available.

  2. 3SFE504 - Object Oriented Programming - Linear and Independent Hash Table code

    { dic=dic-TABLE_SIZE; } if(dictionary[dic].word==word) { dictionary[dic].word=word; dictionary[dic].defList.insertAtHead(def); t++; } }while(dictionary[dic].word!="" && main!=dic); if(t==0) { dictionary[dic].word=word; dictionary[dic].defList.insertAtHead(def); } } } List LinHTable::get(string w) { int key=HashVal(w); while(dictionary[key].word!=w) { key++;// key is represents increment to be used . } return dictionary[key].defList; } void LinHTable::traverse()

  1. Complete Section 2 of 3

    Now, 32768 processes might sound like a lot, but for an enterprise-wide Linux server with a database and many connections from a LAN or the Internet, it is a very reasonable number. Database & structures There are options when we consider Linux databases.

  2. Complete Section 3 of 3

    The number of each type of training session is determined, based on the number of personnel to be trained and the desirable size of each session. A schedule for performing the training is worked out, according to the availability of the participants, the instructors and the training facilities.

  1. Evaluating Websites Usability - comparing 5 websites.

    There is no buy function; I gather that an email has to be sent to show interest in a certain book. Other Useful Information: 1. “”© Copyright of all poems remain with the poets.” & “© Photos of Leeds courtesy of Leeds Library and Information Service” is the only useful information I can find on this website.

  2. Abstract This report is dedicated to demonstrating and critically reviewing new features and developments ...

    Center, Problem Reports and Solutions, Windows Defender, Windows Update, Network Access Protection, Backup and Restore, User Account Control, and more. So instead of a bunch of different parts of the system trying to alert you in their own unique ways, messages will all come from the same place, and be made available via the new Action Center tray icon [10].

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work