Project: Dynamic Website
Build a complete dynamic, database-driven website with PHP — the capstone before Laravel makes it all easier.
What you will learn
- Combine every PHP skill
- Add login with sessions
- Produce a real, multi-page app
The brief
Build a complete dynamic site — a blog, a small store, or a directory — with PHP and MySQL.
- Multiple pages sharing a header/footer.
- A database with at least two related tables.
- Full CRUD on the main resource (PDO + prepared statements).
- A simple login using sessions, protecting the admin pages.
- Server-side validation and
htmlspecialcharsescaping everywhere. - Clean, organised files (config, includes, pages).
Tackle this capstone in stages — build the public site first, then add the login that protects the admin actions. A clear order keeps a big project manageable:
- Plan the database: design at least two related tables (for example
postsandusers) and write aconfig.phpthat opens a PDO connection. - Lay out the shell: build
header.phpandfooter.phpandincludethem on every page so the whole site shares one layout. - Build the public pages: list the main resource and a single-item detail page, each reading from the database with prepared
SELECTqueries. - Add full CRUD: create the add, edit and delete scripts for the main resource, every query using prepared statements and every form server-side validated.
- Add login with sessions: make a login form that checks the user, then
session_start()and store the logged-in user in$_SESSION; add a logout that callssession_destroy(). - Protect the admin pages: at the top of each create/edit/delete script, check
$_SESSIONfor a logged-in user and redirect to the login page if it is missing. - Harden and tidy: escape all output with
htmlspecialchars(), confirm no SQL is built by string-joining, and organise files into config, includes and pages.
Note: This is the same flow real sites follow: build the data and pages, wrap the dangerous actions (create/update/delete) behind a login, then lock everything down. Steps 5–6 are exactly the auth process from the sessions lesson applied to a whole app.
Note: When you finish, you will have built a full dynamic site by hand. Next, Laravel gives you all of this — routing, database, auth, templates — in a fast, elegant framework. You will appreciate exactly what it does for you.
✍️ Practice
- Build the dynamic site meeting all six requirements.
- Add a login that protects the create/edit/delete pages.
🏠 Homework
- Write a short README describing your app’s pages, database tables and features.