Creating the login page
Let's start by creating the login page for this application. Here we will perform a simple implementation using PHP. We will create login.php
and logout.php
. However, we will not go into too much detail about the login logic here because this book is focused on Ext JS and not PHP.
Create the variable you will input in SQL and then just pull the user information from the database.
The source code is very long, so please go to the source file to view the login.php
file from the 01_making_the_login
folder and logout.php
from 01_making_the_login
.
Store the user data for the session with the key USERINFO
. Again, to be able to perform a login check, change index.html
to index.php
and run the login check. Apart from the PHP code at the beginning, it's the same as index.html
(source file: 01_making_the_login/index.php
):
<?php session_start(); if(!isset($_SESSION['USERINFO'])) { header("Location: ./login.php"); } ?> <!DOCTYPE HTML> ... </html>