fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh
| DIR:/home/u1105814/www/ |
| Current File : /home/u1105814/www/login_servis.php |
<?php
header('Access-Control-Allow-Origin: *');
require_once('koneksi.php');
if (isset($_POST["username"]) && $_POST["username"] != '' &&isset($_POST["password"]) && $_POST["password"] != '')
{
$username = $_POST["username"];
$password = $_POST["password"];
$getData = "SELECT * FROM `pengguna` WHERE `username`='" .$username."'
and `password`='".$password."'";
$result = mysqli_query($conn,$getData);
$userId="";
while( $r = mysqli_fetch_array($result))
{
$userId=$r['user_id'];
$nama=$r['nama'];
$akses=$r['akses'];
}
if ($result->num_rows> 0 ){
$getData2 ="SELECT COUNT(*) as tot_dta,SUM(b.plafond) as tot_plat from pengajuan a LEFT JOIN pengajuan_det b on a.no_pengajuan=b.no_pengajuan where a.status=1 and a.cadang2=$userId";
$result1 = mysqli_query($conn,$getData2);
$r1 = mysqli_fetch_array($result1);
$penc=$r1['tot_plat'];
$noa=$r1['tot_dta'];
$resp["status"] = "1";
$resp["userid"] = $userId;
$resp["nama"] = $nama;
$resp["akses"] = $akses;
$resp["penc"] = $penc;
$resp["noa"] = $noa;
$resp["message"] = "Login successfully";
}
else{
$resp["status"] = "2";
$resp["message"] = "Enter correct username or password";
}
}
else
{
$resp["status"] = "2";
$resp["message"] = "Enter Correct username.";
}
header('content-type: application/json');
$response["response"]=$resp;
echo json_encode($response);
@mysqli_close($conn);
?> |