}
public function checkConnexion($data = []) {
- $hosting = $data['protocol'] === 'hosting' ? 'hosting.fluidbook.com' : 'hosting2.fluidbook.com';
- $ipHosting = dns_get_record($hosting, DNS_A)[0]['ip'];
-
- $subdomains = explode("\r\n",$data['subdomains']);
- $subdomainsIntruder = [];
-
- if($subdomains) {
- foreach($subdomains as $subdomain) {
- $ipSubdomain = dns_get_record($subdomain, DNS_A)[0]['ip'];
- $ipSubdomain = trim(str_replace('\n', '', shell_exec('dig +short @1.1.1.1 '.$subdomain.' | tail -1')));
- if($ipSubdomain !== $ipHosting) {
- $subdomainsIntruder[] = $subdomain;
+ if(isset($data['protocol']) && isset($data['subdomains'])) {
+ $hosting = $data['protocol'] === 'hosting' ? 'hosting.fluidbook.com' : 'hosting2.fluidbook.com';
+ $ipHosting = dns_get_record($hosting, DNS_A)[0]['ip'];
+
+ $subdomains = explode("\r\n", $data['subdomains']);
+ $subdomainsIntruder = [];
+
+ if ($subdomains) {
+ foreach ($subdomains as $subdomain) {
+ $ipSubdomain = dns_get_record($subdomain, DNS_A)[0]['ip'];
+ $ipSubdomain = trim(str_replace('\n', '', shell_exec('dig +short @1.1.1.1 ' . $subdomain . ' | tail -1')));
+ if ($ipSubdomain !== $ipHosting) {
+ $subdomainsIntruder[] = $subdomain;
+ }
}
}
- }
- if($subdomainsIntruder) {
- $subdomainsList = implode(", ",$subdomainsIntruder);
- return ['subdomains' => $subdomainsList, 'host' => $hosting];
+ if ($subdomainsIntruder) {
+ $subdomainsList = implode(", ", $subdomainsIntruder);
+ return ['subdomains' => $subdomainsList, 'host' => $hosting];
+ }
}
if(file_exists($this->getRootPath().'status')) {