Create a Login and Logout easily for a Web-Base System Using PHP, MySql, HTML

Create a Login and Logout easily for a Web-Base System Using PHP, MySql, HTML

In this video, today you are going to learn how to create a login and logout system easily for a web-based system using PHP, MySql, HTML. First, you need to Install a localhost server(eg:- XAMPP, WampServer) to your pc.

In this video, today you are going to learn how to create a login and logout system easily for a web-based system using PHP, MySql, HTML. First, you need to Install a localhost server(eg:- XAMPP, WampServer) to your pc. Then go to the htdocs file in the localhost server. Then create a new folder inside the htdocs name login(you can use any name for this folder). Then you need to create those files "database connenction.php", "home.php", "login.php", and "logout process.php" inside that login folder. Now files are ready.

Subscribe: https://www.youtube.com/channel/UCNDmzGYwwT3rdY3xQuW8QOA

Source codes:

login.php


<!--<!DOCTYPE html>
<html>
<head>
    <title>Login page</title>
</head>
<body>

<center>

    <p>Login</p>

<form action="login process.php" method="POST">

    <input type="text" id="user" name="username" placeholder="username"/><br><br>
    <input type="text" id="pass" name="password" placeholder="password"/><br><br>
    <button type="submit" id="btn" name="login" default>login</button>

</form>

</center>

</body>
</html>-->

home.php


<!--<?php session_start();
if(empty($_SESSION['id'])):
    header('Location:login.php');
endif;
?>

<!DOCTYPE html>
<html>
<head>
    <title>Home page</title>
</head>
<body>

    <a href="logout process.php"><div style="float:right"><button>logout</button></div></a>

    <h1>Welcome to home page...!</h1>

</body>
</html>-->

database connection.php


<?php
$con = mysqli_connect("localhost","root","","login_db");

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
?>

login process.php



<!--<?php session_start();

include('database connection.php');

if(isset($_POST['login']));
{
    $user_unsafe=$_POST['username'];
    $pass_unsafe=$_POST['password'];

    $user = mysqli_real_escape_string($con,$user_unsafe);
    $pass = mysqli_real_escape_string($con,$pass_unsafe);

    $query=mysqli_query($con,"select * from login where username='$user' and password='$pass'")or die(mysqli_error($con));

    $row=mysqli_fetch_array($query);

         $name=$row['username'];
         $counter=mysqli_num_rows($query);
         $id=$row['id'];

         if ($counter == 0)
         {
            echo "<script type='text/javascript'>alert('Invalid Usrename or Password!');
            document.location='login.php'</script>";
         }
         else
         {
            $_SESSION['id']=$id;
            $_SESSION['username']=$name;

            echo "<script type='text/javascript'>document.location='home.php'</script>";
         }

}

?>-->

logout process.php


<!--<?php session_start();
if(empty($_SESSION['id'])):
    header('Location:login.php');
endif;
?>
<!DOCTYPE html>
<html>
<body>
    <div style="width:150px;margin:auto;height:500px;margin-top:300px">

    <?php
     include('database connection.php');
     session_destroy();

     echo '<meta http-equiv="refresh" content="2;url=login.php">';
     echo '<progress max=100><strong>Progress: 60% done.</strong></progress><br>';
     echo '<span class="itext">Logging out please wait!...</span>';

    ?>
    </div>

</body>
</html>-->

php mysql javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Country State City Dropdown list in PHP MySQL PHP

Country state city dropdown using ajax in php. You'll learn how to populate country city state dropdown based on previous selection in php using ajax

Best MySQL DigitalOcean Performance – ScaleGrid vs. DigitalOcean Managed Databases

Compare ScaleGrid MySQL vs. DigitalOcean Managed Databases - See which offers the best MySQL throughput, latency, and pricing on DigitalOcean across workloads.

Connecting a MySQL Database to a JavaScript Chart Using PHP

JavaScript is client-side. Querying a database requires server-side for security. In this tutorial, we will be covering how to query a MySQL database using PHP. We will describe the steps involved and reveal that it is in fact not challenging at all, just different! When using a charting library like AnyChart, which makes visualizing data so quick and easy, often the most challenging step for beginners is loading data.

Autocomplete Textbox with Javascript, PHP and MySQL

In this guide, we will walk through how to add autocomplete to a textbox, with the help of jQuery and also an alternative that works with just vanilla Javascript.

How to Create a Dynamic Drop Down List Using JavaScript and PHP MySQL

In this video we will show you how to create dynamic drop down list using JavaScript and PHP MySQL