Unit One: Web Document Requiring Server-Side Dynamic
Interaction
1. Dynamic Functionality of a Website
Definition: Websites that respond and interact with users in real-time
based on user input or data.
Categories:
o Activity: Users find others with common interests.
o Affiliate: Third-party sites selling products/services for ad
revenue.
o Archive: Searchable data storage (e.g., documents, pictures).
o Blog: Online diaries or journals.
o Community: Like-minded individuals sharing interests.
o Company: Corporate or business information.
o Dating: Finding relationships.
o Gambling: Speculating on games or activities.
o Investing: Research and investment opportunities.
o News: Current events.
o Personal: Family or individual blogs.
o Political: Propaganda or influence sites.
o Products: E-commerce sites.
o Religious: Spiritual support and community.
o Search: Information aggregation based on user queries.
o Social: Networking sites.
2. Web Scripting Language
Definition: Programming languages used to add functionality to
websites.
Types:
o Server-side: Runs on the server (e.g., PHP, Python, Node.js).
o Client-side: Runs in the browser (e.g., JavaScript, HTML, CSS).
Examples:
o JavaScript: Client-side, used in 98% of websites.
o Python: Easy to use, open-source, supports functional and
object-oriented programming.
o PHP: Server-side, used for dynamic web pages.
o Ruby: Flexible, object-oriented, easy to learn.
o Perl: General-purpose, used for text manipulation.
Advantages:
o Easy to learn and use.
o Open-source and free.
o Portable and cross-platform.
o Lighter memory requirements.
Disadvantages:
o Lack of optimizations.
o Slower execution.
o Requires organization and regular updates.
3. Web Document Requirements
Purpose: Outlines the needs of a new website.
Key Points:
1. Purpose and Goals: Educate, encourage contact, build brand,
generate sales.
2. Target Audience: Define who will use the site.
3. Technical Requirements: Functionality, accessibility,
integrations, analytics.
4. Content Requirements: Pages, written content, visual content,
interactive elements.
5. Wireframes and Site Maps: Visual representation of the site
structure.
Unit Two: Server-Side Scripts
1. Development Environment
PHP Development:
o XAMPP: Free, open-source software for PHP development
(includes Apache, MySQL).
o Apache: Web server that processes PHP scripts.
o MySQL: Relational database management system for data
storage.
Setup:
o Install XAMPP.
o Configure Apache and MySQL for local development.
2. Basic Syntax of Server-Side Scripts
PHP Basics:
o Syntax: Starts with <?php and ends with ?>.
o Variables: Declared with $ (e.g., $name = "John";).
o Data Types: Scalar (boolean, integer, float, string), Compound
(array, object), Special (resource, NULL).
o Operators: Arithmetic, Logical, Comparison, Conditional,
Assignment, Array, Increment/Decrement, String.
o Comments: Single-line (// or #), Multi-line (/* ... */).
Control Structures:
o Conditional: if, if-else, if-elseif-else, switch.
o Loops: while, do-while, for.
o Jump Statements: break, continue.
3. Forms and User Input
Form Handling:
o GET Method: Data visible in URL, less secure.
o POST Method: Data not visible in URL, more secure.
o Superglobals: $_GET, $_POST to access form data.
Example:
php
Copy
<form action="welcome.php" method="post">
Name: <input type="text" name="name">
<input type="submit" value="Submit">
</form>
php
Copy
<?php
$name = $_POST["name"];
echo "Welcome, $name";
?>
4. Working with Database
MySQL:
o Definition: Open-source relational database management
system.
o PHP Connection Methods:
MySQLi: Improved security and functionality over MySQL.
PDO: Database abstraction layer, supports multiple
databases.
o phpMyAdmin: Web-based tool for MySQL database
management.
Example:
php
Copy
$conn = new mysqli("localhost", "user", "password", "database");
$sql = "SELECT * FROM users";
$result = $conn->query($sql);
5. Security Features in Web Development
Key Features:
1. Registry Lock: Prevents domain hijacking.
2. Hotlink Protection: Stops others from stealing your data.
3. Spam Stop: Blocks unwanted ads and pop-ups.
4. DDoS Protection: Prevents distributed denial-of-service
attacks.
5. SSL Protection: Encrypts data between users and servers.
6. Two-Step Verification: Adds an extra layer of security.
7. Secure Passwords: Strong, regularly updated passwords.
8. Bot Blocking: Prevents malicious bots from accessing your site.
9. XSS Protection: Prevents cross-site scripting attacks.
10. Data Backup: Ensures data recovery in case of breaches.
Key Differences Between PHP and JavaScript
PHP: Server-side, runs on the server, supports databases.
JavaScript: Client-side, runs in the browser, does not support
databases.