In this article, we will explain how to create a login system in PHP using a session.['username']!=$username && $row['password']!=$password) { $error="<p>Wrong User Name and Password</p>"; } if(isset($error)) { echo $error; } else{ require('db.php'); session_start(); $result =mysql_query("select * from users …
In this article, we will explain how to create a login system in PHP using a session.
['username']!=$username && $row['password']!=$password) { $error="<p>Wrong User Name and Password</p>"; } if(isset($error)) { echo $error; } else{ require('db.php'); session_start(); $result =mysql_query("select * from users
after login, we need to fetch Username. We will explain How to Fetch Logged in Username.index.php<?php include("db.php"); session_start(); if($_SESSION['username']=="") { session_destroy(); header("location:index.php"); } ?> <html> <head> <title>Fetch Loged in Username</title> </head> </body> <?php include('db.php'); $query="select * from user …
after login, we need to fetch Username. We will explain How to Fetch Logged in Username.
index.php
<?php include("db.php"); session_start(); if($_SESSION['username']=="") { session_destroy(); header("location:index.php"); } ?> <html> <head> <title>Fetch Loged in Username</title> </head> </body> <?php include('db.php'); $query="select * from user