diff --git a/20241205/func.php b/20241205/func.php index 0a79ce1..0f8a0f7 100644 --- a/20241205/func.php +++ b/20241205/func.php @@ -1,10 +1,66 @@ query($sql); + + if ($result->num_rows > 0){ + $row = $result->fetch_object(); + $_SESSION["islogin"] = true; + $_SESSION["nev"] = $row->nev; + $_SESSION["id"] = $row->uid; + $_SESSION["email"] = $row->email; + } + } + + if ($_SESSION["islogin"]){ + $_SESSION["email"] = "valamiemail"; + } else { + $_SESSION["email"] = ""; + } if(isset($_POST["uzenet"])){ - echo "Az üzeneted: ".$_POST["uzenet"]; - } \ No newline at end of file + //echo "Az üzeneted: ".$_POST["uzenet"]; + //$nev = $_POST["nev"]; + $id = $_SESSION["id"]; + //$email = $_POST["email"]; + $uzenet = $_POST["uzenet"]; + + //$ido = date() + $sql = "INSERT INTO messages (uid, msg, status) VALUES (?,?,1)"; + $param = $conn->prepare($sql); + $param->bind_param("is",$id, $uzenet); + + if ($param->execute()){ + echo "Sikeres üzenetmentés"; + } else { + echo "Sikertelen üzenetmentés: ".$param->error; + } + + $param->close(); + } + +$vendegkonyv = ""; +$sql = "SELECT * from messages +INNER JOIN felh ON felh.uid = messages.uid +ORDER BY crdate DESC"; + +$result = $conn->query($sql); + +if ($result->num_rows > 0){ + $row = $result->fetch_object(); + $vendegkonyv = "
". $row->msg ."
"; + $vendegkonyv .= "". $row->crdate ."
"; +} else { + echo "Nincs bejegyzés a vendégkönyvben."; +} \ No newline at end of file diff --git a/20241205/html.php b/20241205/html.php index faeeadf..1ed2630 100644 --- a/20241205/html.php +++ b/20241205/html.php @@ -1,11 +1,20 @@Teszt felület vendég
\ No newline at end of file + + +