Master web servers, network services, HTML/CSS, PHP, JavaScript, databases, and security concepts for DSE ICT Elective B. 掌握網頁伺服器、網絡服務、HTML/CSS、PHP、JavaScript、資料庫及安全概念,為DSE ICT選修乙做好準備。
Behind every web application, multiple network services work together to deliver content seamlessly. 每個網頁應用程式背後,多項網絡服務協同運作,為用戶提供無縫體驗。
A web server delivers web content (HTML, images, videos) when clients send HTTP requests. It can also execute server-side scripts (e.g. PHP) to generate dynamic responses. Common examples: NGINX and Apache. 網頁伺服器在客戶端發送HTTP請求時,提供網頁內容(HTML、圖片、影片)。它也能執行伺服器端腳本(如PHP)以動態生成回應。常見例子:NGINX及Apache。
| Aspect方面 | File Server檔案伺服器 | Cloud Storage雲端儲存 |
|---|---|---|
| Setup Cost設置成本 | Higher initial cost初始成本較高 | Easier & quick setup設置簡單快捷 |
| Long-term Cost長期成本 | Lower cost per storage unit每單位儲存成本較低 | Monthly/yearly subscription需月費/年費 |
| Access Speed存取速度 | Faster (within LAN)較快(在區域網路內) | Slower (over Internet)較慢(透過互聯網) |
| Ease of Access存取便利性 | Needs technical knowledge需要技術知識 | Anywhere with Internet有互聯網即可存取 |
| Scalability可擴展性 | Needs technical expertise需要技術人員 | Easy but provider-limited容易但受供應商限制 |
A database server manages multiple databases using a DBMS. It implements user authentication (username/password) and user access control (varying privilege levels). Web servers connect to it using credentials to execute SQL queries. 資料庫伺服器使用DBMS管理多個資料庫。它實施用戶驗證(用戶名/密碼)及用戶存取控制(不同權限等級)。網頁伺服器使用憑證連接並執行SQL查詢。
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to devices on a network. The server defines a scope (range of available IPs). Assigned IPs have a lease duration — devices must renew when it expires. DHCP(動態主機配置協定)自動為網絡上的設備分配IP地址。伺服器定義範圍(可用IP範圍)。分配的IP有租用期限——到期後設備必須更新。
An intermediary between a network and the Internet. Provides two main benefits: 網絡與互聯網之間的中間人。提供兩大主要功能:
A port number identifies specific services/applications on the same network address. Valid range: 0–65535 (unsigned 16-bit). 端口號識別同一網絡地址上的特定服務/應用程式。有效範圍:0–65535(無符號16位元)。
| Reason for Non-default Port使用非預設端口的原因 | Example例子 |
|---|---|
| Port conflict端口衝突 | Two services need port 80兩個服務都需要80端口 |
| Security considerations安全考慮 | Hide service from automated scans隱藏服務免受自動掃描 |
| Multiple instances多個實例 | Production on 443, testing on 8080生產在443,測試在8080 |
| Firewall restrictions防火牆限制 | Default port blocked by firewall預設端口被防火牆封鎖 |
https://www.mysite.net:8080/notice.html
要存取非預設端口,在URL中指定:https://www.mysite.net:8080/notice.html
HTML, CSS, JavaScript (client-side), PHP & databases (server-side), and security best practices. HTML、CSS、JavaScript(客戶端),PHP及資料庫(伺服器端),以及安全最佳實踐。
.classname. Allows reuse across elements, centralised changes, better readability.
使用.classname選擇性應用樣式。允許跨元素重用,集中修改,更佳可讀性。
| Validation Type驗證類型 | Client-side客戶端 | Server-side伺服器端 |
|---|---|---|
| Presence check (required field)存在性檢查(必填欄位) | Yes | Yes |
| Format check (phone numbers only)格式檢查(只限數字) | Yes | Yes |
| Password match check密碼匹配檢查 | Yes | Yes |
| Uniqueness check (username taken?)唯一性檢查(用戶名已被使用?) | No | Yes |
PHP is a server-side scripting language. It connects to MySQL databases using mysqli_connect() and executes SQL queries to retrieve or update data.
PHP是伺服器端腳本語言。它使用mysqli_connect()連接MySQL資料庫並執行SQL查詢以擷取或更新資料。
When user input is directly inserted into SQL queries without sanitisation, attackers can inject malicious SQL code to manipulate the database. 當用戶輸入未經過濾直接插入SQL查詢時,攻擊者可注入惡意SQL代碼以操控資料庫。
Attacker input: ' OR '1'='1 bypasses authentication!攻擊者輸入:' OR '1'='1 繞過驗證!
Escapes special characters — prevents injection.轉義特殊字符——防止注入。
JavaScript runs in the browser. It can manipulate the DOM, validate forms, and create interactive experiences without server round-trips. JavaScript在瀏覽器中運行。它可以操作DOM、驗證表單,並在無需伺服器往返的情況下創建互動體驗。
15 questions covering network services and web application development. Click an option to answer. 15條題目涵蓋網絡服務及網頁應用程式開發。點擊選項作答。
Click any card to reveal its definition. 24 key terms from Chapter 6. 點擊任意卡片查看定義。第六章24個關鍵詞彙。
DSE-style questions with model answers. Filter by difficulty level. DSE模式試題附參考答案。按難度篩選。