leviroiz.dev Back to the album
PT

Track 07 · Academic demoPHP 8.2, MariaDB, Docker and GitHub Actions

Presentes da Cegonha

I built this storefront in 2023 as my final technical-school IT project. Three years later, I returned to the same code.

Compare versions
2023 Technical-school final project
Order and stock updates ran separately.
2026 Project revision
Order and stock changes are now saved in one transaction.

The story

In 2023, the goal was to get the store working. In 2026, I came back to the same code with a different question: who does this code trust?

I kept the original PHP structure and changed how it handles inputs: prepared statements, password hashes, CSRF protection, prices read from the database, and atomic order and stock updates. Then I added Docker and a CI pipeline that tests over HTTP against MariaDB.

The Presentes da Cegonha storefront, created in 2023.
The original storefront from 2023.

What changed under the hood?

Choose a scenario and switch between years. You can see the simulation result and open the corresponding code excerpt.

What changes

View code excerpt


        
Under the hoodconstraints, steps and details

What changed

  • Concatenated SQL → prepared statements.
  • Plain-text passwords → password_hash and password_verify.
  • Hard-coded credentials → environment variables.
  • Deletion via GET → POST with authorization and CSRF protection.
  • Browser-supplied prices → prices from the database.
  • Separate order and stock writes → one transaction.
  • Manual setup → Docker. CI now runs tests with MariaDB and HTTP.

What I would do next

  • Limit login attempts and apply progressively longer lockouts.
  • Password recovery with short-lived, single-use tokens.
  • A data retention and deletion policy aligned with Brazil's LGPD.
  • HTTP security headers and mandatory HTTPS on a public deployment.

The README documents 11 changes side by side. I kept parts of the original structure so the evolution remains visible.

End of the albumBack to the beginning