update wa official API

This commit is contained in:
WD - Dev
2025-10-07 21:01:15 +07:00
parent efca8f5f80
commit eb13c69431
55 changed files with 138040 additions and 1543 deletions
+10 -3
View File
@@ -17,10 +17,11 @@ if ($rows) {
$result = [];
foreach ($entries as $entry) {
// Pecah setiap entry berdasarkan '_'
list($akun, $ip_address) = explode('_', $entry);
list($akun, $ip_address, $mac) = explode('_', $entry);
$result[] = [
'akun' => $akun,
'ip_address' => $ip_address
'ip_address' => $ip_address,
'mac_address' => $mac
];
}
// Ambil data akun dari database
@@ -83,14 +84,16 @@ if ($rows) {
// Rubah ke array
$data = explode("_", $cari02);
if (count($data) === 2) {
if (count($data) === 3) {
$ipadd = $data[1];
$macadd = $data[2];
// Siapkan data untuk update
$updates[] = [
'id' => $idakun,
'status' => 'On',
'ip_address' => $ipadd,
'mac_address' => $macadd,
'time' => $time,
];
}
@@ -110,6 +113,10 @@ if ($rows) {
foreach ($updates as $update) {
$updateQuery .= "WHEN {$update['id']} THEN '{$update['ip_address']}' ";
}
$updateQuery .= "END, mac_address = CASE id ";
foreach ($updates as $update) {
$updateQuery .= "WHEN {$update['id']} THEN '{$update['mac_address']}' ";
}
$updateQuery .= "END, time_update = '{$time}' WHERE id IN (" . implode(',', array_column($updates, 'id')) . ")";
$pdo->exec($updateQuery);
}