Skip to content
  • Home
  • Server-Side
    • php
    • Node.js
    • ASP.NET
    • Magento
    • Codeigniter
    • Laravel
    • Yii
    • CRUD
      • CRUD Database Application
      • CRUD operation in Client side
      • CRUD operation with server side
  • JavaScript
    • AngularJS
    • Ajax
    • VueJs
    • jQuery
    • ReactJS
    • JavaScript
    • SEO
  • Programming
    • Android
    • C programming
    • CSS
    • Mysql
    • Mysqli
  • Technology
    • Software
      • webinar software
      • webinar conferencing software
      • soundproof
    • Adsense
      • Google
      • Earn Money
      • Google Adsense
        • Adsense fraud
        • Adsense Secrets
        • Adsense software
        • Adwords advice
        • Adwords strategy
        • Google adwords help
        • How to get google ads
    • Tips and Tricks
    • Interview
    • Insurance
    • Religious
    • Entertainment
      • Bollywood
      • tamilrockers
      • Hollywood
  • Health Care
    • LifeStyle
    • Women
    • Fashion
    • Top10
    • Jobs
  • Tools
    • Screen Resolution
    • WORD COUNTER
    • Online Text Case Converter
    • what is my screen resolution?
  • Guest Post
    • 4cgandhi
    • IFSC Code

jQuery Ajax Secure Login Registration System in PHP and MySQL

April 14, 2020 by Pakainfo

Today, We want to share with you jQuery Ajax Secure Login Registration System in PHP and MySQL with validation code free download.In this post we will show you Create a Registration and Login System with PHP and MySQL, hear for Secure Login System with PHP and MySQL we will give you demo and example for implement.In this post, we will learn about student registration form in php code with validation with an example.

jQuery Ajax Secure Login Registration System in PHP and MySQL with validation code free download

There are the Following The simple About Full Information With Example and source code.

As I will cover this Post with live Working example to develop Creating a User Login System with PHP and MySQL, so the some major files and Directory structures for this example is following below.

How to create a Registration and Login System with PHP and MySQL

first of all Here are Main step to read and copy paste your file simple steps you have to follow to make a login system.

JQuery AJAX Login And Registration Form Using PHP MySQLi
  • Step: 1Make a Database and Database Table
  • Step: 2Connect to the Database
  • Step: 3Session Make for Logged in User
  • Step: 4Make a Registration and Login Form
  • Step: 5Make a Dashboard Page
  • Step: 6Make a Logout (Destroy session)
  • Step: 7CSS File Make
Read Also:  Laravel 6 Define Global Constants Config PHP file

Step: 1Make a Database and Database Table

CREATE DATABASE memnerSignProject;

CREATE TABLE IF NOT EXISTS `users` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `authclient_name` varchar(50) NOT NULL,
 `email` varchar(50) NOT NULL,
 `authclient_password` varchar(50) NOT NULL,
 `member_created_at` datetime NOT NULL,
 PRIMARY KEY (`id`)
);

Step: 2Connect to the Database

databaseconfig.php

<?php
    $con = mysqli_connect("localhost","root","root","memnerSignProject");
    // Check connection
    if (mysqli_connect_errno()){
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
?>

Step: 3Session Make for Logged in User

auth_session.php

<?php
    session_start();
    if(!isset($_SESSION["authclient_name"])) {
        header("Location: signin.php");
        exit();
    }
?>

Step: 4Make a Registration and Login Form

registration.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Registration</title>
    <link rel="stylesheet" href="style.css"/>
</head>
<body>
<?php
    require('databaseconfig.php');
    if (isset($_REQUEST['authclient_name'])) {

        $authclient_name = stripslashes($_REQUEST['authclient_name']);

        $authclient_name = mysqli_real_escape_string($con, $authclient_name);
        $email    = stripslashes($_REQUEST['email']);
        $email    = mysqli_real_escape_string($con, $email);
        $authclient_password = stripslashes($_REQUEST['authclient_password']);
        $authclient_password = mysqli_real_escape_string($con, $authclient_password);
        $member_created_at = date("Y-m-d H:i:s");
        $query    = "INSERT into `users` (authclient_name, authclient_password, email, member_created_at)
                     VALUES ('$authclient_name', '" . md5($authclient_password) . "', '$email', '$member_created_at')";
        $result   = mysqli_query($con, $query);
        if ($result) {
            echo "<div class='form'>
                  <h3>You are registered successfully.</h3><br/>
                  <p class='link'>Click here to <a href='signin.php'>Login</a></p>
                  </div>";
        } else {
            echo "<div class='form'>
                  <h3>Required fields are missing.</h3><br/>
                  <p class='link'>Click here to <a href='registration.php'>registration</a> again.</p>
                  </div>";
        }
    } else {
?>
    <form class="form" action="" method="post">
        <h1 class="login-title">Registration</h1>
        <input type="text" class="login-input" name="authclient_name" placeholder="Username" required />
        <input type="text" class="login-input" name="email" placeholder="Email Adress">
        <input type="password" class="login-input" name="authclient_password" placeholder="Password">
        <input type="submit" name="submit" value="Register" class="login-button">
        <p class="link"><a href="signin.php">Click to Login</a></p>
    </form>
<?php
    }
?>
</body>
</html>

Step: 5Make a Dashboard Page

signin.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Login</title>
    <link rel="stylesheet" href="style.css"/>
</head>
<body>
<?php
    require('databaseconfig.php');
    session_start();
    // When form submitted, check and create client session.
    if (isset($_POST['authclient_name'])) {
        $authclient_name = stripslashes($_REQUEST['authclient_name']);    // removes backslashes
        $authclient_name = mysqli_real_escape_string($con, $authclient_name);
        $authclient_password = stripslashes($_REQUEST['authclient_password']);
        $authclient_password = mysqli_real_escape_string($con, $authclient_password);
        // Check client is exist in the database
        $query    = "SELECT * FROM `users` WHERE authclient_name='$authclient_name'
                     AND authclient_password='" . md5($authclient_password) . "'";
        $result = mysqli_query($con, $query) or die(mysql_error());
        $rows = mysqli_num_rows($result);
        if ($rows == 1) {
            $_SESSION['authclient_name'] = $authclient_name;
            // Redirect to client dashboard page
            header("Location: dashboard.php");
        } else {
            echo "<div class='form'>
                  <h3>Incorrect Username/authclient_password.</h3><br/>
                  <p class='link'>Click here to <a href='signin.php'>Login</a> again.</p>
                  </div>";
        }
    } else {
?>
    <form class="form" method="post" name="login">
        <h1 class="login-title">Login</h1>
        <input type="text" class="login-input" name="authclient_name" placeholder="Client Name" autofocus="true"/>
        <input type="password" class="login-input" name="authclient_password" placeholder="Enter your Secure Password"/>
        <input type="submit" value="Login" name="submit" class="login-button"/>
        <p class="link"><a href="registration.php">New Registration</a></p>
  </form>
<?php
    }
?>
</body>
</html>

dashboard.php

<?php
//include auth_session.php file on all user panel pages
include("auth_session.php");
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Dashboard - Client area</title>
    <link rel="stylesheet" href="style.css" />
</head>
<body>
    <div class="form">
        <p>Welcome To, <?php echo $_SESSION['authclient_name']; ?>!</p>
        <p>You are now user dashboard page.</p>
        <p><a href="logout.php">Logout</a></p>
    </div>
</body>
</html>

Step: 6Make a Logout (Destroy session)

logout.php

<?php
    session_start();
    // Destroy session
    if(session_destroy()) {
        // Redirecting To Home Page
        header("Location: signin.php");
    }
?>

Step: 7CSS File Make

style.php

body {
    background: #3e4144;
}
.form {
    margin: 50px auto;
    width: 300px;
    padding: 30px 25px;
    background: white;
}
h1.login-title {
    color: #666;
    margin: 0px auto 25px;
    font-size: 25px;
    font-weight: 300;
    text-align: center;
}
.login-input {
    font-size: 15px;
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 25px;
    height: 25px;
    width: calc(100% - 23px);
}
.login-input:focus {
    border-color:#6e8095;
    outline: none;
}
.login-button {
    color: #fff;
    background: #55a1ff;
    border: 0;
    outline: 0;
    width: 100%;
    height: 50px;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
}
.link {
    color: #666;
    font-size: 15px;
    text-align: center;
    margin-bottom: 0px;
}
.link a {
    color: #666;
}
h3 {
    font-weight: normal;
    text-align: center;
}

Web Programming Tutorials Example with Demo

Read :

  • Jobs
  • Make Money
  • Programming
Read Also:  Vue Instant Search Example Demo

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about registration and login form in php and mysql with validation code free download.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  Create a Registration and Login System with PHP and MySQL

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  jQuery Ajax GET & POST REQUEST Methods PHP MySQLi
  2. Read Also:  PHP Strong Random Number and String Generator
  3. Read Also:  PHP Add JSON object Data Example
  4. Read Also:  registration and signin form in php and mysql with validation
  5. Read Also:  Concat Multiple MySQL Rows GROUP_CONCAT
  6. Read Also:  How to create a Login page with PHP and MySQL
  7. Read Also:  jQuery AJAX login and registration Form using PHP MySQLi
  8. Read Also:  Move Laravel Project From localhost to live production server
  9. Read Also:  PHP Dynamic PDF Files Tutorial using fpdf
  10. Read Also:  Authentication registration and Secure login System using php
Categories Ajax, JavaScript, jQuery, Mysql, Mysqli, php Tags complete login system php mysql, Create a Registration and Login System with PHP and MySQL, Creating a User Login System with PHP and MySQL, login and registration form in php using session, login system php source code, php: complete Login and registration system with php & mysql download, registration and login form in php and mysql, registration and login form in php and mysql with validation code free download, Secure Login System with PHP and MySQL, Secure Registration System with PHP and MySQL, simple login form in php, student registration form in php code with validation
Post navigation
PHP Check If String Contains Substring
Zip and Unzip Command using Linux(Ubuntu) Terminal

Categories

Ajax (415) AngularJS (357) ASP.NET (61) Bollywood (34) Business (16) Codeigniter (141) C programming (13) CSS (62) Earn Money (50) Education (30) Entertainment (40) Events (14) Google Adsense (58) Government (13) Highcharts (77) Hollywood (33) Interview (18) JavaScript (854) Jobs (25) jQuery (931) Laravel (998) LifeStyle (30) linux (18) Magento (13) Mysql (865) Mysqli (773) Node.js (34) php (1671) Programming (2171) Python (44) ReactJS (33) SEO (22) Software (16) Software (38) tamilrockers (29) Tech (15) Technology (2179) Tips and Tricks (75) Tools (27) Top10 (109) VueJs (249) Web Technology (28) wordpress (135) World (22) Yii (14)
© 2021 Pakainfo • Developed By Pakainfo.com