PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php if (1 == $isAddWhiteIp) { foreach ($value['ip_mac'] as $i => $value2) { $ip = trim($value2['ip']); if ('' != $ip && $ip == 0) { $ip = -1; } if ('' != $ip && 0 < $ip) { if ($ip >= $grayNetIpMin && $ip <= $grayNetIpMax) { $mac = isset($value2['mac']) ? strtolower($value2['mac']) : ''; $ipNew = $ip - $whiteNetIp; $value['ip_mac'][$ipNew] = [ 'ip' => $ipNew, 'mac' => $mac ]; Log::d("Add White Ip " . $ipNew . " For Gray Ip " . $ip . " (customer: " . $id . ")"); } } } } foreach ($value['ip_mac'] as $i => $value2) { $ip = isset($value2['ip']) ? trim($value2['ip']) : -1; if ('' != $ip && $ip == 0) { $ip = -1; } $mac = isset($value2['mac']) ? strtolower($value2['mac']) : ''; if (12 != strlen($mac)) { $mac = ''; } if ('' != $ip && (0 < $ip || -1 == $ip)) { if (!isset($usersideIp[$ip])) { //Нет такого IP ++$ipToAdd; $this->arrayCustomerToEdit[$usersideId]['add_ip' . $ipToAdd] = $ip . ',' . $mac; } else { $usersideIp[$ip]['_is_find'] = 1; //Проверяем - такой ли MAC if (1 == $isUpdateMac && $mac != $usersideIp[$ip]['mac'] && '' != $mac) { ++$ipChangeMac; //Меняем MAC $this->arrayCustomerToEdit[$usersideId]['ip_change_mac' . $ipChangeMac] = $ip . ',' . $mac; } } } if (isset($value2['local_ip'])) { $ip = trim($value2['local_ip']); if ('' != $ip && 0 < $ip && $ip != trim($value2['ip'])) { if (!isset($usersideIp[$ip])) { //Нет такого IP ++$ipToAdd; $this->arrayCustomerToEdit[$usersideId]['add_ip' . $ipToAdd] = $ip . ',' . $mac; } else { $usersideIp[$ip]['_is_find'] = 1; //Проверяем - такой ли MAC if (1 == $isUpdateMac && $mac != $usersideIp[$ip]['mac'] && '' != $mac) { ++$ipChangeMac; //Меняем MAC $this->arrayCustomerToEdit[$usersideId]['ip_change_mac' . $ipChangeMac] = $ip . ',' . $mac; } } } } }
Show:  
Copy Clear