The complete, working code from the video: a login and registration system in modern plain PHP, with no framework, protected against SQL injection, XSS, CSRF, session hijacking and brute-force attacks.
password_hash() with bcrypt, auto-upgraded by password_needs_rehash()hash_equals()e() helpersession_regenerate_id() right after loginDEBUG switch)auth-2026 folder into C:\xampp\htdocs\http://localhost/phpmyadmin, click New and create a database named auth_2026 (collation utf8mb4_unicode_ci)auth_2026 selected, open the Import tab, choose database/schema.sql and click Importhttp://localhost/auth-2026/public/ and create your first accountSeeing Unknown database 'auth_2026'? You skipped step 3: create the database first, then import. Using Laragon? Put the folder in C:\laragon\www\ and visit http://auth-2026.test/public/.
src/bootstrap.php set const DEBUG = false; so visitors only see a plain error messageroot, and update config.phppublic/ folderauth-2026/
├── config.php settings (DB login, rate limit)
├── database/schema.sql tables
├── public/ the only folder the browser can reach
│ ├── index.php register.php login.php dashboard.php logout.php
│ └── assets/style.css
└── src/ app code, not reachable from the browser
├── bootstrap.php session, headers, error handler, loads everything
├── db.php config() and db() (PDO)
├── helpers.php e(), input(), old(), redirect(), flash()
├── csrf.php csrf_token(), csrf_field(), csrf_verify()
├── auth.php current_user(), login/logout, rate limiting
└── views/ header.php, footer.php
AUZ Dynamics builds fast, secure WordPress and custom PHP websites for clients across North America.
Free to use under the MIT License · Made by AUZ Dynamics · Tutorial by AUZ Tutorials