From 5b582005f1feb7cf3fd7a12aae1d65b959181839 Mon Sep 17 00:00:00 2001 From: szabomarton Date: Wed, 12 Feb 2025 07:49:03 +0100 Subject: [PATCH] asd --- SQL_20250122/index.html | 2 +- SQL_20250122/{asd.php => results.php} | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) rename SQL_20250122/{asd.php => results.php} (79%) 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", "-", "-", ["-"]]; } + ?>