table it is saved to $prefixes = array('user' => 'Users', 'newZone' => 'Zones', 'newStorage' => 'Storage', 'newServer' => 'Servers', 'newGroup' => 'Groups', 'Control' => 'Controls', 'filter' => 'Filters'); $failures = 0; $checked = 0; $files = array_merge(glob($root.'/web/skins/classic/views/*.php'), glob($root.'/web/ajax/modals/*.php')); foreach ($files as $file) { if (basename($file) == 'monitor.php' and strpos($file, '/views/') !== false) continue; foreach (explode("\n", file_get_contents($file)) as $n => $line) { if (!preg_match('/ $v[1]) { $failures++; echo "FAIL - $where: varchar({$v[1]}) but maxlength ".($ml[1] ?? 'none')."\n"; } } else if ($type == 'number' and preg_match('/^(tiny|small)int\b/i', $def, $i)) { $checked++; $unsigned = stripos($def, 'unsigned') !== false; $limit = array('tiny' => $unsigned ? 255 : 127, 'small' => $unsigned ? 65535 : 32767)[strtolower($i[1])]; if (!preg_match('/\bmax="(\d+)"/', $line, $mx) or $mx[1] > $limit) { $failures++; echo "FAIL - $where: $def but max ".($mx[1] ?? 'none')."\n"; } } } } echo "checked $checked inputs\n"; echo $failures ? "$failures failed\n" : "all passed\n"; exit($failures ? 1 : 0);