UNIT 3 - ⇑ Communication and Networking ⇑

← Wireless Networks Server-side scripting Internet Security →


Server-side scripting - The basis of dynamic web page content.

Common Gateway Interface (CGI) edit

   ---
 

Welcome

To this webpage


   ---
 

Bonjour

To this webpage


 
Extension: AJAX

AJAX is an acronym for Asynchronous JavaScript and XML, technologies that can be used on the client-side to create asynchronous web applications. With AJAX, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Examples of this might be receiving a new email in your web based mail client without having to refresh the page manually, another example is a breaking news article appearing on a news site without you having to refresh the page. Web 2.0 sites make heavy use of AJAX and data is usually retrieved using the XMLHttpRequest API.

 

You can learn more about how AJAX works over at w3schools.

Server-side scripts edit

A server-side script can make a webpage dynamic. This means that content is generated when the web browser request is received rather than being static and displaying one screen. The webpage can handle requests such as HTTP requests to do something useful with data that a user has inputted.

HTML edit

HTML stands for HyperText Markup Language and is a way of displaying a webpage on a browser by using tags to create objects on the screen. The objects on the webpage can be styled using Cascading Style Sheets or adding styles directly to a tag. The most recent version of HTML is HTML5 which is coupled with CSS3. The difference with HTML5 and HTML4 is that HTML5 has more tags that can create more complex objects like date pickers and placeholder text in input boxes. However not all web browsers support HTML5 and those that do, they don't support all of the new elements that are in HTML5. With HTML5 when you declare <!DOCTYPE> for the webpage to tell the web browser what you are using, you only have to write <!DOCTYPE html> rather than adding URLs to framesets in w3 or having to declare as PUBLIC. HTML5 has made life easier for web designers.

<html>
  <head>
    What goes on behind the scenes...
  </head>
  <body>
    What the web browser displays...
  </body>
</html>

PHP edit

PHP is a recursive acronym that stands for PHP Hypertext Preprocessor. It is a server-script that is run each time the page is reloaded and can handle MySQL and is how most websites are created. PHP can output text to a webpage. PHP interpreters are run on the web server so all requests are handled by the web server and then outputted as text that a web browser can display. Variables are created using the $ symbol.

Post Request edit

The post request is a HTTP request where a HTML form can 'post' data to a page that can process the data using the server-side scripts such as PHP or JavaScript.

<?php
  if($_POST["submitForm"]){
    $firstName = $_POST["firstname"];
    echo $firstName;
  }
?>
<form method="post" action="page.php">
  First Name: <input type="text" name="firstname" placeholder="First Name">
  <input type="submit" name="submitForm" value="Submit">
</form>

Database Management Systems (DBMS) edit

'Database Management Systems (DBMS)' are systems that can be accessed by web server extensions. A well known DBMS is a MySQL database.

How to Connect to a DBMS using Server-side Scripting edit

  1. Connect to the hosting server
  2. Select a database
  3. Perform a query for that database
  4. Handle the data in the way that is required
  5. Disconnect from the database

PHP example of MySQL Connection edit

$connect = mysqli_connect("localhost", "username", "password", "databasename");