Skip to content

brendef/Procedural-PHP-Login-MVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP Login & Register Procedural MVC

PHP application with a MVC folder structure that dynamically loads the necessary view, models and functions.

Installation

Clone this repository

git clone https://github.com/brendef/php_login_mvc.git

Create database using database script included (database.sql)

Usage

  1. Connect to database
function create_database_connection() {
        $servername = "localhost"; // Your Server or website domain
        $username = "root"; // Database user
        $password = ""; // Your Database user's password
        $databasename = "mvc"; // The Name of your the database

        // Connection variable to be used throughout the application to access the database
        $connection = mysqli_connect($servername, $username, $password, $databasename) or die("Error No. " . mysqli_connect_errno() . ": " . mysqli_connect_error());

        return $connection;

        // Display connection errors on screen 
        if (mysqli_connect_errno()) {
            echo "Failed to connect to database " . mysqli_connect_errno() . ': Message: ' . mysqli_connect_error();
        }
    }
  1. Change all header() functions to point to a relevant location in your app.
header('Location:?page=register&error=loginStatementFailed');

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors