<?php
session_start();
include ("includes/database.php");
?>
<!doctype html>
<html>
<head>
<title>SERVICE LOGIN</title>
</head>

<body>
<!-- youtube.com /DarkCode -->
	<meta charset="utf-8">
	<title>LOGIN FORM</title>
	<link rel="stylesheet" type="text/css" href="style.css">
<body>

<form method="post">
<div class="login-box">
<h1>Login (Service)</h1>

	<div class="textbox">
	Username: <input type="text" placeholder="service username" name="username" value="">
</div>

<div class="textbox">
	Password: <input type="password" placeholder="password" name="password" value"">
</div>
<input class="btn" type="submit" name="submit" value="Sign In">


</form>
<br><br>
<center>
click <a href="shopregister.php">here</a> to register
</center>

<?php

if (isset($_POST["username"]))
{
//get data
$susername=$_POST["username"];
$spwd=$_POST["password"];

//check record
$data=mysqli_query($con, "SELECT * from tbl_shop where shop_username ='$susername'");
$wujud=mysqli_num_rows($data);
$showData=mysqli_fetch_array($data);

if ($wujud==0)
{echo "Wrong username or password";}
elseif ($showData['shop_password']!=$spwd)
{echo "Wrong username or password ! Try again mate.";}
else
{
header ("location: main2.php");
$_SESSION["username"]=$susername;


}

}

?>












</center>

</body>
</html>