first commit

This commit is contained in:
Tóth Ádám
2024-11-19 19:04:02 +01:00
commit de464b937d
8837 changed files with 493452 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?php
$kiirando = "Kaki<br>";
echo $kiirando;
$kiirando = "It's PHP<br>";
echo $kiirando;
$kiirando = 12;
echo $kiirando * 3;
$cim = "Kaka"
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP-s html</title>
</head>
<body>
<h1><?php echo $cim?></h1>
<?php
var_dump($kiirando);
?>
</body>
</html>

View File

@@ -0,0 +1,53 @@
<?php
define("KONSTVER", "20240909");
echo KONSTVER;
echo "<br>";
$tomb = array("hétfő", "kedd", "szerda", "csütörtök", "péntek");
var_dump($tomb);
echo "<br>Az első elem a tömbben: ".$tomb[0];
echo "<br>A tömb elemeinek a száma: ".count($tomb);
$tomb[] = "szombat";
echo "<br>Az utolsó elem: ".$tomb[count($tomb) - 1];
echo "Tömb elemének törlése...<br>";
unset($tomb[1]);
var_dump($tomb);
echo "<br>";
foreach ($tomb as $elem) {
echo $elem. "<br>";
}
// foreach ($_SERVER as $key => $value) {
// echo $key. " értéke: ".$value."<br>";
// }
$atomb = array();
$atomb["elso"] = "matyi";
$atomb["masodik"] = "dani";
echo $atomb["elso"]."<br>";
foreach ($atomb as $key => $value) {
echo $key. " értéke: ".$value."<br>";
}
echo "Név: ".$_GET["nev"]."<br>";
echo "Jelszó: ".$_GET["jelszo"]."<br>";
echo "Született: ".$_GET["szul"]."<br>";
if ($_GET["nev"] == "Jani")
{
echo "Belépés engedélyezve Janinak";
}
else
{
echo "Nincs jogosultság";
}
?>

View File

@@ -0,0 +1,30 @@
<?php
$islogin = false;
if (isset($_GET["kod"]) && $_GET["kod"] == 1111 ) {
echo "Üdvözöllek".$_GET["nev"];
$islogin = true;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PHP form</title>
</head>
<body>
<?php
if ($islogin == "false") {
?>
<form>
<input type="text" name="nev" title="Adja meg a nevet"><br>
<input type="number" name="kod" min="1000" max="5000" title="Adja meg a kódot"><br>
<input type="submit" value="Belépés">
</form>
<?php
}
?>
</body>
</html>

View File

@@ -0,0 +1,8 @@
<?php
echo '<div style="position: absolute; bottom: 3px; width: 100%;
text-align: center; height: 30px; background: black; color: white;">
Készítette: Tóth Ádám (c)2024.
</div>';
?>

View File

@@ -0,0 +1,19 @@
<?php require "negy1.php";?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alap web valami</title>
</head>
<body>
<h1>POST használata</h1>
<form method="POST">
<label for="nev">Login: </label><input type="text" id="nev" name="nev" title="Add meg a neved"><br>
<label for="jelszo">Jelszó: </label><input type="password" id="jelszo" name="jelszo" title="Jelszó"><br>
<button type="submit">Belépés</button>
</form>
<?php require "footer.php";?>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<?php
$islogin = false;
if (isset($_POST["nev"]) && isset($_POST["jelszo"])) {
$nev = $_POST["nev"];
$jelszo = $_POST["jelszo"];
if (strlen($nev) > 3 && strlen($jelszo) > 4) {
if ($nev == "admin" && $jelszo == "admin") {
$islogin = true;
}
}
}
?>

View File

@@ -0,0 +1,28 @@
<?php
require "ot1.php"
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Szöveges</h1>
<form action="#" method="POST">
<label for="szoveg1"></label>
<input type="text" name="szoveg1" id="szoveg1" title="Adj meg egy szöveget"><br>
<button type="submit">Hejj</button>
</form>
<?php
if ($vane) {
echo "<h2>Szerepel benne az alma szó!</h2>";
}
else {
echo "<h2>Nem szerepel benne az alma szó!</h2>";
}
?>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<?php
$vane = false;
$szov = $_POST["szoveg1"];
if (isset($_POST["szoveg1"]) && strlen["szoveg1"] >= 5) {
if (strpos($szov, "alma") != false) {
$vane = true;
}
}
?>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Játék</title>
</head>
<body>
<?php include "szomegadas_vizsgalas.php" ?>
</body>
</html>

View File

@@ -0,0 +1,6 @@
<form method="POST">
<label for="kitalalas">Találd ki a szót:</label>
<input type="text" name="kitalalas" id="kitalalas" maxlength="1"><br>
<button type="submit">Adjad be hülyegyerek</button>
</form>
<?php include "szokitalalas_vizsgalas.php" ?>

View File

@@ -0,0 +1,5 @@
<?php
if (isset($_POST["kitalalas"]) && strpos(haystack: $_POST["megadott-szo"], needle: $_POST["kitalalas"])) {
echo "KAKAKAKAK";
}
?>

View File

@@ -0,0 +1,5 @@
<form method="POST">
<label for="megadott-szo">A megadott szó:</label>
<input type="text" name="megadott-szo" id="megadott-szo" maxlength="10"><br>
<button type="submit">Adjad be hülyegyerek</button>
</form>

View File

@@ -0,0 +1,14 @@
<?php
if (!isset($_POST["megadott-szo"])) {
include "szomegadas.php";
}
else if (isset($_POST["megadott-szo"]) && strpos(haystack: $_POST["megadott-szo"], needle: ' ')) {
include "szomegadas.php";
echo "Helytelen szószerkezet!";
}
else {
include "szokitalalas.php";
}
?>

View File

@@ -0,0 +1,33 @@
<?php
session_start();
$_SESSION["menet"] = 14;
echo $_SESSION["menet"];
session_destroy();
if (isset($_POST["kilep"]) && $_POST["kilep"] == 1) {
unset($_COOKIE["belepve"]);
unset($_COOKIE["nev"]);
setcookie("belepve", "");
setcookie("nev", "");
}
?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sütik és munkamenetek</title>
</head>
<body>
<h1>Bejelentkezés</h1>
<form action="hat02.php" method="POST">
Név: <input type="text" name="nev"><br>
Jelszó: <input type="password" name="jelszo"><br>
<button type="submit">Belépés</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,24 @@
<?php
if (!isset($_COOKIE["belepve"])) {
if (isset($_POST["nev"]) && isset($_POST["jelszo"]) && $_POST["jelszo"] == "kaka") {
setcookie("belepve", 1);
setcookie("nev", $_POST["nev"]);
}
else {
echo "Nincs kitöltve minden mező vagy rossz jelszó...";
}
}
if (isset($_COOKIE["belepve"])) {
echo $_COOKIE["nev"];
echo '<form action="hat01.php" method="POST">';
echo '<input type="hidden" name="kilep" value="1">';
echo '<button type="submit">Kilépés</button>';
echo '</form>';
}
?>

View File

@@ -0,0 +1,38 @@
<?php
function canSubmit(): bool {
if (!isset($_POST)) {
return false;
}
else {
if(!isset($_POST["loginname"]) || strlen($_POST["loginname"])) {
return false;
}
else if (!isset($_POST["pwd"])) {
return false;
}
else {
return true;
}
}
}
function checkLogin(): bool {
$jologinname = "user";
$jopwd = "alma";
if (isset($_POST["loginname"]) && $_POST["loginname"] == $jologinname && $_POST["pwd"] == $jopwd) {
$_SESSION["user"] = 1;
return true;
}
else {
return false;
}
}
function isLoggedin() {
if (isset($_SESSION["user"])) {
return true;
}
}
?>

View File

@@ -0,0 +1,32 @@
<?php
session_start();
include("func.php");
?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Munkamenet</title>
</head>
<body>
<?php
canSubmit();
checkLogin();
if (isLoggedin()) {
echo "Sikeres bejelentkezés";
}
else { ?>
<h1>Bejelentkezés</h1>
<form action="#" method="POST">
Név: <input type="text" name="loginname"><br>
Jelszó: <input type="password" name="pwd"><br>
<button type="submit">Bejelentkezés</button>
</form>
<?php } ?>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<?php
function check_post() {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["num1"] = $_POST["num1"];
$_SESSION["num2"] = $_POST["num2"];
$num1 = $_SESSION["num1"];
$num2 = $_SESSION["num2"];
if ($num1 > 0 && $num2 > 0) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
function add($szam1, $szam2) {
return $szam1 + $szam2;
}
?>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fügvények</title>
</head>
<body>
<form method="POST">
<input type="number" name="num1" id="num1"> +
<input type="number" name="num2" id="num2">
<button type="submit">Összead</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,8 @@
<?php
session_start();
include("func.php");
if (check_post()) {
echo add(szam1: $_SESSION["num1"], szam2: $_SESSION["num2"]);
}
include("html.php");
?>

View File

@@ -0,0 +1,56 @@
<?php
session_start();
$celkonyvtar = "kepek/";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!is_dir($celkonyvtar)) {
mkdir($celkonyvtar);
}
$uname = uniqid();
$celfajl = $celkonyvtar.$_FILES["kepfajl"]["name"];
$maxmeret = 5 * 1024 * 1024;
$kepkiterjesztes = strtolower(pathinfo($celfajl, PATHINFO_EXTENSION));
$uploadOK = 1;
if (getimagesize($_FILES["kepfajl"]["tmp_name"]) == false) {
$uploadOK = 0;
echo "Nem kép lett megadva!";
}
if ($_FILES["kepfajl"]["size"] > $maxmeret) {
$uploadOK = 0;
echo "Túl nagy állomány!";
}
if ($kepkiterjesztes != "jpg" && $kepkiterjesztes != "png") {
$uploadOK = 0;
echo "Nem megengedett képformátum";
}
if ($uploadOK == 1) {
$vanmar = 0;
if (file_exists($celfajl)) {
$vanmar = 1;
}
if (move_uploaded_file($_FILES["kepfajl"]["tmp_name"], $celfajl) == true) {
if ($vanmar == 0) {
$_SESSION["kepek"][] = $celfajl;
}
}
}
}
$kepek = glob($celkonyvtar."*");
foreach ($kepek as $img) {
echo '<img src="'.$img.'" style="width: 200px; height: auto">';
}
// if (isset($_SESSION["kepek"])) {
// foreach ($_SESSION["kepek"] as $value) {
// echo '<img src="'.$value.'" style="width: 200px; height: auto;">';
// }
// }
?>

View File

@@ -0,0 +1,21 @@
<?php
include("head.php");
?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Képek feltöltése PHP-val</h1>
<form action="#" method="POST" enctype="multipart/form-data">
Név: <input type="text" name="kepnev"><br>
<input type="file" name="kepfajl"><br>
<button type="submit">Feltölt</button>
</form>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

View File

@@ -0,0 +1,10 @@
<?php
session_start();
if (isset($_POST["nev"]) && $_POST["nev"] == "vasarlo" && isset($_POST["jelszo"]) && $_POST["jelszo"] == "jelszo" && !isset($_SESSION["nev"])) {
$_SESSION["nev"] = $_POST["nev"];
header(header: "Location: termekek.php");
}
else {
header(header: "Location: form.php");
}
?>

View File

@@ -0,0 +1,12 @@
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
flex-direction: column;
}
.container {
display: flex;
margin-bottom: 20px;
}

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bejelentkezés</title>
</head>
<body>
<?php
session_start();
if (isset($_SESSION["nev"])) {
header(header: "Location: termekek.php");
}
?>
<form action="bejelentkezes.php" method="POST">
<label for="nev">Név: </label><input type="text" name="nev" id="nev"><br>
<label for="jelszo">Jelszó: </label><input type="password" name="jelszo" id="jelszo"><br>
<button type="submit">Bejelentkezés</button>
</form>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,14 @@
<?php
function kiertekeles() {
if (!isset($_POST["kg1"]) || !isset($_POST["kg2"]) || !isset($_POST["kg3"])) {
echo "Nem adtál meg minden értéket!";
}
else {
$baranyhus = 7900;
$tbone = 7500;
$ribeye = 6500;
echo "Megrendelését rögzítettük, fizetendő összeg: ".$baranyhus * $_POST["kg1"] + $tbone * $_POST["kg2"] + $ribeye * $_POST["kg3"]." Ft";
}
}
?>

View File

@@ -0,0 +1,10 @@
<?php
session_start();
if (isset($_SESSION["nev"])) {
unset($_SESSION["nev"]);
header(header: "Location: form.php");
}
else {
header(header: "Location: form.php");
}
?>

View File

@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php
session_start();
if (!isset($_SESSION["nev"])) {
header(header: "Location: form.php");
}
?>
<h1>Vásárlás</h1>
<form class="container" action="#" method="POST">
<div class="termek">
<img src="img/baranyhus.png" alt=""><br>
<p>Bárány hátsó csülök</p>
<p>7900 Ft/kg</p>
<input type="number" name="kg1" id="kg1" value="0">
</div>
<div class="termek">
<img src="img/tbone.png" alt=""><br>
<p>T-bone steak</p>
<p>7500 Ft/kg</p>
<input type="number" name="kg2" id="kg2" value="0">
</div>
<div class="termek">
<img src="img/ribeye.png" alt=""><br>
<p>Ribeye steak</p>
<p>6500 Ft/kg</p>
<input type="number" name="kg3" id="kg3" value="0">
</div><br>
<button type="submit">Vásárlás</button>
</form>
<a href="kijelentkezes.php">Kijelentkezés</a>
<?php
include "kiertekeles.php";
kiertekeles();
?>
</body>
</html>

View File

@@ -0,0 +1,19 @@
<?php require "index1.php"; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
if ($islogin == false) {
require "login.php";
}
else {
require "logged.php";
}
?>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<?php
$islogin = false;
if (isset($_POST["nev"]) && isset($_POST["jelszo"])) {
if ($_POST["jelszo"] == "admin") {
$islogin = true;
}
}
?>

View File

@@ -0,0 +1 @@
<h1>Üdvözöllek, <?php $_POST["nev"]?></h1>

View File

@@ -0,0 +1,7 @@
<form method="POST">
<label for="nev">Név</label>
<input type="text" name="nev" id="nev"><br>
<label for="jelszo">Jelszó</label>
<input type="password" name="jelszo" id="jelszo"><br>
<button type="submit">SUBMITTTTT</button>
</form>

View File

@@ -0,0 +1,34 @@
<?php
$kiirando = 'Éljen a PHP<br>';
echo $kiirando;
$kiirando = "It's PHP<br>";
echo $kiirando;
$kiirando = 12;
echo $kiirando*3;
// phpinfo();
/*
$html = '<html>
<head>
<title>PHP-s html</title>
</head>
<body>
<h1>Ez cím</h1>
<p>Blah blah blah</p>
</body>
</html>';
echo $html;
*/
$cim = "Most más a cím";
?>
<html>
<head>
<title>PHP-s html</title>
</head>
<body>
<h1><?php echo $cim; ?></h1>
<p>Blah blah blah</p>
<?php var_dump($kiirando); ?>
</body>
</html>

View File

@@ -0,0 +1,54 @@
<?php
$method = "POST";
$islogin = false;
/* if (isset($_GET["kod"]) && $_GET["kod"]==1111)
{
$islogin = true;
}
*/
if (isset($_POST["kod"]))
switch ($_POST["kod"])
{
case 1111:
case 2222:
case 3333:
case 4444:
$islogin = true;
break;
default:
$islogin = false;
break;
}
?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PHP form</title>
</head>
<body>
<?php if ($islogin==false)
{ ?>
<form method="<?php echo $method; ?>">
<input type="text" name="nev" title="Adja meg a nevet"><br>
<input type="number" name="kod" min=1000 max=9999 title="Adja meg a kódot"><br>
<input type="submit" value="Belépés">
</form>
<?php
}
else
{
echo "<h1>Üdvözöllek ".$_POST["nev"]."</h1>";
echo "<a href='harmadik.php'>Kijelentkezés</a>";
}
?>
</body>
</html>

View File

@@ -0,0 +1,53 @@
<?php
define("KONSTVER","v20240909");
echo KONSTVER;
echo "<br>";
$tomb = array("hétfő","kedd","szerda","csütörtök","péntek");
var_dump($tomb);
echo "<br>Az első elem a tömbben: ".$tomb[0];
echo "<br>A tömb elemeinek a száma: ".count($tomb);
$tomb[] = "szombat";
echo "<br>Az utolsó elem: ".$tomb[count($tomb)-1];
echo "Tömb elemének a törlése...<br>";
unset($tomb[1]);
var_dump($tomb);
echo "<br>";
foreach ($tomb as $egyelem) {
echo $egyelem."<br/>";
}
foreach ($_SERVER as $key => $value) {
echo $key." értéke: ".$value."<br>";
}
echo "Asszociatív tömb:<br>";
$atomb = array();
$atomb["elso"] = "matyi";
$atomb["masodik"] = "dani";
echo $atomb["elso"]."<br>";
foreach ($atomb as $kulcs => $ertek) {
echo $kulcs." értéke: ".$ertek."<br>";
}
echo "Név: ".$_GET["nev"]."<br>";
echo "Jelszó: ".$_GET["jelszo"]."<br>";
echo "Született: ".$_GET["szul"]."<br>";
if ($_GET["nev"]=="Jani")
{
echo "Belépés engedélyezve Janinak";
}
else
{
echo "Nincs jogosultság";
}
?>

View File

@@ -0,0 +1,8 @@
<?php
echo '<div style="position: absolute; bottom: 3px; width: 100%;
text-align: center; height: 30px; background: black; color: white;">
Készítette: Fölker Csaba (c)2024.
</div>';
?>

View File

@@ -0,0 +1,2 @@
<h3>Üdvözöllek <?php echo $nev; ?></h3>
<a href="negy.php">Kijelentkezés</a>

View File

@@ -0,0 +1,5 @@
<form method="POST">
Login: <input type="text" name="nev" title="Add meg a neved"><br>
Jelszó: <input type="password" name="jelszo" title="Jelszó"><br>
<button type="submit">Belépés</button>
</form>

View File

@@ -0,0 +1,21 @@
<?php require 'negy1.php'; ?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alap web valami</title>
</head>
<body>
<?php require 'footer.php'; ?>
<h1>POST használata </h1>
<?php
if ($islogin==false)
require 'loginform.php';
else
require 'logged.php';
?>
<?php require 'footer.php'; ?>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<?php
$islogin = false;
if (isset($_POST["nev"]) && isset($_POST["jelszo"])){
$nev = $_POST["nev"];
$jelszo = $_POST["jelszo"];
if (strlen($nev)>3 && strlen($jelszo)>4)
if ($nev == 'admin' && $jelszo=='admin')
{
$islogin = true;
}
}
?>

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,25 @@
<?php
session_start();
if (isset($_SESSION["user"])) {
header(header: "Location: profile.php");
}
?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bejelentkezés</title>
</head>
<body>
<h1>Bejelentkezés</h1>
<form action="profile.php" method="POST">
<label for="nev">Név: </label><input type="text" name="nev" id="nev"><br>
<label for="jelszo">Jelszó: </label><input type="password" name="jelszo" id="jelszo"><br>
<input type="color" name="szin" id="szin"><br>
<button type="submit">Bejelentkezés</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,6 @@
<?php
session_start();
unset($_SESSION["user"]);
setcookie("szin", "", time() - 3600);
header(header: "Location: login.php");
?>

View File

@@ -0,0 +1,38 @@
<?php
session_start();
if (isset($_POST["nev"]) && !isset($_SESSION["user"])) {
$_SESSION["user"] = $_POST["nev"];
setcookie("szin", $_POST["szin"], time() + (60 * 60 * 24));
$szin = $_POST["szin"];
}
else if ($_SESSION["user"]) {
$szin = $_COOKIE["szin"];
}
else {
header(header: "Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profil</title>
<style>
body {
background-color: <?php echo $szin ?>;
}
</style>
</head>
<body>
<?php
echo "Név: ". $_SESSION["user"]. "<br>";
echo "Választott szín: ". $szin;
?>
<br><a href="logout.php">Kijelentkezés</a>
</body>
</html>