added orai

This commit is contained in:
szabomarton 2024-12-09 14:52:37 +01:00
parent 0158b59ccb
commit 8bfbb36fdf
4 changed files with 90 additions and 11 deletions

View File

@ -1,10 +1,66 @@
<?php
$title = "Cím";
if (!isset($_SESSION["islogin"])){
$_SESSION["nev"] = "Vendég József";
$_SESSION["id"] = 9999;
$_SESSION["islogin"] = false;
}
//bejelentkezés vizsgálata
if (isset($_POST["lemail"])){
$lemail = $_POST["lemail"];
$sql = "SELECT * FROM felh WHERE email='".$lemail."'";
$result = $conn->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"];
//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 = "<h4> ". $row->name ." bejegyzése </h4> ";
$vendegkonyv .= "<p> ". $row->msg ."</p> ";
$vendegkonyv .= "<p><i> ". $row->crdate ."</i></p>";
} else {
echo "Nincs bejegyzés a vendégkönyvben.";
}

View File

@ -1,11 +1,20 @@
<p>Teszt felület vendég</p>
<form action="#" method="POST">
<label for="name">Név: </label>
<input type="text" name="name" required><br>
<label for="email">Email: </label>
<label for="name">Név: </label> <br>
<input type="text" name="name" value="<?php echo $_SESSION["nev"] ?>" required ><br>
<label for="email">Email: </label> <br>
<input type="email" name="email" required><br>
<label for="uzenet">Üzenet: </label>
<textarea name="uzenet" rows="10" cols="50" required></textarea>
<label for="uzenet">Üzenet: </label> <br>
<textarea name="uzenet" rows="10" cols="50" required></textarea> <br>
<button type="submit">Beküldés</button>
</form>
<h3>
EdDigi üzenetek
</h3>
<div>
<?php
echo $vendegkonyv
?>
</div>

View File

@ -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");

13
20241205/login.php Normal file
View File

@ -0,0 +1,13 @@
<?php
if ($_SESSION["islogin"] === false){
?>
<form action="#" method="POST">
<label for="email">Email: </label> <br>
<input type="email" name="lemail" required><br>
<button type="submit">Bejelentkezés</button>
</form>
<?php
}
?>