Recently Updated Pages
Adding Role-Based Access Control
Role-based access control allows authenticated users to perform only the actions permitted by the...
Creating a Logout Page
Logout should remove server-side session data, expire the session cookie and return the user to a...
Protecting Pages and Preventing Unauthorised Access
A protected page checks authentication on the server before sending restricted content. Hiding a ...
Using PHP Sessions to Keep Users Logged In
PHP sessions store a small amount of trusted server-side state between requests. A login system c...
Creating a Login Form
This standalone login page validates credentials with PDO, starts a secure session and redirects ...
Creating a User Registration Form
This standalone registration page accepts a fictional username and password, validates both on th...
Secure Password Storage with Password Hashing
Password hashing converts a password into a one-way value suitable for storage. PHP automatically...
Exporting Processed Data to CSV
CSV export can support download and reuse of a filtered or processed result. It is optional when ...
Creating Charts from Processed SQL Data
A chart is useful only when it makes a comparison or pattern easier to understand. JavaScript is ...
Creating Match and Player Views
A detail view lets a user move from a summary to the record needed for a task. Receive a validate...
Calculating Summary Statistics
Statistics reduce a dataset to information users can interpret. SELECT COUNT(*) AS result_count...
Building a Leaderboard
A leaderboard converts stored results into a ranked, understandable output. SELECT team_name, ...
Querying Data for a User Need
A query is meaningful when it answers a user question. Begin with the need, then choose fields, f...
Testing an Admin CSV Import
Testing must cover permissions, validation, database effects and feedback. Test Condition Expecte...
Building a Complete Admin CSV Import
A complete import combines access control, upload checks, parsing, row validation, prepared state...
Reporting CSV Import Results
An administrator needs evidence of what happened, not just “upload complete”. Report useful total...
Inserting Imported Rows Safely
Prepare the insert once, then execute it for each valid row. $insert = $pdo->prepare( "INSERT...
Validating CSV Rows
Validate every row before storing it. if (count($row) !== 4) { $rowErrors[] = "Row $rowNumber...
Reading CSV Rows with fgetcsv
Use PHP’s CSV parser so quoted commas and escaped values are handled correctly. $handle = fopen($...
Validating an Uploaded CSV File
Validate the upload before reading its rows. $file = $_FILES["dataset"] ?? null; $errors = []; if...