diff --git a/SQL_20250122/index.html b/SQL_20250122/index.html index fece754..933af52 100644 --- a/SQL_20250122/index.html +++ b/SQL_20250122/index.html @@ -7,7 +7,7 @@ -
+ diff --git a/SQL_20250122/asd.php b/SQL_20250122/results.php similarity index 79% rename from SQL_20250122/asd.php rename to SQL_20250122/results.php index d597282..2b46a1c 100644 --- a/SQL_20250122/asd.php +++ b/SQL_20250122/results.php @@ -3,21 +3,30 @@ require_once('config.php'); function parseGrant($grant) { if (preg_match("/GRANT (.*?) ON `(.*?)`\.`(.*?)`(?: \((.*?)\))?/", $grant, $matches)) { - $permissions = preg_replace("/\(.*?\)/", "", $matches[1]); + $permissions = trim($matches[1]); + + // Új elágazás az oszlopok kezelésére + if (preg_match("/(\w+) \((.*?)\)/", $permissions, $permMatches)) { + $permissions = trim($permMatches[1]); + $columns = array_map('htmlspecialchars', array_map('trim', explode(',', $permMatches[2]))); + } else { + $columns = ["*"]; + } + $database = htmlspecialchars($matches[2]); $table = htmlspecialchars($matches[3]); - $columns = !empty($matches[4]) ? array_map('htmlspecialchars', array_map('trim', explode(',', $matches[4]))) : ["-"]; return [$permissions, $database, $table, $columns]; } elseif (preg_match("/GRANT (.*?) ON `(.*?)`\.\*/", $grant, $matches)) { - $permissions = preg_replace("/\(.*?\)/", "", $matches[1]); + $permissions = trim($matches[1]); $database = htmlspecialchars($matches[2]); - return [$permissions, $database, "Minden tábla", ["-"]]; + return [$permissions, $database, "Minden tábla", ["Minden oszlop"]]; } return ["Ismeretlen", "-", "-", ["-"]]; } + ?>