Lecture Week 2
Lecture Week 2
content
The Request/Response
Procedure
The basic client/server
request/response sequence
• 1. You enter http://server.com into your browser’s address bar.
• 2. Your browser looks up the IP address for server.com.
• 3. Your browser issues a request to that address for the web
server’s home page.
• 4. The request crosses the Internet and arrives at the server.com
web server.
• 5. The web server, having received the request, fetches the home
page from its hard disk.
• 6. With the home page now in memory, the web server notices that
it is a file incorporating PHP scripting and passes the page to the
PHP interpreter.
Using PHP
• Early days of the Web, many sites used “flat” text files to
store data
• MySQL, being free to use and installed on vast numbers
of Internet web servers
• Structured Query Language
• Inserting and Looking up data
Using MySQL
• MySQL query such as
• SELECT surname,firstname FROM users WHERE
email='[email protected]';
• Using PHP, you can make all these calls directly to
MySQL
Using MySQL
• JavaScript, was created to enable scripting access to all
the elements of an HTML document
• Combined with CSS, JavaScript is the power behind
dynamic web pages that change in front of your eyes
rather than when a new page is returned by the server
• <script type="text/javascript”>document.write("Hello
World. Today is " + Date() );</script>
• Hello World. Today is Sun Jan 01 2012 14:14:00
Using JavaScript
• PHP, MySQL, and JavaScript: the web server.
• Apache also supports a huge range of modules of its own
• Rewrite module, which enables the web server to handle
a varying range of URL types and rewrite them to its own
internal requirements, and the Proxy module, which you
can use to serve up often-requested pages from a cache to
ease the load on the server
Ajax Process
• 5. The JavaScript then places an indication next to the
username input box to show whether the name is one available
to the user—perhaps a green checkmark or a red cross graphic,
along with some text.
• 6. If the username is not available and the user still submits the
form, the JavaScript interrupts the submission and
reemphasizes (perhaps with a larger graphic and/or an alert
box) that the user needs to choose another username.
• 7. Optionally, an improved version of this process could even
look at the username requested by the user and suggest an
alternative that is currently available.
Ajax Process