2024-12-10 18:16:13 +00:00
|
|
|
<?php include_once("htmlheader.php"); ?>
|
|
|
|
<title>Lekérdezés eredménye</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<?php include_once("navbar.php") ?>
|
|
|
|
<?php
|
2024-12-10 07:45:46 +00:00
|
|
|
include_once("config.php");
|
|
|
|
|
|
|
|
|
2024-12-10 18:16:13 +00:00
|
|
|
// Kapcsolati hiba ellenőrzése
|
|
|
|
if ($conn->connect_error) {
|
|
|
|
die("Kapcsolódási hiba: " . $conn->connect_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ellenőrizzük, hogy érkezett-e POST kérés
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
|
// Azonosítjuk a céltábla nevét
|
|
|
|
$tabla = isset($_POST['tabla']) ? $_POST['tabla'] : null;
|
|
|
|
|
|
|
|
if ($tabla === "tagok") {
|
|
|
|
handleTagok($conn);
|
|
|
|
} elseif ($tabla === "tagsag") {
|
|
|
|
handleTagsag($conn);
|
|
|
|
} elseif ($tabla === "jelenlet") {
|
|
|
|
handleJelenlet($conn);
|
|
|
|
} elseif ($tabla === "esemenyek") {
|
|
|
|
handleEsemenyek($conn);
|
|
|
|
} elseif ($tabla === "visszajelzes") {
|
|
|
|
handleVisszajelzes($conn);
|
|
|
|
} else {
|
|
|
|
echo "Érvénytelen tábla megnevezés!";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tagok tábla kezelése
|
|
|
|
function handleTagok($conn)
|
|
|
|
{
|
|
|
|
$whereClauses = [];
|
2024-12-10 07:45:46 +00:00
|
|
|
if (!empty($_POST['vnev'])) {
|
2024-12-10 18:16:13 +00:00
|
|
|
$whereClauses[] = "vnev LIKE '%" . $conn->real_escape_string($_POST['vnev']) . "%'";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
|
|
|
if (!empty($_POST['knev'])) {
|
2024-12-10 18:16:13 +00:00
|
|
|
$whereClauses[] = "knev LIKE '%" . $conn->real_escape_string($_POST['knev']) . "%'";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
|
|
|
if (!empty($_POST['email'])) {
|
2024-12-10 18:16:13 +00:00
|
|
|
$whereClauses[] = "email LIKE '%" . $conn->real_escape_string($_POST['email']) . "%'";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
|
|
|
if (!empty($_POST['telefon'])) {
|
2024-12-10 18:16:13 +00:00
|
|
|
$whereClauses[] = "telefon LIKE '%" . $conn->real_escape_string($_POST['telefon']) . "%'";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
|
|
|
if (!empty($_POST['lakcim'])) {
|
2024-12-10 18:16:13 +00:00
|
|
|
$whereClauses[] = "lakcim LIKE '%" . $conn->real_escape_string($_POST['lakcim']) . "%'";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
|
|
|
if (!empty($_POST['tagsag_kezdete'])) {
|
2024-12-10 18:16:13 +00:00
|
|
|
$whereClauses[] = "tagsag_kezdete = '" . $conn->real_escape_string($_POST['tagsag_kezdete']) . "'";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
2024-12-10 18:16:13 +00:00
|
|
|
if (isset($_POST['aktiv']) && $_POST['aktiv'] !== "") {
|
|
|
|
$whereClauses[] = "aktiv_tagsagi_statusz = " . (int)$_POST['aktiv'];
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
2024-12-10 18:16:13 +00:00
|
|
|
|
|
|
|
$where = !empty($whereClauses) ? "WHERE " . implode(" AND ", $whereClauses) : "";
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM tagok $where";
|
|
|
|
displayResults($conn, $sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tagsag tábla kezelése
|
|
|
|
function handleTagsag($conn)
|
|
|
|
{
|
|
|
|
$whereClauses = [];
|
|
|
|
if (!empty($_POST['tag_id'])) {
|
|
|
|
$whereClauses[] = "tag_id = " . (int)$_POST['tag_id'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['dij_osszeg'])) {
|
|
|
|
$whereClauses[] = "dij_osszeg = " . (float)$_POST['dij_osszeg'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['datum'])) {
|
|
|
|
$whereClauses[] = "datum = '" . $conn->real_escape_string($_POST['datum']) . "'";
|
|
|
|
}
|
|
|
|
if (isset($_POST['fizetes_statusz']) && $_POST['fizetes_statusz'] !== "") {
|
|
|
|
$whereClauses[] = "fizetes_statusz = " . ((bool)$_POST['fizetes_statusz'] ? 1 : 0);
|
|
|
|
}
|
|
|
|
if (!empty($_POST['fizetes_datum'])) {
|
|
|
|
$whereClauses[] = "fizetes_datum = '" . $conn->real_escape_string($_POST['fizetes_datum']) . "'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['nyugtaszam'])) {
|
|
|
|
$whereClauses[] = "nyugtaszam = " . (int)$_POST['nyugtaszam'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['megjegyzes'])) {
|
|
|
|
$whereClauses[] = "megjegyzes LIKE '%" . $conn->real_escape_string($_POST['megjegyzes']) . "%'";
|
|
|
|
}
|
|
|
|
|
|
|
|
$where = !empty($whereClauses) ? "WHERE " . implode(" AND ", $whereClauses) : "";
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM tagsag $where";
|
|
|
|
displayResults($conn, $sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Jelenlet tábla kezelése
|
|
|
|
function handleJelenlet($conn)
|
|
|
|
{
|
|
|
|
$whereClauses = [];
|
|
|
|
if (!empty($_POST['esemeny_id'])) {
|
|
|
|
$whereClauses[] = "esemeny_id = " . (int)$_POST['esemeny_id'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['tag_id'])) {
|
|
|
|
$whereClauses[] = "tag_id = " . (int)$_POST['tag_id'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['jelenlet_datum'])) {
|
|
|
|
$whereClauses[] = "jelenlet_datum = '" . $conn->real_escape_string($_POST['jelenlet_datum']) . "'";
|
|
|
|
}
|
|
|
|
if (isset($_POST['jelenlet_statusz']) && $_POST['jelenlet_statusz'] !== "") {
|
|
|
|
$whereClauses[] = "jelenlet_statusz = " . ((bool)$_POST['jelenlet_statusz'] ? 1 : 0);
|
|
|
|
}
|
|
|
|
if (!empty($_POST['visszajelzes'])) {
|
|
|
|
$whereClauses[] = "visszajelzes LIKE '%" . $conn->real_escape_string($_POST['visszajelzes']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['becsekkolas'])) {
|
|
|
|
$whereClauses[] = "becsekkolas = '" . $conn->real_escape_string($_POST['becsekkolas']) . "'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['kicsekkolas'])) {
|
|
|
|
$whereClauses[] = "kicsekkolas = '" . $conn->real_escape_string($_POST['kicsekkolas']) . "'";
|
|
|
|
}
|
|
|
|
|
|
|
|
$where = !empty($whereClauses) ? "WHERE " . implode(" AND ", $whereClauses) : "";
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM jelenlet $where";
|
|
|
|
displayResults($conn, $sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Esemenyek tábla kezelése
|
|
|
|
function handleEsemenyek($conn)
|
|
|
|
{
|
|
|
|
$whereClauses = [];
|
|
|
|
if (!empty($_POST['esemeny_neve'])) {
|
|
|
|
$whereClauses[] = "esemeny_neve LIKE '%" . $conn->real_escape_string($_POST['esemeny_neve']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['esemeny_datuma'])) {
|
|
|
|
$whereClauses[] = "esemeny_datuma = '" . $conn->real_escape_string($_POST['esemeny_datuma']) . "'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['helyszin'])) {
|
|
|
|
$whereClauses[] = "helyszin LIKE '%" . $conn->real_escape_string($_POST['helyszin']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['leiras'])) {
|
|
|
|
$whereClauses[] = "leiras LIKE '%" . $conn->real_escape_string($_POST['leiras']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['max_letszam'])) {
|
|
|
|
$whereClauses[] = "max_letszam = " . (int)$_POST['max_letszam'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['szervezo'])) {
|
|
|
|
$whereClauses[] = "szervezo LIKE '%" . $conn->real_escape_string($_POST['szervezo']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['esemeny_statusz'])) {
|
|
|
|
$whereClauses[] = "esemeny_statusz = '" . $conn->real_escape_string($_POST['esemeny_statusz']) . "'";
|
|
|
|
}
|
|
|
|
|
|
|
|
$where = !empty($whereClauses) ? "WHERE " . implode(" AND ", $whereClauses) : "";
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM esemenyek $where";
|
|
|
|
displayResults($conn, $sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Visszajelzes tábla kezelése
|
|
|
|
function handleVisszajelzes($conn)
|
|
|
|
{
|
|
|
|
$whereClauses = [];
|
|
|
|
if (!empty($_POST['tag_id'])) {
|
|
|
|
$whereClauses[] = "tag_id = " . (int)$_POST['tag_id'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['esemeny_id'])) {
|
|
|
|
$whereClauses[] = "esemeny_id = " . (int)$_POST['esemeny_id'];
|
|
|
|
}
|
|
|
|
if (!empty($_POST['visszajelzes_szoveg'])) {
|
|
|
|
$whereClauses[] = "visszajelzes_szoveg LIKE '%" . $conn->real_escape_string($_POST['visszajelzes_szoveg']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['ertekeles'])) {
|
|
|
|
$whereClauses[] = "ertekeles = '" . $conn->real_escape_string($_POST['ertekeles']) . "'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['bekuldes_datum'])) {
|
|
|
|
$whereClauses[] = "bekuldes_datum = '" . $conn->real_escape_string($_POST['bekuldes_datum']) . "'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['lathatosag'])) {
|
|
|
|
$whereClauses[] = "lathatosag LIKE '%" . $conn->real_escape_string($_POST['lathatosag']) . "%'";
|
|
|
|
}
|
|
|
|
if (!empty($_POST['visszajelzes_statusz'])) {
|
|
|
|
$whereClauses[] = "visszajelzes_statusz = '" . $conn->real_escape_string($_POST['visszajelzes_statusz']) . "'";
|
|
|
|
}
|
|
|
|
|
|
|
|
$where = !empty($whereClauses) ? "WHERE " . implode(" AND ", $whereClauses) : "";
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM visszajelzes $where";
|
|
|
|
displayResults($conn, $sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Általános eredménymegjelenítés
|
|
|
|
function displayResults($conn, $sql)
|
|
|
|
{
|
2024-12-10 07:45:46 +00:00
|
|
|
$result = $conn->query($sql);
|
2024-12-10 18:16:13 +00:00
|
|
|
|
2024-12-10 07:45:46 +00:00
|
|
|
if ($result->num_rows > 0) {
|
2024-12-10 18:16:13 +00:00
|
|
|
echo "<table border='1'>";
|
|
|
|
echo "<tr>";
|
|
|
|
while ($fieldInfo = $result->fetch_field()) {
|
|
|
|
echo "<th>" . htmlspecialchars($fieldInfo->name) . "</th>";
|
|
|
|
}
|
|
|
|
echo "</tr>";
|
|
|
|
|
2024-12-10 07:45:46 +00:00
|
|
|
while ($row = $result->fetch_assoc()) {
|
2024-12-10 18:16:13 +00:00
|
|
|
echo "<tr>";
|
|
|
|
foreach ($row as $value) {
|
|
|
|
echo "<td>" . htmlspecialchars($value) . "</td>";
|
|
|
|
}
|
|
|
|
echo "</tr>";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
2024-12-10 18:16:13 +00:00
|
|
|
|
2024-12-10 07:45:46 +00:00
|
|
|
echo "</table>";
|
|
|
|
} else {
|
2024-12-10 18:16:13 +00:00
|
|
|
echo "<p>Nincs találat.</p>";
|
2024-12-10 07:45:46 +00:00
|
|
|
}
|
2024-12-10 18:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$conn->close();
|
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|