How to Create a Login system in PHP Using a Session
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 where username='$username' and password='$password'"); while($row=mysql_fetch_array($result)) { $_SESSION['username']=$row['username']; echo"<script>window.location.href='../invoice/'</script>"; } } } ?>
db.php
<?php mysql_connect('localhost','root',''); mysql_select_db('testbill'); ?>
Comments
Post a Comment