Department of Computer Technology MIT Campus:: Anna University
Department of Computer Technology MIT Campus:: Anna University
Time Table
Date :05-02-2020
MODULE 5 :
WEB SERVERS
Web server is a computer where the web content is stored. Basically web server is
used to host the web sites but there exists other web servers also such as gaming,
storage, FTP, email etc.
Proxy servers allow to hide, conceal and make your network id anonymous by hiding
your IP address
Purpose of Proxy Servers
Content Filtering
Filtering encrypted data
Bypass filters
Logging and eavesdropping
Improving performance
It fasten the service by process of retrieving content from the cache which was saved when
previous request was made by the client.
Translation
It helps to customize the source site for local users by excluding source content or substituting
source content with original local content. In this the traffic from the global users is routed to the
source website through Translation proxy.
In this the destination server receives the request from the anonymzing proxy server and thus
does not receive information about the end user.
Security
Since the proxy server hides the identity of the user hence it protects from spam and the hacker
attacks.
Type of Proxies
Proxy user interface
This module controls and manages the user interface and provides an easy to use graphical
interface, window and a menu to the end user. This menu offers the following functionalities:
Start proxy
Stop proxy
Exit
Blocking URL
Blocking client
Manage log
Manage cache
Modify configuration
Proxy server listener
It is the port where new request from the client browser is listened. This module also performs
blocking of clients from the list given by the user.
Connection Manager
It contains the main functionality of the proxy server. It performs the following functions:
It contains the main functionality of the proxy server. It performs the following functions:
Read request from header of the client.
Parse the URL and determine whether the URL is blocked or not.
Generate connection to the web server.
Read the reply from the web server.
If no copy of page is found in the cache then download the page from web server else
will check its last modified date from the reply header and accordingly will read from the
cache or server from the web.
Then it will also check whether caching is allowed or not and accordingly will cache the
page.
Cache Manager
This module is responsible for storing, deleting, clearing and searching of web pages in the
cache.
Log Manager
This module is responsible for viewing, clearing and updating the logs.
Configuration
This module helps to create configuration settings which in turn let other modules to perform
desired configurations such as caching.
PHP
PHP is acronym of Hype rtext Preprocessor (PHP) is a programming language that allows web
developers to create dynamic content that interacts with databases.PHP is basically used for
developing web based software applications.
PHP started out as a small open source project that evolved as more and more people found out
how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994.
Key Points
Uses of PHP
PHP has now become a popular scripting language among web developer due to the following
reasons −
PHP performs system functions, i.e. from files on a system it can create, open, read,
write, and close them.
PHP can handle forms, i.e. gather data from files, save data to a file, through email you
can send data, return data to the user.
You add, delete, modify elements within your database through PHP.
Access cookies variables and set cookies.
Using PHP, you can restrict users to access some pages of your website.
It can encrypt data.
Characteristics
Simplicity
Efficiency
Security
Flexibility
Familiarity
To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an essential
example, first we will create a friendly little "Hello, World!" script.
As mentioned earlier, PHP is embedded in HTML. That means that in amongst your normal
HTML (or XHTML if you're cutting-edge) you'll have PHP statements like this −
<html>
<head>
<title>Hello World</title>
</head>
<body>
<?php echo "Hello, World!";?>
</body>
</html>
If you examine the HTML output of the above example, you'll notice that the PHP code is not
present in the file sent from the server to your Web browser.
All of the PHP present in the Web page is processed and stripped from the page; the only thing
returned to the client from the Web server is pure HTML output.
All PHP code must be included inside one of the three special markup tags ate are recognized by
the PHP Parser.
MySQL
SQL Server
MS Access
Oracle
Sybase
Informix
Postgres
SQL ARchitecture
What is table?The table is a collection of related data entries and it consists of columns and
rows a table is the most common and simplest form of data storage in a relational database.
What is field?
Every table is broken up into smaller entities called fields. The fields in the
CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.A field is a
column in a table that is designed to maintain specific information about every record in
the table.
1 RAMESH 32 Ahmedabad 32
What is column?
A column is a vertical entity in a table that contains all information associated with a
specific field in a table. For example, a column in the CUSTOMERS table is ADDRESS,
which represents location description and would consist of the followi ng
Name
Ahmedabad
Delhi
Kota
Mumbai
Bhopal
MP
Indore
NOT NULL Constraint: Ensures that a column cannot have NULL value .
CHECK Constraint: The CHECK constraint ensures that all values in a column
satisfy certain conditions
INDEX: Use to create and retrieve data from the database very quickly.
PRIMARY Key:
A primary key is a field in a table which uniquely identifies each row/record a database
table.
A table can have only one primary key,which may consist of single or multiple fields.
When multiple fields are used as a primary key, they are called a composite key.
If a table has a primary key defined on any field(s),then you can not have two records
having the same value of that field(s).
If you use the ALTER TABLE statement to add a pr imary key, the primary key column(s) must already have been dec lared
to not contain NULL values (w hen the table w as first created).For defining a PRIMA RY KEY constraint on multiple columns,
use the follow ing SQL syntax
Introduction to DDL
DDL stands for Data Definition Language.
It is a language used for defining and modifying the data and its structure.
It is used to build and modify the structure of your tables and other objects in the database.
These commands can be used to add, remove or modify tables within a database.
DDL has pre-defined syntax for describing the data.
1. CREATE COMMAND
Syntax:
CREATE TABLE <table_name>
( column_name1 datatype,
column_name2 datatype,
.
.
.
column_name_n datatype
);
------------------------------------------------------------------------------------------------------------
2. DROP COMMAND
DROP command allows to remove entire database objects from the database.
It removes entire data structure from the database.
It deletes a table, index or view.
Syntax:
DROP TABLE <table_name>;
OR
DROP DATABASE <database_name>;
If you want to remove individual records, then use DELETE command of the DML statement.
--------------------------------------------------------------------------------------------------------------------------------
3. ALTER COMMAND
Syntax:
ALTER TABLE <table_name>
ADD <column_name datatype>;
OR
OR
ALTER TABLE <table_name>
DROP COLUMN <column_name>;
OR
OR
----------------------------------------------------------------------------------------------------------
4. RENAME COMMAND
Syntax:
RENAME TABLE <old_name> TO <new_name>;
Example:
RENAME TABLE emp TO employee;
----------------------------------------------------------------------------------------------------------------------------
5. TRUNCATE COMMAND
TRUNCATE command is used to delete all the rows from the table permanently.
It removes all the records from a table, including all spaces allocated for the records.
This command is same as DELETE command, but TRUNCATE command does not generate any
rollback data.
Syntax:
TRUNCATE TABLE <table_name>;
Example:
TRUNCATE TABLE employee;
-----------------------------------------------------------------------------------------------------------------------------------
Introduction to DML
1. SELECT COMMAND
Clause Description
WHERE It specifies which rows to retrieve.
GROUP BY It is used to arrange the data into groups.
HAVING It selects among the groups defined by the GROUP BY clause.
ORDER BY It specifies an order in which to return the rows.
AS It provides an alias which can be used to temporarily rename tables or columns.
Syntax:
SELECT * FROM <table_name>;
OR
2. INSERT COMMAND
Example:
INSERT INTO employee (`eid` int, `ename` varchar(20), `city` varchar(20))
VALUES (`1`, `ABC`, `PUNE`);
3. UPDATE COMMAND
Syntax:
UPDATE <table_name>
SET <column_name = value>
WHERE condition;
UPDATE employee
SET salary=20000
WHERE ename='ABC';
4. DELETE COMMAND
DELETE command is used to delete some or all records from the existing table.
It deletes all the records from a table.
Syntax:
DELETE FROM <table_name> WHERE <condition>;
If we does not write the WHERE condition, then all rows will get deleted.
Introduction to DCL
1. GRANT COMMAND
Syntax:
GRANT <privilege list>
ON <relation name or view name>
TO <user/role list>;
In the above example, user 'ABC' has been given permission to view and modify the records in the
'employee' table.
2. REVOKE COMMAND
Syntax:
REVOKE <privilege list>
ON <relation name or view name>
FROM <user name>;
Example : REVOKE Command
REVOKE UPDATE
ON employee
FROM ABC;
GRANT command allows a user to perform certain REVOKE command disallows a user to perform
activities on the database. certain activities.
It grants access privileges for database objects to It revokes access privileges for database objects
other users. previously granted to other users.
Example:
Example:
GRANT privilege_name
ON object_name REVOKE privilege_name
TO ON object_name
{ FROM
user_name|PUBLIC|role_name {
} user_name|PUBLIC|role_name
}
[WITH GRANT OPTION];
Exercise
2. Create a PHP test page, store them on your XAMPP’s local host, and retrieve them via the web
browser.
i. Open the XAMPP directory through the ‘Explorer’ button in the Control Panel and
choose the folder htdocs (C:\xampp\htdocs for standard installations). This directory
will store file data collected for web pages that you test on your XAMPP server. The
htdocs folder should already contain data to help configuration of the web server. But
you should store your own projects in a new folder (like ‘Test Folder’ for example).
ii. You can create a new PHP page easily by using the following content in your editor and
storing it as test.php in your ‘ test’ folder (C:\xampp\htdocs\test):
iii. The last step now is to open your web browser and load your PHP page via
localhost/test/test.php. If your browser window displays the words ‘Hello World’,
then you’ve successfully installed and configured your XAMPP.
4. Create a table of genres for books using CREATE TABLE, then insert a few rows using INSERT INTO.
5. Practice the following sql commands for the table customer (Exercise 3).
write the syntax of the following statement in the observation note book and explain
with example.
6.