You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$db->query("update {$settings['PREFIX']}_ips set ips_main=0,ips_used=1,ips_{$settings['PREFIX']}={$serviceInfo[$settings['PREFIX'].'_id']} where ips_ip='{$ip}'", __LINE__, __FILE__);
52
-
$db->query("update invoices set invoices_description='{$rdescription}' where invoices_type=1 and invoices_extra='{$repeatInvoiceId}'", __LINE__, __FILE__);
53
-
$db->query("update repeat_invoices set repeat_invoices_description='{$description}' where repeat_invoices_id='{$repeatInvoiceId}'", __LINE__, __FILE__);
45
+
$id = $serviceInfo[$settings['PREFIX'].'_id'];
46
+
$ip = $serviceInfo[$settings['PREFIX'].'_ip'];
47
+
$db->query("select * from website_masters where website_id='{$serviceInfo[$settings['PREFIX'].'_server']}'", __LINE__, __FILE__);
48
+
$db->next_record(MYSQL_ASSOC);
49
+
$serverdata = $db->Record;
50
+
$hash = $serverdata[$settings['PREFIX'].'_key'];
51
+
$user = 'root';
52
+
function_requirements('whm_api');
53
+
$whm = new \xmlapi($serverdata[$settings['PREFIX'].'_ip']);
54
+
//$whm->set_debug('true');
55
+
$whm->set_port('2087');
56
+
$whm->set_protocol('https');
57
+
$whm->set_output('json');
58
+
$whm->set_auth_type('hash');
59
+
$whm->set_user($user);
60
+
$whm->set_hash($hash);
61
+
$accts = json_decode($whm->listips(), true);
62
+
$freeips = [];
63
+
$shared_ips = [];
64
+
foreach ($accts['result'] as$idx => $ipdata) {
65
+
if ($ipdata['mainaddr'] == '1')
66
+
$main_ip = $ipdata['ip'];
67
+
if ($ipdata['used'] == 0 && $ipdata['active'] == 1)
68
+
$freeips[] = $ipdata['ip'];
69
+
if ($ipdata['dedicated'] == 0)
70
+
$shared_ips[] = $ipdata['ip'];
71
+
}
72
+
// check if ip is main or additional/dedicated. if ip is main, get a new one
73
+
if (in_array($ip, $shared_ips)) {
74
+
myadmin_log(self::$module, 'info', "IP {$ip} (Shared) Main IP {$main_ip}", __LINE__, __FILE__);
0 commit comments