1 Server Side Includes and cgi scripts Advanced Web Programming.

Slides:



Advertisements
Similar presentations
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advertisements

1. XP 2 * The Web is a collection of files that reside on computers, called Web servers. * Web servers are connected to each other through the Internet.
PHP Form and File Handling
© 2002 D & D Enterprises 1 Linking Images For Navigation & Clickable Image Maps.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 The Web Wizards Guide to PHP by David Lash.
Advanced Piloting Cruise Plot.
Copyright © 2003 Pearson Education, Inc. Slide 6b-1 The Web Wizards Guide to PHP by David Lash.
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 2 Getting Started.
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 1 Introduction to Perl and CGI.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Using Perl for CGI Programming.
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
Chapter 1 Image Slides Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
XP New Perspectives on Microsoft Office Word 2003 Tutorial 7 1 Microsoft Office Word 2003 Tutorial 7 – Collaborating With Others and Creating Web Pages.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
Determine Eligibility Chapter 4. Determine Eligibility 4-2 Objectives Search for Customer on database Enter application signed date and eligibility determination.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
ZMQS ZMQS
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
4. Internet Programming ENG224 INFORMATION TECHNOLOGY – Part I
Richmond House, Liverpool (1) 26 th January 2004.
ABC Technology Project
Tables Tables provide a means of organising the layout of data
Creating Tables in a Web Site
Vanderbilt Business Objects Users Group 1 Reporting Techniques & Formatting Beginning & Advanced.
Social Web Design 1 Darby Chang Social Web Design.
Molecular Biomedical Informatics Web Programming 1.
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
VOORBLAD.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
Basic HTML Workshop LIS Web Team Spring 2007.
Server-side includes Library and Information Services University of St Andrews.
CS 22: Enhanced Web Site Design - Week 8Slide 1 of 15 Enhanced Web Site Design Stanford University Continuing Studies CS 22 Mark Branom
©2007 First Wave Consulting, LLC A better way to do business. Period This is definitely NOT your father’s standard operating procedure.
BIOLOGY AUGUST 2013 OPENING ASSIGNMENTS. AUGUST 7, 2013  Question goes here!
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Squares and Square Root WALK. Solve each problem REVIEW:
© 2012 National Heart Foundation of Australia. Slide 2.
Services Course Windows Live SkyDrive Participant Guide.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
Addition 1’s to 20.
25 seconds left…...
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Januar MDMDFSSMDMDFSSS
REGISTRATION OF STUDENTS Master Settings STUDENT INFORMATION PRABANDHAK DEFINE FEE STRUCTURE FEE COLLECTION Attendance Management REPORTS Architecture.
Week 1.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
12 January 2009SDS batch generation, distribution and web interface 1 ExESS IT tool for SDS batch generation, distribution and web interface ExESS IT tool.
1 Unit 1 Kinematics Chapter 1 Day
PSSA Preparation.
CHAPTER 11 FILE INPUT & OUTPUT Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
1 Abstract Class and Packages from Chapter 9 Lecture.
Use the buttons on the top to navigate through the presentation 1 PrevNext Menu.
HTML Concepts and Techniques Fourth Edition Project 2 Creating and Editing a Web Page.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Presentation transcript:

1 Server Side Includes and cgi scripts Advanced Web Programming

2 Server Side Includes SSI Use to add text or html to a page from another file Format of SSI: Note that extension of a page that uses SSI must be.shtml on arnor. Note: no spaces between <!– and # Closing bracket must be preceded by two dashes: -->

3 Server Side Includes SSI If a page that is included itself uses SSI (to display a date in a footer for example) the extension of that page must be.shtml on icsun.

4 SSI commands include include another file in this file echo print an environmental variable exec place the output of a program in an html page

5 More SSI commands fsize output the size of a file config change the SSI error message, formatting time and file size information flastmod displaying the last time a file was modified.

6 include Use the file parameter if the file is in the same directory Use the virtual parameter if the file is in a different directory

7 Environmental Variables Variables that are maintained by the OS SSI can output any CGI environmental variable SSI can output 6 environmental variables specific to SSI

8 SSI environmental variables DATE_GMT: holds date and time in GMT DATE_LOCAL: holds date and time in local time zone DOCUMENT_NAME: holds the current filename DOCUMENT_URI: holds path of file from server root to filename LAST_MODIFIED: holds last modification date and time for current file QUERY_STRING_UNESCAPED: holds unaltered query string with all shell metacharacters escaped with a "\".

9 echo echo command used to output CGI environmental variables and SSI var

10 echo To create a back button, use echo with the HTTP_REFERER environment variable ”>Back Button

11 config You can use config to change the appearance of time and date using the timefmt variable before calling the date.

12 config Other format codes see:

13 exec Exec command used to place the output of a program in an HTML page. –The program is usually a cgi program

14 Example This is an example of a SSI that works on arnor: The code (the included file is in the same directory): Test 3 …

15 Mailmerge.cgi Mailmerge is a program that –receives input from a web form, –Formats the input according to a template –Stores the input in a file

16 Mailmerge.cgi Files needed for mailmerge –The HTML form –Mailmerge.cgi –A template file –A results file

17 Mailmerge.cgi exForm.html internet Web Server Mailmerge.cgi exSurvey.template exSurvey.html Info sent to web server web server starts mailmerge and gives it info mailmerge looks at template file to format info mailmerge formats info and stores in results.txt

18 Mailmerge Step 1 Procedure for storing a form on a student account on arnor –Create the html form, for example exForm.html In form tag, the action attribute must be action = "/cgi-bin/mailmerge.cgi/home/xxx/public_html/exSurvey.template” Note that this path wll be different if you put your form.html file in a directory (like ProbSet3). For every directory you go into, you must add another../ to the path! The same holds true here. If you put your survey.template file into a directory, you must add the directory name after the xxx in the path: cgi/home/xxx/public_html/exSurvey.template

19 Mailmerge Step 2 Procedure for storing a form on a student account on arnor –Create the template, for example exSurvey.template Can be in any directory and have any name, but the action attribute of the form tag in the exForm.html file must point to it.

20 Mailmerge ACTION=File:/~barr/exSurvey.html REQUIRED= name,year,major OUTPUT_FORM= Survey Results from Year: Major: Interests: Other information Something interesting about me: Prefered address:: ************************************************** Path to file where results will be appended Form elements that are required surround the name of a piece of data as given in the form.html file. The name will be substituted by the value of the name. Any other text will appear in the file exactly as shown in the template file. You can even put in html tags.

21 Mailmerge Step 3 Procedure for storing a form on a student account on arnor –Create the exSurvey.html file Can be in any directory, but the template must point to it. Must ensure that the file has write permissions

22 Mailmerge -rw-r--r-- 1 jbarr other 3670 Aug form.html -rw-r--r-- 1 jbarr other 1774 Oct form2.html -rw-r--r-- 1 jbarr other Jan hp_4.jpe -rw-r--r-- 1 jbarr other 214 Sep lab2.c -rw-r--r-- 1 jbarr other 124 Aug local.cshrc -rw-r--r-- 1 jbarr other 607 Aug local.login -rw-r--r-- 1 jbarr other 582 Aug local.profile -rwxr-xr-x 1 jbarr other Aug mailmerge.cgi -rw-rw-rw- 1 jbarr other 2573 Sep exSurvey.html drwxr-xr-x 2 jbarr other 512 Sep sbin -rw-r--rw- 1 jbarr other 661 Aug survey.template -rw-r--r-- 1 jbarr other 261 Sep testIn.c -rwxr--r-- 1 jbarr other 167 Sep testScript drwxr-xr-x 2 jbarr other 512 Mar 27 09:59 theLib -rwxr-xr-x 1 jbarr other 1844 Oct turnIn2 -rw-r--r-- 1 jbarr other 2972 Sep xTest.shtml Results.txt must have write permissions: At the command line type: chmod 666 exSurvey.html where exSurvey.html is the name of the file that you are using.