<html>
<head>
<meta charset="UTF-8">
<meta name="author" content="Muhammad Yasir">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="admin.css">
<title>Admin</title>
</head>
<body>
<form method="post" action="admin.php">
<table>
<tbody>
<tr>
<td>User Name:</td>
<td><input type="text" name="name" placeholder="Enter your User ID"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" placeholder="Enter your Password"></td>
</tr>
<tr align="right">
<td>
<button type="submit" name="submit" class="btn">LOGIN</button>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
<?php
include('admin.php');
if(isset($_POST['submit'])){
$name = $_POST['name'];
$password = $_POST['password'];
$querry = "SELECT * FROM login WHERE name='$name' AND password='$password'";
$run = mysqli_query($db,$querry);
$ret=mysqli_num_rows($run);
if($ret == true)
{
echo "<script>window.open('index.php','_self')</script>";
}
else
{
echo "<script>alert('Wrong Login Details, Try Again!')</script>";
}
}
?>
SQL DATABASE
<?php
$db=mysqli_connect('localhost','root','','erp');
?>
CSS FILE
body
{
font-size:19px;
}
table{
width:70%;
margin:30px auto;
border-collapse:collapse;
text-align:left;
}
tr
{
border-bottom:6px solid #cbcbcb;
}
th
{
border:5px;
height:20px;
padding:5px;
}
td
{
border:none;
height:20px;
padding:2px;
}
tr:hover
{
background:#F5F5F5;
}
form
{
width:45%;
margin:50px auto;
text-align:left;
padding:20px;
border:3px solid #bbbbbb;
border-radius:5px;
background-color:yellow;
}
<head>
<meta charset="UTF-8">
<meta name="author" content="Muhammad Yasir">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="admin.css">
<title>Admin</title>
</head>
<body>
<form method="post" action="admin.php">
<table>
<tbody>
<tr>
<td>User Name:</td>
<td><input type="text" name="name" placeholder="Enter your User ID"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" placeholder="Enter your Password"></td>
</tr>
<tr align="right">
<td>
<button type="submit" name="submit" class="btn">LOGIN</button>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
<?php
include('admin.php');
if(isset($_POST['submit'])){
$name = $_POST['name'];
$password = $_POST['password'];
$querry = "SELECT * FROM login WHERE name='$name' AND password='$password'";
$run = mysqli_query($db,$querry);
$ret=mysqli_num_rows($run);
if($ret == true)
{
echo "<script>window.open('index.php','_self')</script>";
}
else
{
echo "<script>alert('Wrong Login Details, Try Again!')</script>";
}
}
?>
SQL DATABASE
<?php
$db=mysqli_connect('localhost','root','','erp');
?>
CSS FILE
body
{
font-size:19px;
}
table{
width:70%;
margin:30px auto;
border-collapse:collapse;
text-align:left;
}
tr
{
border-bottom:6px solid #cbcbcb;
}
th
{
border:5px;
height:20px;
padding:5px;
}
td
{
border:none;
height:20px;
padding:2px;
}
tr:hover
{
background:#F5F5F5;
}
form
{
width:45%;
margin:50px auto;
text-align:left;
padding:20px;
border:3px solid #bbbbbb;
border-radius:5px;
background-color:yellow;
}
Post a Comment