w-b pt2 v2 Flashcards
What do CGI-enabled web servers allow you to do?
Execute programs identified in GET/POST request
- As well as still return static HTML files
How does the webs erver know whether to return the identified resource or execute it?
This can be done by looking at the suffix specificied in the URI
GET f.html HTTP/1.0 vs GET/cgi-bin/f.pl HTTP/1.0
Draw a diagram of how a normal GET request is processed and how a CGI GET request is processed
What are two techniques we can use to create dynamic HTML via server-side scripts?
We can simple use script langiuage ‘print’ type statements
Or we can instead chose to embed script calls directly within the static HTML
- where the calls are replaced by the dynamic HTML the corresponding scrips generate during server processing
What are SSIs?
Server-Side Include (SSI)
An early adopter of the idea of including directive in the static HTML files.
- these directive execute other pgorams or include data from environment variables.
This technique can be useful for including “boilerplate” text/html in many HTTP repsonses:
- company logos, etc
Example
- <!--#include file="trailer.html"-->
- ## Welcome to server: <!--#echo var="SERVER_NAME"-->
or to invoke external commands on the server directly
- <!--#exec cmd="/bin/who"-->
Regardless of the server-side scripting tech we use, a basic web application is usually structuure in what way
There is a landing page, where users initially access/find the application
- This will commonly do some sort of authentication and then provide a number of options for different sorts of processing
- Each processing option will have it’s own pages
—using other form sto get required data
What are the details of PHP?
- PHP is weakly typed
- variables begin with $
- Supports normal & associative arrays and RegExps
- Procedural and OO
In PHP how do you access the following form data:
- POST/GET
- Server information
- environment information
- Sesession data