// TETFUND ICT PROGRAMME · ITEM 3 · PART 2
Network Programming, Installation and Web Programming
Lecture notes for participants · Nigeria Maritime University, Okerenkoko, Delta State
| Item | Detail |
|---|
| Date | Wednesday 28 October 2026 (one full day) |
| Participants | 20 university staff and students |
| Resource person | Mukhtar Sabiu, Alpha Oneiro Ltd |
| What you need | A laptop (or a phone) and internet. Nothing to install. |
| Practice | Seven small interactive labs on the Practice Lab page (link given in class) |
// HOW TO USE THESE NOTES
- Read the amber In plain words box first. It gives the idea in one or two sentences.
- Then read the details. Every new word is explained the first time it appears, and again in the word list at the back.
- Do each green Practice box yourself. Answers to the practice questions are on the last pages.
- Write in the margins. These notes are yours to keep.
// THE DAY
| Time | What happens |
|---|
| 08:30 | Welcome and pre-test |
| 09:00 | Part 1: how networks work (bits, layers, addresses, subnetting, ports, cables, Wi-Fi, firewalls) |
| 13:00 | Lunch and prayer |
| 14:00 | Part 2: network programming (programs that talk, fetch, Python) |
| 15:00 | Part 3: web programming (HTML, CSS, JavaScript, databases, security, going online) |
| 17:15 | Mini-project, post-test, feedback |
// BY THE END YOU CAN
- Explain what a network, an IP address and a subnet are, in your own words.
- Split a network into smaller ones and read your own network settings.
- Name the five layers, the main ports, and the parts of a network.
- Make a program ask a server for data over the network.
- Build a small web page with HTML, CSS and JavaScript, and put it online.
- Explain passwords, hashing, SQL injection, XSS and HTTPS.
// PART 1 · NETWORKS
1. What is a network?
IN PLAIN WORDSA network is two or more devices joined so they can share things: files, printers and an internet connection. Think of houses on one road.
Before networks, each computer was alone. To move a file you copied it to a flash drive and walked to another office. A network lets the file travel by itself, in seconds, to anyone allowed to get it.
// THE PARTS OF A NETWORK
| Part | What it does | Everyday picture |
|---|
| Device (host, node) | Any computer, phone, printer or server on the network | A house on the road |
| Cable or Wi-Fi | Carries the signals between devices | The road |
| Switch | Joins many devices in one building | A junction in your compound |
| Router | Joins your network to other networks | The gate to the main highway |
| Client | A device that asks for a service, for example your browser | A customer |
| Server | A computer that gives a service: web, email, files | A shop |
// SIZES OF NETWORKS
| Name | Meaning | Example |
|---|
| LAN | Local Area Network: one building or campus | The NMU computer lab |
| WAN | Wide Area Network: many places far apart | Two campuses linked by a provider |
| Internet | All networks of the world joined together | Everything you open in a browser |
| Intranet | A private network only for staff or students | The staff portal |
// PROTOCOL: THE MOST IMPORTANT WORD
A protocol is a set of rules that both sides follow so they understand each other. If you greet someone in Hausa, they must answer in Hausa. Devices do the same: HTTP is the protocol of the web, SMTP is the protocol of email, and IP is the protocol that gives addresses.
PRACTICE 1Draw your office or lab network on paper: devices, switch, router, and the way out to the internet. Label each part with the words above.
// PART 1 · THE CORE
2. Bits and bytes: how computers count
IN PLAIN WORDSA computer only knows ON and OFF. We write ON as 1 and OFF as 0. Everything, words, photos and addresses, is built from many 0s and 1s.
One 0 or 1 is called a bit. Eight bits together are a byte. A byte can hold any number from 0 to 255. To read a byte, give each position a value: 128, 64, 32, 16, 8, 4, 2, 1. Add up the values where there is a 1.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | Number |
|---|
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 128 + 64 = 192 |
| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 128 + 32 + 8 = 168 |
| 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 8 + 2 = 10 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 255 (everything on) |
This is why every part of an IPv4 address stops at 255: it is one byte. An IPv4 address is four bytes, which is 32 bits.
// HOW TO CONVERT A NUMBER TO BINARY
- Start at 128. If the number is 128 or more, write 1 and subtract 128. Otherwise write 0.
- Move to 64 and repeat, then 32, 16, 8, 4, 2, 1.
- Example: 25. 128 no (0), 64 no (0), 32 no (0), 16 yes (1) leaves 9, 8 yes (1) leaves 1, 4 no (0), 2 no (0), 1 yes (1). Answer: 00011001.
PRACTICE 2Write these in binary: 5, 10, 192, 255. Then read 00001111 and 11110000 as numbers. Check your answers in the Practice Lab, tab 1 (Binary).
WHY WE CAREThe subnet mask 255.255.255.192 looks strange until you see it in binary: 11111111.11111111.11111111.11000000. The 1s are the street and the 0s are the house numbers.
// PART 1 · LAYERS
3. The five layers: sending a letter
IN PLAIN WORDSSending data is like posting a letter. Many small jobs happen one after another. Each job belongs to a layer.
| Layer | What it does | Letter story | Example |
|---|
| 5 Application | The program you use | You write the letter | Browser, email, WhatsApp |
| 4 Transport | Cuts data into numbered pieces and checks they arrive | Put the pages in numbered envelopes | TCP, UDP, ports |
| 3 Network | Adds addresses and finds the route | Write the address on the envelope | IP, routers |
| 2 Data link | Moves data one step to the next device | The local postman | MAC address, switch |
| 1 Physical | Sends the actual signals | The road and the truck | Cable, Wi-Fi radio |
When you send, data goes down the layers. When the other computer receives it, the data goes up. This is a model: real systems mix layers a little, but it helps us think and find faults.
FIND THE FAULT, BOTTOM UPLayer 1: is the cable plugged in, is Wi-Fi on? Layer 2: right switch port or Wi-Fi name? Layer 3: has the device an IP address? Layer 4: is the right port open? Layer 5: is the program set up correctly?
PRACTICE 3A student says: I am connected to Wi-Fi but no website opens. Which layer would you check first? Then which?
// PART 1 · LAYERS
4. Packets and headers: wrapping the message
IN PLAIN WORDSBig messages are cut into small pieces called packets. Each layer adds a label (a header) in front, like boxes nested inside bigger boxes.
Why cut the message? Small pieces share the road fairly, and if one piece is lost only that piece is sent again. Every piece carries the address of the sender and the receiver.
| Name of the piece | Added by | The new label says |
|---|
| Data | The program | (your message: a web request, an email) |
| Segment | Transport layer (TCP) | From which port to which port, and the piece number |
| Packet | Network layer (IP) | From which IP address to which IP address |
| Frame | Data link layer | From which MAC address to which MAC address, on this one hop |
| Bits | Physical layer | Electrical, light or radio signals |
// WORDS
| Word | Meaning |
|---|
| Header | Extra information put in front of the data |
| Payload | The real content being carried |
| Encapsulation | Adding a header at each layer on the way down |
| De-encapsulation | Removing each header on the way up |
| Hop | One step from one device to the next on the road |
On the way, the IP addresses stay the same from start to end, but the MAC addresses change at every hop, because each hop has a different pair of devices.
PRACTICE 4Open the Practice Lab, tab 3 (Packet journey). Type a short message and press Next layer. Write down what each layer added.
// PART 1 · ADDRESSES
5. MAC address and IP address
IN PLAIN WORDSA MAC address is the name of the device. An IP address is where it is now. Names stay; addresses change when you move.
| MAC address | IP address |
|---|
| Looks like | 00:1A:2B:3C:4D:5E | 192.168.10.25 |
| Given by | The factory, burned into the network card | The network (DHCP) or set by hand |
| Changes? | No | Yes, when you join another network |
| Works | Only inside one local network | Across networks |
| Size | 48 bits | 32 bits (IPv4) |
| Layer | 2 (data link) | 3 (network) |
An IPv4 address has four numbers called octets because each is 8 bits. In 192.168.10.25, the first three numbers can be the street (the network) and the last number is the house (the device). Where the street ends is decided by the subnet mask.
IP CONFLICTIf two devices have the same IP address, mail goes to the wrong house and both lose connection. DHCP prevents this by giving each device a different address.
PRACTICE 5In 172.16.5.200 which numbers are the network if the mask is 255.255.0.0? Which is the host part?
// PART 1 · ADDRESSES
6. Subnet mask, gateway, DNS and DHCP
IN PLAIN WORDSWhen your laptop joins Wi-Fi it needs four settings: an address, a mask, a gateway and a DNS server. DHCP gives all four automatically.
| Setting | Example | What it is for |
|---|
| IP address | 192.168.10.25 | Who and where you are |
| Subnet mask | 255.255.255.0 (/24) | Which part is the street |
| Default gateway | 192.168.10.1 | The router: the way out of your street |
| DNS server | 8.8.8.8 | The phone book that turns names into addresses |
// DNS: THE PHONE BOOK
People remember names such as nmu.edu.ng. Computers need numbers. DNS (Domain Name System) answers the question: what is the IP address of this name? Your laptop asks the DNS server first, then talks to the real address. Command to try: nslookup nmu.edu.ng.
// DHCP: THE HELPER AT THE DOOR
DHCP (Dynamic Host Configuration Protocol) is a service on the router or a server. When you join, your device shouts: who am I? DHCP answers with an address, mask, gateway and DNS. The address is lent for a time, called a lease, then returned.
// OTHER WORDS
| Word | Meaning |
|---|
| Network address | The first address of a network, the name of the street. Not given to a device. |
| Broadcast address | The last address. A message sent here reaches every device on the network. |
| Static IP | An address set by hand. Used for servers and printers. |
| Dynamic IP | An address given by DHCP. Used for laptops and phones. |
PRACTICE 6Which of the four settings is missing if you can open a website by its IP address but not by its name?
// PART 1 · ADDRESSES
7. Public, private and NAT
IN PLAIN WORDSInside a building we use private addresses that are free to reuse. The router has one public address for the world and shares it among everyone inside. That sharing is NAT.
| Type | Ranges | Use |
|---|
| Private | 10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 | Inside homes, offices and campuses. Many places use the same ones. |
| Public | Everything else | Unique in the world. Websites and routers use these. |
Private addresses cannot be reached from the internet, which is also a small protection. When your laptop (192.168.10.25) asks a website for a page, the router swaps your private address for its public one and remembers who asked. When the answer returns, the router swaps back.
// NAT (NETWORK ADDRESS TRANSLATION)
- Laptop sends a request from 192.168.10.25, port 50321.
- Router rewrites it to the public address, port 40001, and writes this in its table.
- Website answers to the public address, port 40001.
- Router looks in the table and forwards the answer to 192.168.10.25.
IPv4 has only about 4.3 billion addresses, which is not enough for every device. NAT is one reason the internet kept working. IPv6 has far more addresses and is slowly replacing it.
PRACTICE 7Find the private address of your laptop (Lab A). Then search the web for: what is my ip. Are they the same? Explain why.
// PART 1 · SUBNETTING
8. Subnetting: cutting a network into floors
IN PLAIN WORDSOne big network is crowded and hard to protect. Subnetting cuts it into smaller networks, like floors in a building, each with its own rules.
Why subnet? (1) Less noise: broadcasts stay on their floor. (2) Better security: Finance and Students can be separated. (3) Easy management: one floor, one department. (4) Good use of addresses.
// THE RULE OF HOST BITS
An IPv4 address has 32 bits. The mask decides how many are network bits and how many are host bits. /24 means 24 network bits and 8 host bits.
| Prefix | Mask | Host bits | Addresses | Usable devices |
|---|
| /24 | 255.255.255.0 | 8 | 256 | 254 |
| /25 | 255.255.255.128 | 7 | 128 | 126 |
| /26 | 255.255.255.192 | 6 | 64 | 62 |
| /27 | 255.255.255.224 | 5 | 32 | 30 |
| /28 | 255.255.255.240 | 4 | 16 | 14 |
| /30 | 255.255.255.252 | 2 | 4 | 2 |
Usable devices = addresses minus 2, because the first address is the network name and the last is the broadcast.
// BORROWING BITS
To make more networks we borrow bits from the host part. Borrow 1 bit and you get 2 networks. Borrow 2 bits and you get 4. Borrow 3 and you get 8. Each borrowed bit doubles the number of networks and halves the size of each.
PRACTICE 8How many devices fit in a /27? How many bits do you borrow from a /24 to make 8 networks, and what is the new prefix?
// PART 1 · SUBNETTING
9. Worked example: four floors
IN PLAIN WORDSTask: split 192.168.10.0/24 into 4 networks, one per department.
- We need 4 networks. 2 x 2 = 4, so we borrow 2 bits.
- /24 plus 2 borrowed bits is /26. The mask is 255.255.255.192.
- 6 host bits remain: 2 to the power 6 = 64 addresses per network, so 62 usable.
- The networks start every 64: .0, .64, .128, .192.
| Floor | Network | Devices | Broadcast | Mask |
|---|
| 1 Admin | 192.168.10.0/26 | 192.168.10.1 to .62 | 192.168.10.63 | 255.255.255.192 |
| 2 Library | 192.168.10.64/26 | 192.168.10.65 to .126 | 192.168.10.127 | 255.255.255.192 |
| 3 Students | 192.168.10.128/26 | 192.168.10.129 to .190 | 192.168.10.191 | 255.255.255.192 |
| 4 Labs | 192.168.10.192/26 | 192.168.10.193 to .254 | 192.168.10.255 | 255.255.255.192 |
The first usable address is often given to the router (the gateway), for example 192.168.10.1 for Admin and 192.168.10.129 for Students.
// PRACTICE QUESTIONS
- Split 192.168.20.0/24 into two equal networks. Give the mask, both network addresses and the usable range of each.
- A department has 25 computers. Which prefix is the smallest network that still fits them?
- Which network does 192.168.10.140 belong to in the table above?
- Why can't we give a device the address 192.168.10.63?
CHECKType any address and prefix into the Practice Lab, tab 2 (Subnet calculator). It shows the binary, the mask, the range and the broadcast, and can split the network for you.
// PART 1 · LAB A
10. Lab A: see your own network
IN PLAIN WORDSYour laptop already has tools to ask the network questions. They are built in. No installation.
// OPEN THE COMMAND WINDOW
Windows: press the Windows key, type cmd, press Enter. Mac: press Command+Space, type Terminal, press Enter. Linux: open Terminal.
| Command | What it does | Mac or Linux |
|---|
| ipconfig /all | Shows your IP, mask, gateway, DNS and MAC address | ifconfig or ip a |
| ping nmu.edu.ng | Asks: are you there? Shows how long the answer took | ping nmu.edu.ng |
| tracert nmu.edu.ng | Lists every router (hop) between you and the website | traceroute nmu.edu.ng |
| nslookup nmu.edu.ng | Asks DNS for the IP address of a name | nslookup nmu.edu.ng |
// READING THE RESULTS
- ping: time=45ms is the round trip in milliseconds. Under 50 is good, over 300 is slow. Request timed out means no answer (or a firewall blocks ping).
- tracert: each line is a router. Stars (* * *) mean that router does not reply. More hops usually means a longer trip.
- ipconfig: look for IPv4 Address, Subnet Mask, Default Gateway and DNS Servers. Physical Address is your MAC.
// MY RESULTS
| Question | My answer |
|---|
| My IPv4 address | |
| My subnet mask | |
| My default gateway | |
| My DNS server | |
| My MAC address | |
| Ping time to nmu.edu.ng | |
| Number of hops | |
PRACTICE 9Is your address private? Ping your gateway. Ping 8.8.8.8. Then ping google.com. If the numbers work but the name does not, which service is broken?
// PART 1 · PORTS AND PROTOCOLS
11. Ports, TCP and UDP
IN PLAIN WORDSThe IP address finds the building. The port finds the room. TCP is a phone call that checks you heard. UDP is shouting across the road.
A computer can run many programs that use the network at the same time: a browser, email, a chat app. The port (a number from 0 to 65535) tells the computer which program should receive each packet. An IP address plus a port is called a socket, for example 93.184.216.34:443.
| Port | Service | Protocol |
|---|
| 80 | Web | HTTP |
| 443 | Secure web (padlock) | HTTPS |
| 22 | Remote login | SSH |
| 53 | Names | DNS |
| 25 / 587 | Sending email | SMTP |
| 110 / 143 | Reading email | POP3 / IMAP |
| 3389 | Windows remote desktop | RDP |
// TCP AND UDP
| TCP | UDP |
|---|
| Connects first? | Yes, a three-step handshake (hello, hello back, ready) | No, it just sends |
| Numbers the pieces? | Yes | No |
| Resends lost pieces? | Yes | No |
| Speed | Slower, safe | Faster, may lose data |
| Used for | Web pages, email, file transfer | Video calls, games, DNS questions |
A closed port is a door that is locked. An open port with a program behind it is a door that answers. Attackers search for open doors, so a firewall keeps open only the ports that are needed.
PRACTICE 10Which port does a normal web page use? Which port does the padlock version use? Why would a game choose UDP?
// PART 1 · PUTTING IT TOGETHER
12. You type nmu.edu.ng. What happens?
IN PLAIN WORDSEverything you learned so far happens in less than a second whenever you open a web page.
- DNS: your browser asks the DNS server: what is the IP address of nmu.edu.ng? The answer is a number.
- Connect: your laptop builds a packet for that IP address, port 443 (HTTPS), and starts a TCP handshake.
- Gateway: the packet goes to your default gateway, the router. Your private address is swapped for the public one (NAT).
- Route: the packet is passed from router to router across the internet (you can see them with tracert).
- Server: the web server receives the request on port 443, runs its program and builds the page.
- Return: the page comes back in many packets along a similar road. Your browser puts them in order and draws the page.
// WHAT EACH PIECE DID
| Piece | Job in this story |
|---|
| DNS | Found the address |
| IP address | Told routers where to send the packet |
| Port | Chose the right program on the server |
| TCP | Made sure all pieces arrived, in order |
| Gateway and router | Passed the packet on |
| NAT | Let many private devices share one public address |
| MAC address | Moved the packet one hop at a time |
| HTTPS | Scrambled the conversation (explained in Part 3) |
PRACTICE 11Run tracert nmu.edu.ng again. Count the hops. Pick one hop and look up its name. Can you tell the country?
// PART 1 · EQUIPMENT
13. Cables and equipment
IN PLAIN WORDSCables carry signals. The wire colours must go in a fixed order so every plug and device agree which wire does what.
A network cable (UTP) has 8 thin wires twisted in 4 pairs. Twisting cancels electrical noise. The plug is called RJ45. The maximum length is 100 metres. The standard order is T568B.
| Pin | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|
| T568B | white/orange | orange | white/green | blue | white/blue | green | white/brown | brown |
Hold the plug with the clip down and the contacts toward you when reading pins from the left, or follow your trainer. Straight cable: same order at both ends (computer to switch). Crossover: T568B at one end and T568A at the other (computer to computer, old equipment). Modern devices detect the type themselves.
// EQUIPMENT
| Device | What it does |
|---|
| Hub (old) | Repeats every message to every port. Noisy. No longer used. |
| Switch | Learns which device is on which port and sends each message only there. |
| Router | Joins different networks and chooses the best road out. |
| Access point | Gives Wi-Fi to devices and connects to the switch by cable. |
| Modem | Converts the provider's signal to one your router understands. |
| Firewall | Allows or blocks traffic by rules. |
| Patch panel, rack | Neat place where cables end, labelled at both ends. |
PRACTICE 12Do the cable game in the Practice Lab, tab 4. Put the 8 wires in order without looking, then time yourself.
// PART 1 · EQUIPMENT
14. VLANs and Wi-Fi
IN PLAIN WORDSA VLAN gives one switch several private rooms. Wi-Fi is radio, so nearby access points must use different channels.
// VLAN: VIRTUAL LAN
Without VLANs, every device on a switch can see every other. A VLAN splits the ports into groups. Staff computers go in VLAN 10 and students in VLAN 20. They cannot reach each other unless a router lets them, and the router can apply rules. It is cheaper and safer than buying two switches.
- A port belongs to one VLAN (an access port).
- A cable between two switches can carry several VLANs (a trunk).
- VLAN numbers go from 1 to 4094.
// WI-FI
| 2.4 GHz | 5 GHz |
|---|
| Range | Long, passes walls | Shorter |
| Speed | Slower | Faster |
| Crowded? | Very (microwaves, Bluetooth) | Less |
| Channels | Use only 1, 6 and 11 | Many, do not overlap |
- Security: use WPA2 or WPA3 with a long password. Change the factory password of the router. Do not use WEP.
- SSID is the Wi-Fi name. Hiding it is not real security.
- Place access points high and central, away from metal and thick walls.
PRACTICE 13Three access points are close together. Which channels do you choose and why?
// PART 1 · SECURITY AND SKILLS
15. Firewalls and troubleshooting
IN PLAIN WORDSA firewall is a gatekeeper with a list of rules. The safest rule is: block everything, then allow only what is needed.
| Rule | Action | Meaning |
|---|
| Allow port 443 from anywhere | Allow | Everyone may open the HTTPS website |
| Allow port 22 from the ICT office only | Allow | Only admins may log in remotely |
| Everything else | Deny | Closed by default |
Rules are read from top to bottom and the first match wins. Good firewalls keep logs, a diary of what was allowed and blocked, so you can find attacks and mistakes.
// TROUBLESHOOTING LADDER
- Layer 1: cable in, Wi-Fi on, lights green.
- Layer 2: right Wi-Fi name or switch port.
- Layer 3: does the device have an IP, mask and gateway? (ipconfig)
- Ping the gateway. If it fails, the problem is inside your network.
- Ping 8.8.8.8. If it fails, the problem is the internet connection or provider.
- Ping google.com. If the number worked but the name fails, the problem is DNS (try nslookup).
- Restart the device, then the router, then call the provider.
PRACTICE 14Ping 192.168.1.1 works. Ping 8.8.8.8 works. Open google.com fails. What do you check next?
// PART 2 · NETWORK PROGRAMMING
16. What is programming?
IN PLAIN WORDSA program is a recipe of exact steps. The computer is a very obedient cook that does exactly what is written, nothing more and nothing less.
| Word | Meaning | Example (JavaScript) |
|---|
| Program | A list of instructions | Everything you write |
| Language | A way of writing instructions | JavaScript, Python, PHP |
| Variable | A labelled box that holds a value | let age = 25; |
| Function | A named recipe you can reuse | function hello() { } |
| Condition | A choice | if (age > 17) { ... } |
| Loop | Repeat steps | for (const s of list) { ... } |
| Array | A list of values | ["ICT", "Library"] |
| Object | A thing with named parts | {name: "Amina", unit: "ICT"} |
| Comment | A note for people, ignored by the computer | // like this |
| Bug | A mistake in the program | Missing bracket |
// A TEA PROGRAM
water = 1 cup
sugar = 2 spoons
boil(water)
if (sugar is available) { add(sugar) }
repeat 10 times { stir() }
serve()The same ideas appear in every language. Only the spelling changes. Today you will meet JavaScript (in the browser), Python (online), SQL (for data) and a little PHP (on the server).
PRACTICE 15Write a program, in plain words, for withdrawing money from an ATM. Where are the conditions? Where is the loop?
// PART 2 · NETWORK PROGRAMMING
17. Sockets: two programs talking
IN PLAIN WORDSA socket is one end of a phone call between two programs. One program waits (the server). The other dials (the client).
- Server: bind to an address and port, then listen. It waits.
- Client: connect to the server's address and port. It dials.
- Server: accept. The call is open.
- Both sides send and receive data, then close.
// THE SAME IDEA IN PYTHON (FOR READING)
# server.py
import socket
s = socket.socket()
s.bind(("0.0.0.0", 5000))
s.listen()
conn, addr = s.accept()
data = conn.recv(1024)
conn.sendall(data) # echo it back
# client.py
import socket
c = socket.socket()
c.connect(("127.0.0.1", 5000))
c.sendall(b"hello")
print(c.recv(1024))Every web page uses sockets underneath: your browser is the client, the website is the server, and port 443 is the number dialled. You do not need to install anything today. The browser version of this idea comes next.
PRACTICE 16Which side calls listen? Which side calls connect? What does 127.0.0.1 mean? (Answer: it always means this same computer.)
// PART 2 · LAB B
18. fetch: a program asking the web for data
IN PLAIN WORDSfetch is a JavaScript command that sends a request over the network and waits for the answer. It is network programming in one line.
| Word | Meaning |
|---|
| API | A menu that programs use to ask other programs for data (no web page, just data) |
| JSON | A simple text format for data: {"name": "Amina", "age": 30} |
| Console | A place in the browser (F12) where you type JavaScript and see results |
| Request | What the client sends: a method (GET, POST), an address, optional data |
| Response | What the server sends back: a status code and data |
| then | Means: when the answer arrives, do this next |
// LAB B1: ASK DNS FOR AN ADDRESS
Open any web page. Press F12 (or right-click, Inspect), click Console, paste and press Enter:
fetch("https://dns.google/resolve?name=nmu.edu.ng&type=A")
.then(r => r.json())
.then(console.log)Click the small arrow to open the answer. Find Answer, then data: that is the IP address of the website.
// LAB B2: SEND DATA WITH POST
fetch("https://jsonplaceholder.typicode.com/posts", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({title: "Hello", userId: 1})
}).then(r => r.json()).then(console.log)The practice server answers with your data and a new id: 101. It does not save anything for real; it only pretends so that you can learn.
PRACTICE 17Change the website name in B1. Change title in B2. Try /posts/1 and /users/1 with a normal GET: fetch("https://jsonplaceholder.typicode.com/users/1").
// PART 2 · LAB C
19. Python in the browser: subnet maths
IN PLAIN WORDSPython can do in a second what we did on paper. Network engineers use it to plan and check big networks.
Open an online Python editor such as Programiz (programiz.com/python-programming/online-compiler) or Google Colab. Type the code and press Run.
import ipaddress
net = ipaddress.ip_network("192.168.10.0/24")
for sub in net.subnets(new_prefix=26):
print(sub, sub.netmask, sub.num_addresses - 2)| Line | Meaning |
|---|
| import ipaddress | Bring in Python's ready-made toolbox for IP maths |
| ip_network(...) | Make an object that represents the network |
| for sub in ... | Repeat for each smaller network |
| new_prefix=26 | Cut into /26 networks |
| print(...) | Show the result on the screen |
Expected result, four lines: 192.168.10.0/26 255.255.255.192 62, then .64/26, .128/26 and .192/26. It matches the table you made by hand.
// MORE THINGS TO TRY
a = ipaddress.ip_address("192.168.10.25")
print(a.is_private) # True
print(a in ipaddress.ip_network("192.168.10.0/24")) # TrueREAL LIFECompanies use tools such as Netmiko to log in to many switches by SSH and configure them with Python. It needs real devices, so we only talk about it today. The idea is the same: a program does repetitive network work.
PRACTICE 18Change 26 to 27. How many networks do you get, and how many devices does each hold? Compare with Practice 8.
// PART 3 · WEB PROGRAMMING
20. How a website works
IN PLAIN WORDSA website is a restaurant. The browser is the customer, the server code is the waiter and kitchen, and the database is the store room.
| Part | Runs where | Languages | Visitor can see it? |
|---|
| Front end | In the browser | HTML, CSS, JavaScript | Yes, everyone can view the source |
| Back end | On the server | PHP, Python, Node.js | No, only its output |
| Database | On the server | SQL (MySQL, SQLite, PostgreSQL) | No |
// THE URL
https://www.nmu.edu.ng/news?id=5
^^^^^ ^^^^^^^^^^^^^ ^^^^ ^^^^
protocol domain path query
// REQUEST AND RESPONSE
| Code | Meaning | Plain words |
|---|
| 200 | OK | It worked |
| 301 / 302 | Redirect | Look at this other address |
| 401 | Unauthorized | Please log in |
| 403 | Forbidden | You are not allowed |
| 404 | Not found | No such page |
| 500 | Server error | The server broke |
PRACTICE 19Open a website. Press F12 and click the Network tab. Reload. Find the first request and its status code. How many requests did one page need?
// PART 3 · FRONT END
21. HTML: the structure
IN PLAIN WORDSHTML is the walls and rooms of the house. It says what is on the page (a heading, a picture, a button), not how it looks.
| Word | Meaning | Example |
|---|
| Tag | A label in angle brackets | <h1> |
| Element | Opening tag + content + closing tag | <p>Hello</p> |
| Attribute | Extra information in a tag | <a href="https://nmu.edu.ng"> |
| Heading | Titles from h1 (biggest) to h6 | <h2>News</h2> |
| Paragraph | A block of text | <p>...</p> |
| Link | Goes to another page | <a href="...">Home</a> |
| Image | A picture | <img src="logo.png" alt="Logo"> |
| List | Bullets or numbers | <ul><li>One</li></ul> |
| Form | Collects data from visitors | <form><input><button></form> |
// A SMALL PAGE
<!DOCTYPE html>
<html>
<head><title>NMU ICT</title></head>
<body>
<h1>NMU ICT Unit</h1>
<p>Welcome to ICT.</p>
<a href="https://nmu.edu.ng">University website</a>
<form>
<input name="email" placeholder="Your email">
<button>Send</button>
</form>
</body>
</html>Almost every tag opens and closes: <p> ... </p>. The most common mistake is forgetting the closing tag. The <head> holds information about the page; the <body> holds what visitors see.
PRACTICE 20Open codepen.io, start a new Pen, and type this page into the HTML box. Add a second heading and a list of three items.
// PART 3 · FRONT END
22. CSS: the look
IN PLAIN WORDSCSS is the paint, curtains and furniture. The same HTML can look completely different with other CSS.
h1 { color: teal; font-size: 32px; }
.card {
border: 1px solid #ccc;
border-radius: 8px;
padding: 12px;
margin: 8px 0;
}
#menu { background: #0b1b33; color: white; }| Word | Meaning |
|---|
| Selector | Chooses what to style: h1 (all h1), .card (class), #menu (one id) |
| Property and value | color: teal; means: the property color gets the value teal |
| Class | A reusable name you add to many elements: class="card" |
| Box model | Every element is a box: content, then padding (inside space), border, then margin (outside space) |
| Flexbox | display:flex puts items in a row or column neatly |
| Grid | display:grid puts items in rows and columns |
| Media query | Different styles for phone and big screen |
| Responsive | A page that adapts to any screen size |
// MAKING A PAGE WORK ON A PHONE
<meta name="viewport" content="width=device-width, initial-scale=1">
#list { display: block; }
@media (min-width: 700px) {
#list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}Read it as: by default stack the items. If the screen is at least 700 pixels wide, show two columns. Most visitors in Nigeria use phones, so always design for a small screen first.
PRACTICE 21Add CSS to your Pen: a teal heading, a bordered card, and a media query. Resize the preview window to see it change.
// PART 3 · FRONT END
23. JavaScript: the behaviour
IN PLAIN WORDSJavaScript is the electricity. It makes lights and doors react when somebody clicks, types or taps.
| Word | Meaning | Example |
|---|
| Variable | A labelled box | let name = "Amina"; |
| const | A box whose label never changes | const pi = 3.14; |
| Function | A reusable block | function greet() { alert("Hi"); } |
| Event | Something the visitor does | click, input, submit |
| DOM | The page as objects JavaScript can change | document.querySelector("h1") |
| Array | A list | ["ICT", "Library"] |
| Arrow function | Short function form | x => x * 2 |
// REACTING TO A CLICK
const btn = document.querySelector("button");
btn.addEventListener("click", () => {
document.querySelector("h1").textContent = "You clicked!";
});Read it: find the button; when it is clicked, find the heading and change its text. The browser turns your HTML into a tree called the DOM, and JavaScript can read and edit any part of the tree.
// THE THREE LANGUAGES TOGETHER
| HTML | CSS | JavaScript |
|---|
| What is on the page | How it looks | What it does |
| Walls | Paint | Electricity |
| Noun | Adjective | Verb |
SAFETYNever put user text into a page with innerHTML. Use textContent. You will see why in the XSS pages.
PRACTICE 22Add a button to your Pen that changes the heading colour when clicked. Hint: element.style.color = "red".
// PART 3 · LAB D
24. Lab D: staff directory with live search
IN PLAIN WORDSYou will build a real interactive page in CodePen: a list of staff that filters while you type.
Open codepen.io, click Start Coding. Type these into the HTML, CSS and JS boxes. If CodePen is blocked, use jsfiddle.net.
// HTML
<h1>NMU ICT Staff</h1>
<input id="q" placeholder="Search a name">
<div id="list"></div>
// CSS
body { font-family: sans-serif; margin: 16px; }
input { padding: 10px; width: 100%; max-width: 420px; }
.card { border: 1px solid #ccc; border-radius: 8px; padding: 12px; margin: 8px 0; }
@media (min-width: 700px) { #list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }// JAVASCRIPT
const staff = [
{name: "Amina Bello", unit: "ICT", phone: "0800 000 0001"},
{name: "Tunde Okoro", unit: "Library", phone: "0800 000 0002"},
{name: "Ibrahim Musa", unit: "Registry", phone: "0800 000 0003"},
{name: "Grace Ebi", unit: "Bursary", phone: "0800 000 0004"}
];
const list = document.querySelector("#list");
function show() {
const text = document.querySelector("#q").value.toLowerCase();
list.textContent = "";
staff.filter(s => s.name.toLowerCase().includes(text)).forEach(s => {
const d = document.createElement("div");
d.className = "card";
d.textContent = s.name + " · " + s.unit + " · " + s.phone;
list.appendChild(d);
});
}
document.querySelector("#q").addEventListener("input", show);
show();HOW IT WORKSshow() clears the list, keeps only the staff whose name contains the typed text, and draws a card for each. The last lines run show() each time you type, and once at the start.
CHALLENGEAdd three more staff. Add a Sort button. Add a field that shows how many staff match. Bad day? Read the red message in the console and fix the first error only.
// PART 3 · DATA
25. Databases and SQL from zero
IN PLAIN WORDSA database is a set of Excel-like tables that programs can read and write fast and safely. SQL is the language you use to talk to it.
| Word | Meaning |
|---|
| Table | A sheet with a name: users, tasks |
| Row (record) | One entry in the table |
| Column (field) | One kind of information: email, role |
| Primary key | A unique number for each row, usually id |
| Foreign key | A column that points to a row in another table (user_id in tasks) |
| Query | A question or command to the database |
// THE FIVE COMMANDS
CREATE TABLE users (id INTEGER PRIMARY KEY, email TEXT, role TEXT);
INSERT INTO users (email, role) VALUES ('amina@nmu.edu.ng', 'staff');
SELECT * FROM users;
SELECT email FROM users WHERE role = 'admin';
UPDATE users SET role = 'admin' WHERE id = 1;
DELETE FROM users WHERE id = 1;| Command | Meaning |
|---|
| CREATE | Make a table |
| INSERT | Add a row |
| SELECT | Read rows (WHERE chooses which) |
| UPDATE | Change rows |
| DELETE | Remove rows |
WARNINGUPDATE and DELETE without WHERE change or remove every row. Always write WHERE first.
LAB: SQL PLAYGROUNDOpen sqliteonline.com, choose SQLite, and run the lines above one at a time with Run. Add three users, then select only the admins. Use single quotes only.
// PART 3 · BACK END
26. Server code, sessions and REST
IN PLAIN WORDSThe back end is code on the server that receives a request, talks to the database and sends back a page or data. Logging in is a conversation: prove who you are once, then show your ticket every time.
// REGISTER AND LOGIN
- Register: the visitor sends email and password. The server makes a hash of the password and saves the email and the hash. Never the real password.
- Login: the server finds the user, hashes the typed password and compares with the saved hash.
- If they match, the server starts a session: a record on the server saying this visitor is logged in. It sends the browser a cookie, a small note with the session number.
- On every next request the browser sends the cookie, so the server knows who you are.
- Logout: the server destroys the session.
// PHP, shown for reading
$hash = password_hash($pw, PASSWORD_DEFAULT);
$st = $pdo->prepare("INSERT INTO users (email, password_hash) VALUES (?, ?)");
$st->execute([$email, $hash]);
// at login:
password_verify($pw, $savedHash);// REST API
An API lets programs ask each other for data. REST is a tidy style: one address per thing, one method per action, answers in JSON.
| Method | Address | Meaning | Status |
|---|
| GET | /api/tasks | Read the list | 200 |
| POST | /api/tasks | Create a task | 201 |
| PUT | /api/tasks/5 | Change task 5 | 200 |
| DELETE | /api/tasks/5 | Remove task 5 | 204 |
You used GET and POST in Lab B. A web page with fetch can call such an API and draw the answer without reloading.
PRACTICE 23Why must the cookie not contain the password? What happens to the session when the user logs out?
// PART 3 · SECURITY
27. Passwords: hash, salt and encryption
IN PLAIN WORDSNever store the real password. A hash is like a meat mincer: you can turn meat into mince, but never mince back into meat.
| Word | Meaning | Use |
|---|
| Hash | A one-way scramble. Same input always gives the same output. It cannot be reversed. | Storing passwords |
| Salt | Random extra text added before hashing so two users with the same password get different hashes. | Protects against ready-made tables of hashes |
| Encryption | Scrambling that can be undone with a key. | HTTPS, files, messages |
| Key | The secret that locks and unlocks encryption. | |
// WHY HASH?
If a hacker steals a database of real passwords, every account is lost, and because people reuse passwords, their other accounts too. If only hashes are stolen, the hacker must guess passwords one by one. Good hashes (bcrypt, Argon2, PHP password_hash) are slow on purpose to make guessing expensive. Plain MD5 or SHA-256 alone are too fast for passwords.
// SEE IT YOURSELF
- Practice Lab, tab 5 (Hashing): type Welcome123. Then change to Welcome124. The whole hash changes.
- Switch on salt. The same password gives different hashes.
// STRONG PASSWORDS
- Long beats clever: four random words are better than P@ssw0rd.
- Never reuse a password. Use a password manager.
- Turn on two-factor authentication where possible.
PRACTICE 24Explain in one sentence the difference between hashing and encryption. Which one do we use for passwords?
// PART 3 · SECURITY
28. The three common attacks
IN PLAIN WORDSAttackers use the places where a website trusts what a visitor types. The cure is the same each time: treat everything typed as dangerous until proven safe.
// 1. SQL INJECTION
The attacker types part of a command into a box. Example in the email box: amina@nmu.edu.ng' --. The two dashes start a comment, so the password check is cut off:
SELECT * FROM users WHERE email = 'amina@nmu.edu.ng' --' AND password = '...'
Fix: prepared statements. The command is written first with empty slots (?). The values go in separately and are always treated as plain data.
// 2. XSS (CROSS-SITE SCRIPTING)
A visitor saves a comment that contains a script. Every other visitor's browser runs it, and it can steal their session. Fix: show text as text. Use textContent in JavaScript and htmlspecialchars() in PHP so that < becomes a harmless symbol.
// 3. CSRF (CROSS-SITE REQUEST FORGERY)
While you are logged in, another website tricks your browser into sending a request, such as change my email. Fix: put a secret token in every form and check it, and set cookies as SameSite.
| Attack | What is abused | Fix |
|---|
| SQL injection | Text glued into a database command | Prepared statements |
| XSS | Text shown as code in the page | Escape output, textContent |
| CSRF | The browser's saved login | Secret tokens, SameSite cookies |
RULEOnly test practice pages. Attacking a real website without permission is a crime.
PRACTICE 25Practice Lab: tab 6 (SQL injection) and tab 7 (XSS). Try the attack buttons in unsafe mode, then repeat in safe mode. Write what changed.
// PART 3 · GOING ONLINE
29. HTTPS, Git, GitHub and GitHub Pages
IN PLAIN WORDSHTTPS scrambles the conversation so nobody in the middle can read it. Git saves your work in steps. GitHub keeps a copy online and can show your page to the world for free.
// HTTPS
| Word | Meaning |
|---|
| HTTP | The web protocol; messages are readable by anyone on the road |
| HTTPS | HTTP inside a secure tunnel (port 443, padlock) |
| TLS | The system that builds the tunnel |
| Certificate | A digital ID card for a website, signed by a trusted authority |
| Man in the middle | Someone secretly listening or changing the messages |
Without HTTPS, a password typed on public Wi-Fi can be read by anyone nearby. Click the padlock in the browser and look at the certificate.
// GIT AND GITHUB
| Word | Meaning |
|---|
| Repository | A project folder that Git tracks |
| Commit | A saved point in time, with a note |
| Branch | A safe copy for trying new ideas |
| Merge | Bring a branch back into the main one |
| Push / pull | Upload to / download from GitHub |
// PUBLISH YOUR PAGE (GITHUB PAGES)
- Create a free account at github.com.
- Click New repository, name it my-first-site, choose Public, tick Add a README, Create.
- Click Add file, then Create new file, name it index.html, paste your page, click Commit changes.
- Open Settings, then Pages. Under Branch choose main and / (root), then Save.
- Wait about a minute. Your site is at https://yourname.github.io/my-first-site/ with a padlock.
- Edit index.html on GitHub and the live page updates.
PRACTICE 26Send your link to the person next to you. Open theirs. Is there a padlock? Who issued the certificate?
// MINI-PROJECT
30. Build in pairs: your department page
IN PLAIN WORDSMake a small web page for one NMU unit and put it online. 45 minutes. Pass mark 60 out of 100.
| Item | Marks | Tick |
|---|
| Page and content: heading, 3 sections, contact form (HTML and CSS) | 25 | |
| Works on a phone (media query, viewport) | 15 | |
| JavaScript behaviour: search box or button | 20 | |
| A fetch call to the test API, result shown on the page | 15 | |
| Published on GitHub Pages | 15 | |
| Network diagram and IP plan for the unit, drawn in app.diagrams.net | 10 | |
| Total | 100 | |
// STEP BY STEP
- Choose a unit: Library, Registry, ICT, Bursary, Student Affairs.
- Open CodePen. Build the HTML, then the CSS, then the JavaScript.
- Add a fetch to jsonplaceholder.typicode.com/users and list five names under Our partners.
- Test on your phone or by narrowing the preview.
- Copy the code to index.html on GitHub and publish with Pages.
- Open app.diagrams.net (choose Device, no sign-in needed) and draw: internet, router, switch, four floors with the IP plan from Section 9.
- Show your page and diagram to the class (2 minutes).
FOR THE TRAINEREach pair is scored on the table above. Everyone who reaches 60 passes. Marks are recorded on the scoring sheet.
// CHECKLIST BEFORE YOU SHOW
- The page opens at its GitHub link.
- The padlock is shown.
- It looks good at phone width.
- Search/button works.
- The diagram is saved or exported as an image.
// REVISION
31. Practice questions
IN PLAIN WORDSTry all 30 without looking, then check the answers on the next page. Mark the ones you got wrong and read that page again.
- What is a protocol?
- How many bits are in a byte?
- Write 10 in binary.
- What is the largest number a byte can hold?
- Name the five layers from top to bottom.
- Which address is fixed in the network card?
- What does DNS do?
- What does DHCP do?
- What does NAT do?
- How many usable devices in a /26?
- What is the mask for /25?
- Which address ends 0 and which ends 255 in a /24?
- Which port is HTTPS?
- Which is faster, TCP or UDP, and why?
- What is the T568B order?
- Which 2.4 GHz channels do not overlap?
- What does deny by default mean?
- What does a VLAN do?
- What does ping do?
- What does the server do in a socket pair?
- What is JSON?
- Which language shows structure, which shows look, which shows behaviour?
- What is a primary key?
- Which SQL command reads rows?
- Why do we hash passwords?
- What is a salt?
- What stops SQL injection?
- What stops XSS?
- What does the HTTPS padlock mean?
- What is a commit?
// REVISION
32. Answers
| # | Answer |
|---|
| 1 | A set of rules both sides follow to talk. |
| 2 | 8. |
| 3 | 00001010. |
| 4 | 255. |
| 5 | Application, Transport, Network, Data link, Physical. |
| 6 | The MAC address. |
| 7 | Turns a name into an IP address. |
| 8 | Gives IP settings automatically. |
| 9 | Lets many private addresses share one public address. |
| 10 | 62. |
| 11 | 255.255.255.128. |
| 12 | The network address (not used) and the broadcast address (not used). |
| 13 | 443. |
| 14 | UDP, because it does not check or resend. |
| 15 | white/orange, orange, white/green, blue, white/blue, green, white/brown, brown. |
| 16 | 1, 6 and 11. |
| 17 | Everything is blocked unless allowed. |
| 18 | Splits a switch into private groups of ports. |
| 19 | Checks whether another device answers and how fast. |
| 20 | Waits and accepts the call. |
| 21 | A simple text format for data. |
| 22 | HTML, CSS, JavaScript. |
| 23 | A unique number for each row. |
| 24 | SELECT. |
| 25 | So a stolen database does not reveal the real passwords. |
| 26 | Random text added before hashing so equal passwords give different hashes. |
| 27 | Prepared statements. |
| 28 | Escaping output / showing text as text. |
| 29 | The connection is encrypted. |
| 30 | A saved point in time in Git. |
PRACTICE ANSWERSP2: 5=00000101, 10=00001010, 192=11000000, 255=11111111; 00001111=15; 11110000=240. P3: layer 1, then 2, then 3. P5: 172.16 is the network, 5.200 is the host. P6: DNS. P8: /27 = 30 devices; borrow 3 bits, prefix /27. Worked-example Q1: 192.168.20.0/25 mask 255.255.255.128, usable .1-.126; 192.168.20.128/25 usable .129-.254. Q2: a /27 (30 devices) fits 25 computers. Q3: 192.168.10.140 is in 192.168.10.128/26. Q4: .63 is the broadcast address of the first network. P13: channels 1, 6 and 11. P14: DNS settings or the DNS server. P18: 8 networks of 30 devices.
// REFERENCE
33. Word list
| Word | Meaning |
|---|
| API | A menu programs use to ask each other for data |
| Array | A list of values |
| Bandwidth | How much data can pass in a second |
| Bit / byte | One 0 or 1 / eight bits |
| Branch | A safe copy of a project in Git |
| Broadcast | A message sent to all devices on a network |
| Client / server | The program that asks / the program that answers |
| Commit | A saved point in a Git project |
| Console | Browser place to type JavaScript |
| Cookie | A small note in your browser holding a session number |
| CSRF | Forged request using your logged-in browser |
| CSS | The language of the look of a page |
| DHCP | Gives IP settings automatically |
| DNS | Turns names into IP addresses |
| DOM | The page as objects JavaScript can change |
| Encryption | Scrambling that can be undone with a key |
| Firewall | A gatekeeper with rules |
| Function | A named reusable recipe |
| Gateway | The router address leading out of your network |
| Hash | A one-way scramble |
| Header | Extra information in front of data |
| HTML | The language of the structure of a page |
| HTTP / HTTPS | The web protocol / the secure version |
| IP address | Where a device is on a network |
| JavaScript | The language of page behaviour |
| JSON | A text format for data |
| LAN / WAN | Local / wide area network |
| MAC address | The fixed name of a network card |
| NAT | Many private addresses share one public address |
| Octet | One of the four numbers of an IPv4 address |
| Packet | A small piece of data with an address label |
| Port | A number naming a program on a computer |
| Primary key | A unique number for each table row |
| Protocol | Rules both sides follow |
| Query | A question or command to a database |
| REST | A tidy style of API using GET, POST, PUT, DELETE |
| Router | Joins different networks |
| Salt | Random text added before hashing |
| Session | The server's memory that you are logged in |
| Socket | One end of a program-to-program connection |
| SQL | The language of databases |
| SQL injection | Typing part of a database command into a form |
| SSID | The name of a Wi-Fi network |
| Subnet | A smaller network cut from a bigger one |
| Switch | Sends each message only to the right port |
| TCP / UDP | Reliable and ordered / fast but may lose data |
| TLS | The system that makes HTTPS secure |
| VLAN | Private groups of ports on one switch |
| XSS | Attack that runs the attacker's script in others' browsers |
// YOUR NOTES
My notes and questions
Write down what you want to remember, and questions to ask the trainer.
AFTER THE TRAININGRebuild one lab on your own this week. Keep your page on GitHub. Teach one colleague what you learned. That is the best way to remember it.