Login

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

<!

DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="bootstrap.min.css">
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<link rel="stylesheet" href="login.css">
<title>Login Page</title>
</head>

<body>

<form action="" method="POST">


<div class="login-box">
<h1>Login</h1>
<div class="col-md-12">
<div class="input-group has-validation">
<input type="text" placeholder="Username" name="username"
class="form-control" aria-describedby="inputGroupPrepend" required>
</div>
</div>
<div class="col-md-12">
<div class="input-group has-validation">
<input type="password" placeholder="Password" name="password"
class="form-control" aria-describedby="inputGroupPrepend" required>
</div>
</div>

<input class="button" type="submit" name="login" value="Sign In">


</div>
</form>

<!--
<?php
if(isset($_POST["login"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$conn = mysqli_connect("10.152.62.25", "nkndb", "N%i&c081!0", "nkndb");

// Check connection
if($conn === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}

function test_input($data) {

$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}

$username = test_input($_POST['username']);
$password = test_input($_POST['password']);

$sql = "SELECT * FROM adminlogin";


$result = mysqli_query($conn, $sql);

$items = array();

//Store table records into an array


while( $row = $result->fetch_assoc() ) {
$items[] = $row;
}

foreach($items as $item) {
if(($item['username'] == $username) && ($item['password'] ==
$password)){
header("location: index.html");
}
else{
echo "<script language='javascript'>";
echo "alert('WRONG INFORMATION')";
echo "</script>";
header("Location: login.html");
die();

}
}
}
else {
echo "All fields are required!";
}
}

?>
-->
</body>

</html>

You might also like