23 lines
796 B
PHP
23 lines
796 B
PHP
<?php
|
|
$files = glob("*.php");
|
|
foreach ($files as $file) {
|
|
if (in_array($file, ['bot.php', 'koneksi.php'])) continue;
|
|
$content = file_get_contents($file);
|
|
preg_match_all('/prepare\((["\'])(.*?)\1\).*?execute\(\[(.*?)\]\)/s', $content, $matches);
|
|
foreach ($matches[2] as $idx => $query) {
|
|
$qmCount = substr_count($query, '?');
|
|
$execArgs = trim($matches[3][$idx]);
|
|
$argCount = 0;
|
|
if ($execArgs !== '') {
|
|
$argCount = count(explode(',', $execArgs));
|
|
}
|
|
if ($qmCount != $argCount && !strpos($execArgs, '...')) {
|
|
echo "Mismatch in $file: query has $qmCount ?, but execute has $argCount args.\n";
|
|
echo "Query: $query\n";
|
|
echo "Args: $execArgs\n\n";
|
|
}
|
|
}
|
|
}
|
|
echo "Check done.";
|
|
?>
|