Jul 02 2017
Jul 02, 2017 Categorised in:

From the previous tutorial we already have our files and functions we need for a login form. In this tutorial we will use the same code and we will add some more functions and files to set up a Cookie and filter the information entered by users.

If you didn’t watch the previous tutorial you can find it on YouTube.

Our config.php file stays the same as in the previous tutorial:

<?php
class Connection extends PDO
{
    public function __construct()
    {
        parent::__construct("mysql:host=localhost;dbname=tutorial", 'root', '',
		array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
        $this->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    }
}
?>

 

Jun 26 2017
Jun 26, 2017 Categorised in:

Hello, everybody! Today we will talk about Login Forms for a website using PHP and AJAX. We will build a filter to secure the information from our form. Before we start, I want to let you know that this tutorial requires basic knowledge of HTML, CSS, PHP and JavaScript.

The first step will be to create a table in MySQL which will contain 4 columns: id, nickname, password and session. Here you have the SQL code to create a user table:

CREATE TABLE users (
    id int,
    nickname varchar(50),
    password varchar(100),
    session varchar(255),
    PRIMARY KEY (id)
);

If you use XAMPP you can find your phpMyAdmin using this link: http://localhost/phpmyadmin

Insert a new user using this SQL code:

INSERT INTO users (id, nickname, password)
VALUES (1, 'admin', 'admin123');

 

Page 2 of 2
« Previous Page |