Script preview

Simpel Login

Browse, copy and download the individual files that make up this script.

Simple Login

A minimal, single-user PHP login system that doesn't require MySQL. Perfect for protecting an admin page or a small area of your site with a simple username and password.

This repository contains:

  • The tutorial page (index.php) that documents the code
  • The working demo login system (login.phpsecretpage.php)
  • A README explaining installation and usage

✨ Features

  • ✅ No database required (uses hardcoded credentials)
  • ✅ Session-based authentication
  • ✅ Redirects unauthenticated users to the login page
  • ✅ Shows separate error messages for wrong username / wrong password
  • ✅ Clean, responsive layout with Bootstrap 5
  • ⚠️ Only supports one user (username + password)
  • ⚠️ Not recommended for production without hashing & CSRF protection

📁 File Overview

| File | Purpose | |------|---------| | index.php | Tutorial page that displays the code for both files | | header.php | Shared header include (site branding, CSS) | | footer.php | Shared footer include (copyright, JS) | | login.php | The actual login form (working demo) | | secretpage.php | Protected page — only accessible after login | | logout.php | Destroys the session and returns to login | | style.css | Custom styles for the tutorial page |


🚀 Installation

  • Clone or download this repository to your web server directory.
  • Create the download ZIP:

- Put login.php, secretpage.php, and logout.php into a folder

  • Start a PHP server:

```bash php -S localhost:8000

Inside the script.

8 files available.

footer.php 473 bytes · 15 lines · 2026-09-13 15:27
1<?php
2// footer.php - shared site footer for myPHP.se
3?>
4<footer>
5 <div class="container-fluid">
6 <div class="footer-placeholder">
7 <p>myPHP.se — free PHP scripts · Simple Login System</p>
header.php 895 bytes · 28 lines · 2026-09-13 15:27
1<?php
2// header.php - shared site header for myPHP.se
3?>
4<!DOCTYPE html>
5<html lang="en">
6<head>
7 <meta charset="utf-8">
index.php 3,874 bytes · 129 lines · 2026-09-13 15:27
1<?php
2include "header.php";
3?>
4<!-- Welcome Section -->
5<section>
6 <div>
7 <div class="row">
login.php 1,465 bytes · 47 lines · 2026-09-13 15:27
1<?php
2session_start();
3$usererror = "";
4$passerror = "";
5
6if (isset($_POST['submit'])) {
7 $user = "admin"; // change username
logout.php 88 bytes · 6 lines · 2026-09-13 15:27
1<?php
2session_start();
3session_destroy();
4header('Location: login.php');
5exit();
6?>
readme.md 1,631 bytes · 50 lines · 2026-09-13 15:27
1Simple Login
2
3A minimal, single-user PHP login system that doesn't require MySQL.
4Perfect for protecting an admin page or a small area of your site with a simple username and password.
5
6This repository contains:
7- The **tutorial page** (`index.php`) that documents the code
secretpage.php 375 bytes · 20 lines · 2026-09-13 15:27
1<?php
2session_start();
3
4if (!isset($_SESSION['loggedin'])) {
5 header('Location: login.php');
6 exit();
7}
style.css 2,609 bytes · 138 lines · 2026-09-13 15:27
1/* myPHP.se — Simple Login System styles */
2body {
3 font-family: system-ui, 'Segoe UI', Roboto, sans-serif;
4 background: #f8fafc;
5 margin: 0;
6 padding: 0;
7}

Download Script

Get the complete source for Simpel Login — every file, ready to drop into your project.

Copied to clipboard!