function log_error($text, $echo = FALSE) { global $log_path, $date_format, $TIME_ADJUST; if (!is_null($text)) { $str = date($date_format, safeTime()) . " dnsmasq_webui: " . $text; } if (isset($str)) { if ($echo) { echo $str . "<br \\><br \\>"; } file_put_contents($log_path, $str . "\n", FILE_APPEND); } }
</tr> </thead> <tbody> <?php foreach ($lease_lines as $line_num => $line) { $arr = explode(" ", $line); # ctype_space checks for \n\r\t # duid is the ipv6 name for the dhcp server see --dhcp-duid in manpages if (strlen($line) > 0 && substr($line, 0, 1) == "#" || strlen($line) > 0 && substr($line, 0, 4) == "duid" || ctype_space($line) || $line == '') { // this is a comment or whitespace line, do nothing. } else { if (!in_array(sizeof($arr), array(4, 5))) { log_error("lease_lines line @{$line_num} '" . trim($line) . "' (" . str_hex($line) . ") is invalid", true); continue 1; } else { echo "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . date("{$date_format}", safeTime($arr[0])) . "</td>\n\t\t\t\t\t<td>" . $arr[1] . "</td>\n\t\t\t\t\t<td>" . $arr[2] . "</td>\n\t\t\t\t\t<td>" . $arr[3] . "</td>\n\t\t\t\t\t<td>" . $arr[4] . "</td>\n\t\t\t\t</tr>\n\t\t"; } } } ?> </tbody> </table> </div> <!---- LOGTABLE --->