<?php
    include('../loginsession.php');
    error_reporting(E_ALL);
    $filename = __FILE__;  //---Nama file saat ini
    if (strlen(__FILE__) > 48) {$filename = substr(__FILE__, 48);}
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------
	
$code=  $_GET['id'];
$array = explode("-", $code);
$id = $array[0];
$userid= $array[1];	

if ($userini_id == '3'){	
    $hapus = mysqli_query($conn, "DELETE FROM novia_abc_cash_loan WHERE id = $id");
    if ($hapus){
        echo "<script>document.location='cash-piutang.php?userid=$userid'</script>";
    }
}
if ($userini_id != '3'){
    echo "<script>alert('Anda tidak berhak untuk menghapus');document.location='cash-piutang.php?userid=$userid'</script>";
}