WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's...

20
WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the web server to generate dynamic web pages. (http://en.wikipedia.org/wiki/Server-side_scripting)

Transcript of WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's...

Page 1: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

WHAT IS SERVER SIDE SCRIPTING?Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the web server to generate dynamic web pages.(http://en.wikipedia.org/wiki/Server-side_scripting)

Page 2: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

STATIC WEB PAGESThe server contains .HTML files

These are served to the client browser on request

The local browser may have some interaction via client-side scripting (JavaScript)

The HTML pages are fixed and cannot be altered to match individuals requests

HTML pages are generated when they are requested

The basic page is done in a scripting language and uses HTML and CSS to determine static content and appearance

The variable data is generated by scripts (an interpreted program) running on the web server

DYNAMIC PAGES

Page 3: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

DYNAMIC MODEL

List generated by scripts

Clicking here will run a script using the new

parameters to generate a new list

Clicking here will run a script to add the

product to a basket and update the basket

status on this page

Page 4: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

USESIt is used to create dynamic web pages

Unlike client side scripting, the code is secure as it cannot be viewed on the client• Updating databases

• Interacting with forums

• Gathering user statistics

• Managing profiles

• Blogging

• Sharing (upload to Web 2.0 applications)

Page 5: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

Client-side Server-side

HOW DOES IT WORK?

User visits a website

Request recieved by web server

Server scripts (e.g. PHP) are processed

Web page (now HTML) sent to client (user)

Web page displayed on your screen (any client side scripts, e.g. JavaScript, can be processed here)

Interpretter – script output to HTML

Page 6: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

ASPActive Server Pages (ASP) 

a server-side scripting environment from Microsoft

Uses a file extension of .asp.

Scripts are usually written in VBScript

ASP will normally run only on Microsoft servers

COLDFUSION MARKUP LANGUAGE - CFMLA scripting language originally introduced by Adobe Systems in 1995

Enables web developers to embed database commands and other server-side scripting elements within standard HTML or XHTML

Pages in a ColdFusion web application are pre-processed by the ColdFusion Application Server when requested by a client browser

Page 7: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

JAVASERVER PAGES (JSP)A Java technology similar to ASP

Used to create dynamically generated web pages by embedding Java programming code in HTML or XHTML documents

A JavaServerPage is compiled into a Java servlet by an application server, rather than being interpreted

(a servlet is a Java program that executes on the server to create dynamic web pages).

PERLA high-level, interpreted programming language

a procedural programming language loosely based on C

Used for the creation of web applications, especially those where database access is required.

Perl is free software

Page 8: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

ASP.NET

a widely-used scripting language

PHP is free software released

PHP code can be embedded into HTML or XHTML documents

It is executed on the server to generate dynamic web content.

PHP is frequently used together with MySQL database language

Uses the Apache web server

The successor to Microsoft's ASP

Allows programmers to create web applications using any scripting or programming language supported by the .NET Framework.

The main building blocks are pages known as web forms, which contain definitions for server-side Web Controls and User Controls,

Web forms have the file extension .aspx

Uses the IIS Web Server

PHP

Page 9: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

RUBY ON RAILS• “Ruby on Rails is a breakthrough in lowering the barriers of entry to

programming.Powerful web applications that formerly might have taken weeks or monthsto develop can be produced in a matter of days.”-Tim O'Reilly, Founder of O'Reilly Media 

• “Web development that doesn’t hurtRuby on Rails® is an open-source web framework that’s optimizedfor programmer happiness and sustainable productivity, It lets youwrite beautiful code by favouring convention over configuration.”

http://rubyonrails.org/

Page 10: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

WHAT WE WILL USE FOR THIS UNIT

Web server scripts written in PHPDatabase commands written in SQL (structured query language)Client scripts written in JavaScriptApache Web server MySQL database managed with PHPMyAdminPHP interpreter add on to Apache

Page 11: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

COLLEGE SET UP

Each student login has

A folder for storing the web site MySQL PHP FTP access Apache HTTP and FTP access to a local web server (ictweb)

For the web server you can use WAMP

“WAMP” = Windows, Apache, MySQL and PHP

Other alternatives to WAMP include XAMPP

Page 12: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

TOOLS

Your choice of browser

Firefox, Chrome, Internet Explorer, Safari, OperaContextual editors

Notepad++ ConTEXT Dreamweaver (use source code editor) GEDIT (Linux)

FTP Clients

Filezilla, CoreFTP, Dreamweaver (built in client FTP) Windows File Explorer

Page 13: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

A SIMPLE PHP SCRIPT<html>

<head>

<title>Today’s Date</title>

<meta http-equiv="content-type“

content="text/html; charset=utf-8"/>

</head>

<body>

<p>Today’s date (according to this web server) is

<?php

echo date('l, F dS Y.');

?>

</p>

</body>

</html>

<?PHP is the opening tag(?> is the closing tag)

Using the PHP date function to get the date set on the server and echo it to the screen

Page 14: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

Practicalities

• Use an FTP client to create a subdirectory on your student account (this can also be done in Dreamweaver)

• Use a contextual editor (e.g. Notepad++ or Dreamweaver) to create the file we just used and save it with a file type of .php (e.g. date.php) in the subdirectory

• Access it using your browser, use the following URL• http://ictweb/ (locate your folder and work)

• Make sure it works

Page 15: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

RESULTS

PHP in editor, PHP viewable

Web page opened in Firefox, and right-clicked to view source

Page 16: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

CLIENT SIDE AND SERVER SIDEClient side

• Reduces web traffic as processing done on client• Good for

• Form validation• User aids (drop downs, hover etc)• Local navigation

Server side• Can use centralised server resources eg databases• No client plug-ins required, runs in any browser• No load on client, can use powerful server hardware• Applications do not need distributing

Page 17: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

COMBINED USEBuild efficient applications

Choose to do the processing in the most appropriate location

Choose where to keep up to date multi use data

Choose how to optimise the user experience:

• Performance• Appearance• Function

Page 18: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

SUMMARY: WEB SERVER SCRIPTINGADVANTAGES

Processed (interpreted) on web server (server side) therefore less demand on the client side.

Code is more secure (run on server not the client)

Page content can be live and changeable

DISADVANTAGES

Web pages can be slower to display as scripts have to be processed on the server first

Requires a web server to be installed and configured, in order to run scripts such as PHP

Few debugging tools, design interfaces are not user friendly

Page 19: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

ACTIVITYSet up a new site in Dreamweaver (e.g. name: php). Locate your folder structure on the ICTWEB server, e.g.

The new site window (Dreamweaver):

Local folder

Server folder

Page 20: WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.

ACTIVITY (CONTINUED)Using the exercise sheet follow the examples and create your own:

• Create 5 examples of using the echo() statement

• Embed PHP code into HTML

• Save a web page as a PHP file

• Right click a web page and view source, comparing with PHP