<?php
 
include 'dbconfig.php';
 
// Create connection
$user=$_POST['user1'];
$pass=$_POST['pass1'];
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}
 
//$result["errorcode"]="0";
 
$sql = "SELECT password,hak FROM TbUser where user='".$user."' and password='".$pass."'";
 
$res = mysqli_query($conn, $sql);
$hak=mysqli_fetch_array($res);
$hak=$hak['hak'];
 
$items = array();
 
if (mysqli_num_rows($res) > 0) {
 
   // while($row = mysqli_fetch_object($res)){
 
     //   array_push($items, $row);
 
//$result["errorcode"] = "1";
 
    $result["data"] = "ok";
    $result["hak"] = $hak;
 
}
else
{
 
     $result["data"] = "failed";
 
}
 
echo json_encode($result);
 
mysqli_close($conn);
 
?>
