PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Win Aung Cho   PHP Login System   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Login System
Create a system to manage users that access a site
Author: By
Last change: Update index.php
Date: 3 years ago
Size: 2,061 bytes


Class file image Download
 * LoginSystem Class
 * User data are stored in SQL database
 * Script create table for member data if there is no table in database.
 * Script add admin acount with username and password both are "admin".
 * Usesage
 * Include this class file at the begining of your page.
 * Assign $mypage variable before including class.
 * Place
 * echo$logsys->getMsg()
 * echo $logsys->getHtml();
 * anywhere in page for the message and form of login status.
 * Look into index.php as an example. Replace index.php with your page.
 * This class is free for the educational use as long as maintain this header together with this class.
 * Author: Win Aung Cho
 * Contact
 * version 1.0
 * Date: 28-9-2020

//$logsys = new LoginSystem();
$logsys = new LoginSystem("localhost", "_user", "password", "database");

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <style type="text/css">
        body{ font: 14px sans-serif; }
            margin: auto;
            width: 320px;
            border: 3px solid #73AD21;
            padding: 10px;
            overflow: auto;
            white-space: nowrap;
    <div class="usercontent">
echo "<span style=\"color:red\">".$logsys->getMsg()."</span>";
$logsys->getHtml(); ?>
<p>This page is an example using LoginSystem class. At the begining of the page, include following code.</p>
    &lt;?php <br/>
    &emsp; $mypage=1; <br/>
    &emsp; include("userclass.php"); <br/>
    &emsp; session_start(); <br/>
    &emsp; $logsys = new LoginSystem("localhost", "user", "password", "databasename"); <br/>
    &emsp; $logsys->runsystem(); <br/>
    ?&gt; <br/>
        Write 2 string variables at anywhere in page.