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->name ." bejegyzése

"; + $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

- -
- +
+ " required >
+

- - +
+
-
\ No newline at end of file + + +

+ EdDigi üzenetek +

+
+ +
\ No newline at end of file diff --git a/20241205/index.php b/20241205/index.php index 16b713b..73624ba 100644 --- a/20241205/index.php +++ b/20241205/index.php @@ -3,5 +3,6 @@ require_once("config.php"); require_once("func.php"); require_once("head.php"); + require_once("login.php"); require_once("html.php"); require_once("footer.php"); \ No newline at end of file diff --git a/20241205/login.php b/20241205/login.php new file mode 100644 index 0000000..5dd070b --- /dev/null +++ b/20241205/login.php @@ -0,0 +1,13 @@ + +
+
+
+ +
+ \ No newline at end of file