Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

89 total results found

Secure Password Storage with Password Hashing

PHP and MySQL Login Systems

Password hashing converts a password into a one-way value suitable for storage. PHP automatically includes a salt, so the same password can produce different valid hashes. Use fictional test passwords only. Never enter your school, email, banking or reused per...

Creating a User Registration Form

PHP and MySQL Login Systems

This standalone registration page accepts a fictional username and password, validates both on the server, hashes the password and inserts a standard user account with PDO. Database connection The example expects includes/db.php to create a PDO object named ...

Creating a Login Form

PHP and MySQL Login Systems

This standalone login page validates credentials with PDO, starts a secure session and redirects authenticated users. It uses one generic failure message so it does not reveal whether a username exists. Login page <?php session_start(); require __DIR__ . "/inc...

Using PHP Sessions to Keep Users Logged In

PHP and MySQL Login Systems

PHP sessions store a small amount of trusted server-side state between requests. A login system can use them to remember the authenticated user’s identifier, username and role. Start the session Call session_start() before HTML or other output: <?php session_...

Protecting Pages and Preventing Unauthorised Access

PHP and MySQL Login Systems

A protected page checks authentication on the server before sending restricted content. Hiding a menu link is not protection because a user can enter the URL directly. Require a logged-in user Place this before any HTML: <?php session_start(); if (!isset($_SES...

Creating a Logout Page

PHP and MySQL Login Systems

Logout should remove server-side session data, expire the session cookie and return the user to a safe public page. Logout script Create logout.php: <?php session_start(); $_SESSION = []; if (ini_get("session.use_cookies")) { $parameters = session_get_coo...

Adding Role-Based Access Control

PHP and MySQL Login Systems

Role-based access control allows authenticated users to perform only the actions permitted by their stored role. This example uses two roles: user and admin. Database role A suitable users table contains: role VARCHAR(20) NOT NULL DEFAULT 'user' Ordinary reg...

Creating a Navigation Menu Based on User Roles

PHP and MySQL Login Systems

Role-aware navigation shows users the actions available to them. It improves usability, but server-side checks remain responsible for security. Start with a protected page <?php require __DIR__ . "/includes/require-login.php"; $username = $_SESSION["username"]...

Backing Up a XAMPP Project

Developer Toolbox XAMPP Backup and Recovery

A working XAMPP project normally has two separate parts: website files inside htdocs and data stored in MySQL. A complete backup needs both. Back up project files Stop active editing and save every file. Locate the project folder inside htdocs. Copy the enti...

Restoring a XAMPP Project from Backup

Developer Toolbox XAMPP Backup and Recovery

Restoring a XAMPP Project from Backup recreates both the website files and the MySQL database. Work from a copy of the backup so the original remains unchanged. Restore project files Install and test XAMPP. Stop Apache and MySQL before replacing project files....

Moving a XAMPP Project to Another Computer

Developer Toolbox XAMPP Backup and Recovery

Moving a XAMPP project requires a verified backup of both the project files and its database. Prepare the source computer Save all source files. Export the project database as SQL through phpMyAdmin. Copy the complete project folder from htdocs. Include the S...

New Page

Working with Data

Creating a Security Events Table

Working with Data Importing JSON into MySQL with PHP

In this tutorial, you will create a MySQL table to store security event data imported from a JSON file. The JSON file contains homes, devices and events. Rather than storing the entire JSON structure, each event will be stored as a separate row in a database t...

Importing JSON into MySQL with PHP

Working with Data Importing JSON into MySQL with PHP

This tutorial imports a fictional JSON dataset into MySQL using PHP, PDO, validation and a prepared statement. Use fictional data only. Do not import real student, staff, account, device or school-security information. Project files Create this structure insid...

Querying Imported Data with SQL

Working with Data Importing JSON into MySQL with PHP

In this tutorial, you will use SQL queries to analyse the imported data. View All Events Open phpMyAdmin and select the: security_events table. Run: SELECT * FROM security_events; This displays all imported records. Count All Events To find the total number of...

Building a Security Dashboard Using PHP and MySQL

Working with Data Importing JSON into MySQL with PHP

This standalone example queries fictional security-event data with PDO and presents useful summary and detail output. A dashboard is meaningful when each output answers a user question. Do not add a statistic or chart merely because it is easy to calculate. Co...

Loading JSON Data with JavaScript

Working with Data Working with JSON Data in JavaScript

In this tutorial, you will load data from a JSON file and display it on a webpage using JavaScript. The JSON file contains information about a smart home, including devices and security events. Create the Project Files Create a new folder called: json-demo Ins...

Displaying JSON Data in a Table

Working with Data Working with JSON Data in JavaScript

In this tutorial, you will display the device data in an HTML table using JavaScript. Current Project Structure Your project should contain: json-demo ├── index.html ├── script.js └── smart_security_data.json Create a Table Container Open: index.html Update th...