Programming on the Internet Autumn Review Outline 2018


(Programming on the Internet Autumn 2018)



POTI Review Outline 2018

1.The basic of Internet

  • What is the Internet?
    • The Internet is a global computer network that provides a way for remote computers and local networks to communicate and share services and resources.
  • internet protocols 
  • TCP/IP (Transmission Control Protocol/Internet Protocol)

    •  is the fundamental data communication protocol of Internet and WWW.
    •  is a set of communication rules used to route data packets across the Internet.
    • use of a protocol standard enables computers with different Operating Systems to communicate with each other.
      • PCs using Windows, Unix, Linux, Mac OS, as well as other less well known Operating Systems all use TCP/IP to connect to the Internet.
    • TCP/IP Layers

      • Application
        • Provides same services refer to OSI model (Application, Presentation, Session)
      • Transport
        • responsible for source to destination delivery of an entire message
      • Internet
        • responsible for transmitting individual parts of a message (packet) from source to destination
      • Network Access
        • some protocols not part of TCP/IP (Strictly speaking), most common protocols are Ethernet, FDDI
  • Client/Server model

    • The Internet works in a client-server model.
    • The resources of the internet – information and services are provided through host computers known as servers.
      • The server is a computer system that may contain such things as emails, file downloading service (FTP) or web pages.
    • A customer (client) acting at the Application Level accesses these resources via a client program (e.g. a web browser) which uses TCP/IP to deliver information or files.

2. The basic Networking knowledge

  • – 7 layers of OSI

3. The history of the WWW

  • Invented by Tim Berners-Lee
    • A graduate of Oxford University
    • in 1989. He wrote the first web client and server
    • in 1990. His specifications of URIs, HTTP and HTML were refined as Web technology spread.
  • Organisational Who manage WWW
    • Internet Society (ISOC)
    • Internet Engineering Task Force (IETF)
    • World Wide Web Consortium (W3C)
    • Apache Software Foundation
    • Web Hypertext Application Working Group (WHATWG)

4. What is Big Data?

  • is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. But it’s not the amount of data that’s important.

5. The basic of WWW

  • Client-Server Architecture (inherited from Internet)
  • Standard Protocol Engine
  • Standard Format for information presentation
  • Extended interface to other programs eg. Scripts written in PHP,Perl,JSP (Java Server Pages) or ASP

6. What is a web graph?

  • The webgraph describes the directed links between pages of the World Wide Web. 

7. What are Hypertext hyper-documents, and hyperlinks?

  • Hypertext

    • is text displayed on a computer display or other electronic devices with references (hyperlinks) to other text that the reader can immediately access
  • hyperlinks

    • hyperlink, or simply a link, is a reference to data that the reader can directly follow either by clicking, tapping, or hovering. A hyperlink points to a whole document or to a specific element within a document.
  • hyper-documents

    • an extension of the term hypertext, is a nonlinear medium of information that includes graphics, audio, video, plain text and hyperlinks

8. What is JQuery

  • its core jQuery retrieves a set of one or more elements from a web page and then performs operations on the elements in the set.
  • Makes it much easier to access and manipulate the DOM
  • Uses CSS selector syntax to create, access and change the properties of DOM elements.
  • Widely used on the web
  • jQuery works across all major browsers.
  • Wide variety of operations can be performed on the retrieved set of elements.
  • the design goal of this library

    • is to supply basic jQuery functions.
    • Core is designed to be fast and concise.
      • Developers may have needs not directly met by the jQuery core.
      • Developers can use the jQuery UI library for some pre-written useful functions.
  • Advantages

    • Reduces the amount of code required to perform common tasks in web pages such as form validation, AJAX.
    • Masks differences between browsers behind the jQuery API
    • Increased functionality of web pages reduces necessity to do processing on server

9. What is AJAX

  • AJAX is a technique for creating fast and dynamic web pages. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.
  • Design goal of this library?

    • Reduce web server hits
    • Reduce network load
    • Interactive user Interface
    • Platform and architecture neutrality
    • Support for both synchronous and asynchronous communication
    • Provide server and client side framework.

10. What Internet protocols that can be supported by web browsers?

  • HTTP
  • FILE
  • FTP

11. Steps involved in finding out particular data items in MySQL through PHP programs.

  1. Set up the database connection config (HOST,USERNAME,PWD,DB)
  2. using mysql_connect(HOST,USER,PWD) to connect the DB
  3. use mysql_select_db (DB_TABLE,$DB_HANDLE) to select the database from mysql
  4. write sql query statement, then use mysql_query($SQL) to execute the query to mysql server (it will return result)
  5. use mysql_num_rows() to check if there is data in the result
  6. while loop through $row = mysql_fetch_row($result) and each fields will get in $rows
  7. access corresponding fields in $row array by using index e.g $row[“field_name”]
  8. close the db connect by using mysql_close($db_handler)

12. How could we set up and delete session variables in PHP?

  • Use session_unset() free all session variables & session_destroy ( void ) to destroy all sessions
  • Use unset($_SESSION[‘NAME’]) to unset an particular session.

13. What is XML.HttpRequest object? What is ActiveXObject ?

  • The XMLHttpRequest object can be used to request data from a web server.
    • Update a web page without reloading the page
    • Request data from a server – after the page has loaded
    • Receive data from a server  – after the page has loaded
    • Send data to a server – in the background
  • Old versions of Internet Explorer (IE5 and IE6) use an ActiveXObject instead of the XMLHttpRequest object:

14. Some standard PHP methods and functions

  • each()
    • Return the current key and value pair from an array and advance the array cursor
    • Parameters

      • array

        The input array.

    • Return

      • Returns the current key and value pair from the array array. This pair is returned in a four-element array, with the keys 01key, and value. Elements 0 and key contain the key name of the array element, and 1 and value contain the data.

        If the internal pointer for the array points past the end of the array contents, each() returns FALSE.

    • Sample usage:

      • ?php
        $foo = array("bob", "fred", "jussi", "jouni", "egon", "marliese");
        $bar = each($foo);
            [1] => bob
            [value] => bob
            [0] => 0
            [key] => 0


  • foreach()
    • The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes:
      • foreach (array_expression as $value)
        foreach (array_expression as $key => $value)

        The first form loops over the array given by array_expression. On each iteration, the value of the current element is assigned to $value and the internal array pointer is advanced by one (so on the next iteration, you’ll be looking at the next element).

        The second form will additionally assign the current element’s key to the $key variable on each iteration.

      • Sample usage:

        • <?php
          $arr = array(1, 2, 3, 4);
          foreach ($arr as &$value) {
              $value = $value * 2;
          // $arr is now array(2, 4, 6, 8)
          // without an unset($value), $value is still a reference to the last item: $arr[3]
          foreach ($arr as $key => $value) {
              // $arr[3] will be updated with each value from $arr...
              echo "{$key} => {$value} ";
          // ...until ultimately the second-to-last value is copied onto the last value
          // output:
          // 0 => 2 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 2 )
          // 1 => 4 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 4 )
          // 2 => 6 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 6 )
          // 3 => 6 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 6 )
  • isset()
    • bool isset ( mixed $var [, mixed $... ] )
    • Determine if a variable is set and is not NULL
    • Parameters

      • var

        The variable to be checked.


        Another variable …


    • Return

      • Returns TRUE if var exists and has value other than NULLFALSE otherwise.

    • Sample usage:

      • <?php
        $var = '';
        // This will evaluate to TRUE so the text will be printed.
        if (isset($var)) {
            echo "This var is set so I will print.";
        // In the next examples we'll use var_dump to output
        // the return value of isset().
        $a = "test";
        $b = "anothertest";
        var_dump(isset($a));      // TRUE
        var_dump(isset($a, $b)); // TRUE
        unset ($a);
        var_dump(isset($a));     // FALSE
        var_dump(isset($a, $b)); // FALSE
        $foo = NULL;
        var_dump(isset($foo));   // FALSE


  • empty ()
    • bool empty ( mixed $var )

      Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSEempty() does not generate a warning if the variable does not exist.

    • Parameters

      • var

        Variable to be checked


    • Return

      • Returns FALSE if var exists and has a non-empty, non-zero value. Otherwise returns TRUE.

        The following values are considered to be empty:

        • “” (an empty string)
        • 0 (0 as an integer)
        • 0.0 (0 as a float)
        • “0” (0 as a string)
        • NULL
        • FALSE
        • array() (an empty array)
    • Sample usage:

      • <?php
        $var = 0;
        // Evaluates to true because $var is empty
        if (empty($var)) {
            echo '$var is either 0, empty, or not set at all';
        // Evaluates as true because $var is set
        if (isset($var)) {
            echo '$var is set even though it is empty';


15. How to manipulate on a MySQL database?

Via command line

  • Creation
    •  CREATE DATABASE database;
  • Deletion
    •  DROP DATABASE database;
  • Rename
    •  mysqladmin create name2
       mysqldump --opt name1 | mysql name2
       mysqladmin drop -f name1
  • Copy
    • # First, clean-up the target database:
       mysqladmin drop -f base2
       mysqladmin create base2
      # Copy base1 to base2:
       mysqldump --opt base1 | mysql base2

Via PHP Script

Via PMA (phpMyAdmin)

  • is a free and open source administration tool for MySQL and MariaDB. As a portable web application written primarily in PHP, it has become one of the most popular MySQL administration tools, especially for web hosting services.

16. Associative Array in PHP

  • Arrays with named keys
  • e.g.
    $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
    $age['Peter'] = "35";
    $age['Ben'] = "37";
    $age['Joe'] = "43";
  • Sample usage

    • <?php
      $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
      echo "Peter is " . $age['Peter'] . " years old.";
      Peter is 35 years old.

17. What are the main features OOP concepts in PHP?

  • Encapsulation – also known as information hiding. Only the data and code that needs to be visible outside an object is made visible.
  • Inheritance – classes can extend other classes.
  • Overloading – more than one method with the same name inside an object.
  • Overriding of Methods – subclasses can have methods that replace those of their superclass.

18. What are Cookies and Session Variables? 

  • Cookies
    • an alternative to sessions as a way of storing data
    • saved on the client side, not the server side
    • insecure as users can read them and write to them.
    • although the security issues, cookies are a handy way of storing data.
  • Session

    • a way for data from a PHP script to be remembered so that a group of associated scripts will all have access to the data (due to HTTP address doesn’t maintain state)
    • session data is stored in a file that can only be read by the user running the server
    • Every session has a unique session id
    • stored session data is stored in a special format inside the file.
    • normally use cookies to store the session id on the client side.

19. The difference between Class & Object?

  • An object is a member or an “instance” of a class !
Object Class
Object is an instance of a class. Class is a blueprint or template from which objects are created.
Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. Class is a group of similar objects.
Object is a physical entity. Class is a logical entity.
Object is created many times as per requirement. Class is declared once.
Object allocates memory when it is created. Class doesn’t allocated memory when it is created.

20. Class modifiers:

  • public
  • private
  • protected


21. What are the main concerns in Web Security?

User Specific Concerns :

  • Web sites are who they say they are.
  • Documents returned from web sites are free of malicious code and viruses
  • Web site will not distribute information about the user such as their browsing behaviour.

Webmaster Specific Concerns:

  • Users (and others) will not attempt to break into web server computer system
  • User will not try and gain access to documents that they are not authorised to access
  • User will not try to crash the server making it unavailable to other users
  • User is who they say they are.

Common interests:

  • Confidentiality (保密性) – Communications between the browser and the server are not read by third parties listening on the connection
  • Integrity (完整性)Communications between the browser and the server are delivered intact without any alterations.
  • Nonrepudiation (不可否認性) – ability to ensure that a party to a contract or a communication cannot deny the authenticity of their signature on a document or the sending of a message that they originated.


  • SSL (Secure Sockets Layer) or TLS (Transport Layer Security)

    • Designed to provide security and other services to data generated from the application layer.
    • Can receive data from any application layer program and pass it down to the transport layer.
    • In practice, HTTP is the most commonly used application protocol with SSL. In the form of HTTPS it is used in most secure e-commerce transactions.
    • use what is known as an ‘asymmetric’ Public Key Infrastructure (PKI) system (a public key and a private key.)

      •  Anything encrypted with the public key can only be decrypted by the private key and vice-versa.
    • SSL Setup Phase


    • is an extension of the Hypertext Transfer Protocol (HTTP) for secure communication over a computer network, and is widely used on the Internet.
    • use one of two secure protocols to encrypt communications – SSL (Secure Sockets Layer) or TLS (Transport Layer Security)
  • What is a HTTPS certificate?

    • When you request a HTTPS connection to a webpage, the website will initially send its SSL certificate to your browser. This certificate contains the public key needed to begin the secure session. Based on this initial exchange, your browser and the website then initiate the ‘SSL handshake’. The SSL handshake involves the generation of shared secrets to establish a uniquely secure connection between yourself and the website.When a trusted SSL Digital Certificate is used during a HTTPS connection, users will see a padlock icon in the browser address bar. When an Extended Validation Certificate is installed on a web site, the address bar will turn green.
  • Private key strategy and public key strategy?

    • Symmetric (Private Key) DES (Data Encryption Standard), DES3 (Triple DES), AES (Advanced Encryption Standard), RC5, IDEA
      Asymmetric (Public Key) RSA (Rivest-Shamir-Adelman), Rabin, El Gamal

22. What is DOM? How to manipulate the DOM for web design?

  • The Document Object Model (DOM) is a cross-platform and language-independent application programming interface that treats an HTML, XHTML, or XML document as a tree structure wherein each node is an object representing a part of the document


  • Part 1

  • Part 2

  • Part 3

  • HTML DOM Tree
  • XML DOM Tree
    • An XML document represents a hierarchy; a hierarchy is a tree

23. How to create, alter and validate XML files through PHP DOM operations?

24. What are XML Schema, XSD, and DTD? What functions they perform?

  • Schema

    • An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed by XML itself.
    • Well-formed
      • XML document follows the basic syntax rules of XML
    • Valid
      • XML document follows the basic syntax rules of XML and also follows the rules in its associated DTD or XML Schema
  • XSD

    • XSD (XML Schema Definition) is a World Wide Web Consortium (W3C) recommendation that specifies how to formally describe the elements in an Extensible Markup Language (XML) document.
  • DTD

    • A document type definition (DTD) is a set of markup declarations that define a document type for an SGML-family markup language (SGML, XML, HTML).
    •  A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list of legal elements and attributes.

25. Web Security? SSL layer, Confidentiality -> Integrity -> Entity Authentication [Certifying Authorities] -> Non repudiation

Web Security

SSL layer

  • SSL (Secure Sockets Layer) is the standard security technology for establishing an encrypted link between a web server and a browser. This link ensures that all data passed between the web server and browsers remain private and integral.

Confidentiality (保密性)

  • Communications between the browser and the server are not read by third parties listening on the connection

Integrity (完整性)

  • Communications between the browser and the server are delivered intact without any alterations.

Entity Authentication [Certifying Authorities] (实体鉴别)

  • users of data and resources must prove who they are.

Non repudiation (不可否認性)

  • Ability to prove a transaction between authenticated parties occurred.

26. What are issues of the good design of a web site?


  • makes the page look attractive, makes navigation easier
  • makes a web page and the site it is a part of, easier to use.

Factors influencing layout technique used

  • Uniformity (均勻性) – is it implemented uniformly on all the most commonly used browsers and their different versions?
  • Flexibility (靈活性)- how easy is it to make minor (or major) changes?
  • Network-ability (網絡能力) – does it put a load on the server and/or the network?
  • Aesthetics (美學) – does it always look good or does it have undesirable side effects
  • Purity (純度) – is it a technique that has official endorsement (官方認可) e.g. from the W3C ?

Table basic


Programming on the Internet Autumn Review Outline 2018 (PDF)




メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください