This commit is contained in:
2022-04-07 14:54:21 +02:00
commit 044ec5f379
55 changed files with 1220 additions and 0 deletions

View File

BIN
dolgozat/20220316.zip Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
id;Név;Magasság(cm);Tömeg(kg)
1;Tesztelek;178;86
2;Macska Jancsi;169;58
3;Kis Tamás;185;85
4;Nagy Petra;172;55
5;Kovács Sándor;178;82
6;Tóth József;189;102
9;Kiss Lajos;168;85
10;Nagy József;201;125

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
<title>Feladat 1</title>
<?php
$file_handler = fopen('adatok.txt', 'rw');
$adatok = [];
$szamlalo = 0;
while(!feof($file_handler)){
$adatok[$szamlalo++] = fgets($file_handler);
}
fclose($file_handler);
//print_r($adatok);
//echo '<hr>'
?>
</head>
<body>
<?php
function maxMagassag($tomb){
$index = 0;
$max = -1;
$first = true;
foreach($tomb as $sor){
$szavak = explode(";",$sor);
if($first == false){
foreach($szavak as $adat){
$index++;
if($index == 3){
if($adat > $max){
$max = $adat;
}
}
}
$index = 0;
}else{
$first = false;
}
}
return $max;
}
function atlagSuly($tomb){
$index = 0;
$suly = 0;
$first = true;
foreach($tomb as $sor){
$szavak = explode(";",$sor);
if($first == false){
foreach($szavak as $adat){
$index++;
if($index == 4){
$suly += $adat;
//echo $suly.'<br>';
}
}
$index = 0;
}else{
$first = false;
}
}
$suly = $suly / (count($tomb) - 1);
return $suly;
}
echo "<table class=\"table table-success table-striped\">";
foreach($adatok as $sor){
echo "<tr>";
$szavak = explode(";",$sor);
//print_r($szavak);
//echo "<br>";
foreach($szavak as $oszlop){
echo "<td>";
echo $oszlop;
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
echo "<hr>";
echo "<ul>";
echo "<li>";
echo 'legmagasabb: '.maxMagassag($adatok).' cm';
echo "</li>";
echo "<li>";
echo 'atlag suly: '.atlagSuly($adatok).' kg';
echo "</li>";
echo "<ul>";
?>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<?php
include "kapcsolat.php";
try{
deleteOne($dbc, 'pizzak', $_GET['id']);
header('location: f2.php');
}catch(Exception $exc){
header("Location: hiba.php?hiba=" . $exc->getMessage());
}
?>

View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<?php
include "kapcsolat.php";
$sql = "SHOW TABLES;";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
$tablak = $utasitas->fetchAll(PDO::FETCH_COLUMN);
print_r($tablak);
?>
<html>
<head>
<meta charset="UTF-8">
<title>Adatbázis kezelés</title>
<link href="bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<table class="table table-success table-striped my-3" >
<?php foreach ($tablak as $tabla) : ?>
<tr>
<td><?= $tabla; ?></td><td> <a href=<?=$tabla . ".php"; ?>>Megjelenít </a> </td>
</tr>
<?php endforeach; ?>
</table>
</div>
<script src="bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<?php
?>
<html>
<head>
<meta charset="UTF-8">
<title>Hiba</title>
<link href="bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container-fluid d-flex justify-content-center align-items-center text-center mt-5" style="height: 100vh;" >
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">Hiba</h5>
<h6 class="card-subtitle mb-2 text-muted">Hiba leírása</h6>
<p class="card-text">
<?php
echo "Törlési hiba: " . $_GET['hiba'];
?></p>
<a href="index.php" class="btn btn-success">vissza</a>
</div>
</div>
</div>
<script src="bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,70 @@
<!DOCTYPE html>
<?php
include "kapcsolat.php";
$alkalmazottak = readAll($dbc,'pizzak');
?>
<html>
<head>
<meta charset="UTF-8">
<title>Pizza</title>
<link href="bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body style="margin-left: 10%;">
<form name="adatok" method="POST">
<fieldset>
<label for="nev">Nev </label><br>
<input id="nev" type="text" name="nev" value=""><br>
<label for="feltet">Feltét </label><br>
<input id="feltet" type="text" name="feltet" value=""><br>
<label for="ar">Ár </label><br>
<input id="ar" type="text" name="ar" value=""><br>
<label for="kep">Kép </label><br>
<input id="kep" type="text" name="kep" value=""><br>
</fieldset>
</form>
<br>
<?php
function lekeres(){
$nev = $_POST['nev'];
$feltet = $_POST['feltet'];
$ar = $_POST['ar'];
$kep = $_POST['kep'];
echo $nev;
echo $feltet;
echo $ar;
echo $kep;
}
?>
<a class="btn btn-info" role="button" name="lekeres">Beszúrás</a>
<a href="f2.php" class="btn btn-info" role="button">Vissza</a>
<script src="bootstrap.min.js" type="text/javascript"></script>
</body>
</html>
<?php
/*if(array_key_exists('button1', $_POST)) {
button1();
}
else if(array_key_exists('button2', $_POST)) {
button2();
}
function button1() {
echo "This is Button1 that is selected";
}
function button2() {
echo "This is Button2 that is selected";
}*/
?>
<!--<form method="post">
<input type="submit" name="button1"
class="button" value="Button1" />
<input type="submit" name="button2"
class="button" value="Button2" />
</form>-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -0,0 +1,35 @@
<?php
$host = 'localhost';
$dbuser = 'root';
$password = '';
$dbname = 'pizzeria';
try {
$datasourcename = "mysql:host=$host;dbname=$dbname";
echo $datasourcename . "<hr>";
$options = [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$dbc = new PDO($datasourcename, $dbuser, $password, $options);
} catch (PDOException $exc) {
echo "Kapcsolódási hiba:" . $exc->getMessage();
}
function readAll($dbc, $table){
$sql = "SELECT * FROM $table;";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
return $utasitas->fetchAll(PDO::FETCH_ASSOC);
}
function readOne($dbc, $table, $id){
$sql = "SELECT * FROM $table WHERE id=$id;";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
return $utasitas->fetchAll(PDO::FETCH_ASSOC);
}
function deleteOne($dbc, $table, $id){
$sql = "DELETE FROM $table WHERE id=$id";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
}

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<?php
include "kapcsolat.php";
$alkalmazottak = readAll($dbc,'pizzak');
?>
<html>
<head>
<meta charset="UTF-8">
<title>Pizza</title>
<link href="bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<a class="btn btn-success" href=".php?id=<?= $sor['id'];?>">Hozzáadás</a>
<table class="table table-success table-striped my-3" >
<tr>
<?php foreach ($alkalmazottak[0] as $key => $value) : ?>
<th><?= $key; ?></th>
<?php endforeach; ?>
<th></th>
<th></th>
<th></th>
</tr>
<?php foreach ($alkalmazottak as $sor) : ?>
<tr>
<?php foreach ($sor as $value) : ?>
<?php
if(str_contains($value, ".jpg")){
echo "<td><img class=\"img-thumbnail\" src=\"img/$value\"></td>";
}else{
echo "<td>".$value."</td>";
}
?>
<?php endforeach; ?>
<td><a class="btn btn-success" href="view.php?id=<?= $sor['id'];?>">Megtekint</a></td>
<td><a class="btn btn-success" href=".php?id=<?= $sor['id'];?>">Szerkeszt</a></td>
<td><a class="btn btn-success" href="delete.php?id=<?= $sor['id'];?>">Töröl</a></td>
</tr>
<?php endforeach; ?>
</table>
<a href="f2.php" class="btn btn-info" role="button">Vissza</a>
</div>
<script src="bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,71 @@
--
-- Script was generated by Devart dbForge Studio 2020 for MySQL, Version 9.0.689.0
-- Product home page: http://www.devart.com/dbforge/mysql/studio
-- Script date 2022. 03. 15. 23:47:58
-- Server version: 10.4.20
-- Client version: 4.1
--
--
-- Disable foreign keys
--
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
--
-- Set SQL mode
--
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
--
-- Set character set the client will use to send SQL statements to the server
--
SET NAMES 'utf8';
DROP DATABASE IF EXISTS pizzeria;
CREATE DATABASE IF NOT EXISTS pizzeria
CHARACTER SET utf8
COLLATE utf8_hungarian_ci;
--
-- Set default database
--
USE pizzeria;
--
-- Create table `pizzak`
--
CREATE TABLE IF NOT EXISTS pizzak (
id INT(11) NOT NULL AUTO_INCREMENT,
nev VARCHAR(100) DEFAULT NULL,
feltetek TEXT DEFAULT NULL,
ar INT(11) DEFAULT NULL,
kep VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 11,
AVG_ROW_LENGTH = 2340,
CHARACTER SET utf8,
COLLATE utf8_hungarian_ci;
--
-- Dumping data for table pizzak
--
INSERT INTO pizzak VALUES
(2, 'Calzone vékony pizza', 'Gomba, Mozzarella, paradicsom szósz, pármai sonka', 1852, 'calzone.jpg'),
(3, 'Capricciosa vékony pizza', 'Gomba, Mozzarella, Paradicsom, articsóka, paradicsom szósz, pármai sonka', 2150, 'capricciosa.jpg'),
(4, 'Margherita vékony pizza', 'Mozzarella, Paradicsom, oregánó, paradicsom szósz', 1650, 'margherita.jpg'),
(5, 'Napoletana vékony pizza', 'Mozzarella, Tonhal, paradicsom szósz', 1850, 'napoletana.jpg'),
(6, 'Quattro Formaggi vékony pizza', 'Parmezán, Rokfort, Trappista, tejfölös alap', 1950, 'quattroformaggi.jpg'),
(7, 'Pugliese vékony pizza', 'Lilahagyma, Mozzarella, paradicsom szósz', 1950, 'pugliese.jpg');
--
-- Restore previous SQL mode
--
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
--
-- Enable foreign keys
--
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<?php
include "kapcsolat.php";
$alkalmazottak = readAll($dbc,'pizzak');
?>
<html>
<head>
<meta charset="UTF-8">
<title>Megtekintés</title>
<link href="bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div style="margin-left: 10%;">
<?php
$test = readOne($dbc, 'pizzak', $_GET['id']);
print_r($test);
echo "<ul>";
foreach($test[0] as $key => $value){
echo "<li><b>".$key.":</b> ".$value."</li>";
}
echo "</ul>";
?>
<a href="f2.php" class="btn btn-info" role="button">Vissza</a>
</div>
</body>
</html>

4
fajl kezeles/adatok.txt Normal file
View File

@@ -0,0 +1,4 @@
1,Kiss Tamás,Debrecen,1995.10.22
2,Nagy Láaszló,Tata,1995.10.22
3,Tóth Eszter,Józsa,2000.01.15
4,Kiss Tamás,Eger,1998.03.07

52
fajl kezeles/fajl.php Normal file
View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
<title></title>
</head>
<body>
<?php
//print_r($_SERVER);
/*$gyoker = $_SERVER['Document_root'];
$projekt = 'fajl_2022_01';
$file = 'adatok.txt';
$fajl_eleres = "$gyoker/$projekt/$file";
echo $fajl_eleres."<hr>";*/
$adatok = file('adatok.txt');
print_r($adatok);
$file_handler = fopen('adatok.txt', 'rw');
$adatok2 = [];
$szamlalo = 0;
while(!feof($file_handler)){
$adatok2[$szamlalo++] = fgets($file_handler);
}
fclose($file_handler);
print_r($adatok2);
echo "<hr>";
?>
<div class="container">
<?php foreach($adatok2 as $sor): ?>
<table class="table table-success table-striped">
<tr>
<td>
<?php foreach($adatok2 as $sor2): ?>
<?php endforeach?>
</td>
</tr>
</table>
<?php endforeach?>
</div>
</body>
</html>

55
misc/fuggvenyek.php Normal file
View File

@@ -0,0 +1,55 @@
<html>
<?php
$oldal = [
'title' => "Oldalgeneráló",
'header' => "PHP gyakorlas",
'menu' => [
"home" => "Nyitó oldal",
"contact" => "Kapcsolat",
"gallery" => "Galéria",
"other" => "Egyebek"],
'tartalom' => [
['P0', "Lorem ipsum dolor sit amet."],
['P1', "Lorem ipsum dolor sit amet."],
['P2', "Lorem ipsum dolor sit amet."],
['P3', "Lorem ipsum dolor sit amet."],
['P4', "Lorem ipsum dolor sit amet."]
],
'footer' => ['ev' => '2022', 'ceg' => 'Teszt Elek', 'email' => 'tesztelek@gmail.com']
];
function headerMaker(){
}
function pMaker(){
}
function MenuMaker($items, $active = null){
foreach($items as $key => $value){
echo '<li';
if($active){
echo 'class="active">';
}
echo '<a href="? page = '.$key.'">'.$value.'</a></li>';
}
}
function MenuMaker2($items, $active = null){
$nav = "<nav><ul>";
foreach($items as $key => $value){
echo '<li';
if($active){
echo 'class="active">';
}
echo '<a href="? page = '.$key.'">'.$value.'</a></li>';
}
}
?>
</html>

6
misc/functions.php Normal file
View File

@@ -0,0 +1,6 @@
<?php
$nem = [['N', 'Nő'],
['F', 'Férfi']];
print_r($nem);
?>

36
misc/masodfoku.php Normal file
View File

@@ -0,0 +1,36 @@
<html>
<head><title>Masodfoku</title></head>
<body>
<form method="post">
a<input type="number" name="a"><br>
b<input type="number" name="b"><br>
c<input type="number" name="c"><br>
<input type="submit" name="submit">
</form>
<?php
$a = $_POST["a"];
$b = $_POST["b"];
$c = $_POST["c"];
$d = -1;
if($a == 0 && $b == 0 && $c == 0){
echo "azonossag";
}elseif($a == 0 && $b == 0 && $c != 0){
echo "ellentmondas";
}elseif($a == 0 && $b != 0 && $c != 0){
$x = -($c/$b);
echo "\n.$x";
}elseif($a != 0){
$d = ($b * $b) - (4 * $a * $c);
}
if($d > 0){
echo "\nkét megoldás van";
}elseif($d == 0){
echo "\negy megoldás van";
}else{
echo "\nnincs megoldas";
}
?>
</body>
</html>

16
misc/menu.css Normal file
View File

@@ -0,0 +1,16 @@
*{
padding : 0;
margin: 0;
}
li{
float: left;
padding: 0.5em;
list-style-type: none;
color: white;
background-color: gray;
}
a{
color: white;
}

23
misc/menu.php Normal file
View File

@@ -0,0 +1,23 @@
<html>
<head>
<title>Menu</title>
<link rel="stylesheet" href="menu.css">
<?php
include_once 'fuggvenyek.php';
?>
</head>
<body>
<header><?php echo $oldal['header'] ?></header>
<main>
<br>
<?php
for($i = 0; $i < count($oldal['tartalom']); $i++){
echo "<h4>".$oldal['tartalom'][$i][0]."</h4><p>".$oldal['tartalom'][$i][1]."</p><br>";
}
?>
</main>
<footer>
<?= 'Készítette:'.$oldal['footer']['ceg'].' &COPY '.$oldal['footer']['ev']; ?>
</footer>
</body>
</html>

14
misc/szorzotabla.php Normal file
View File

@@ -0,0 +1,14 @@
<html>
<head> <title>Szorzotabla</title></head>
<body>
<?php
for($i = 1; $i <= 10; $i++){
for($j = 1; $j <= 10; $j++){
$value = $i * $j;
echo($value." ");
}
echo("<br>" );
}
?>
</body>
</html>

42
misc/tomb.php Normal file
View File

@@ -0,0 +1,42 @@
<html>
<head><title>tomb</title></head>
<body>
<?php
$primek = [2, "alma", true, 3.14];
$primek[100] = 100;
$asszoctomb = [
"alma" => "piros",
"korte" => "sarga",
"uborka" => "zold"
];
print_r($primek);
echo "<br>".$primek[0];
echo "<br>".$primek[100];
echo "<br><br>";
var_dump($asszoctomb);
echo "<br>".$asszoctomb["alma"];
echo "<br>".$asszoctomb["korte"];
echo "<br>".$asszoctomb["uborka"];
echo "<br>for print<br>";
foreach($asszoctomb as $value){
echo $value." - ";
}
echo "<br><br>";
foreach($asszoctomb as $key => $value){
echo '<br>$asszoctomb['.$key.']='.$value;
}
$kulcsok = array_keys($asszoctomb);
$kulcsok2 = array_keys($primek);
echo "<br><br>";
print_r($kulcsok = array_values($asszoctomb));
print_r($kulcsok2 = array_values($primek));
?>
</body>
</html>

28
misc/valami.php Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dunno</title>
<?php include_once 'functions.php'?>
</head>
<body>
<form name="adatok" method="POST">
<legend>Adatok bekerese</legend>
<fieldset>
<label for="neme">Nem:</label>
<div>
<select id="neme" name="nem">
<option value="F">Férfi</option>
<option value="N">Nő</option>
</select>
</div>
<div><br>
<label for="kor">Kor: </label>
<input type="number" name="kor" id="kor" value=""/>
</div><br>
<input type="submit" name="elkuld" value="elkuld"/>
</fieldset>
</form>
</body>
</html>

96
osztaly2/osztaly2.php Normal file
View File

@@ -0,0 +1,96 @@
<?php
class Select{
private $name;
private $value;
public function __construct($value){
$this->setValue($value);
}
public function setName($name){
$this->name = $name;
}
public function getName(){
return $this->name;
}
public function setValue($value){
//tomb ellenorzes
if(!is_array($value)){
throw new Exception("Az átadott érték nem tömb");
}else{
$this->value = $value;
}
}
public function getValue(){
return $this->value;
}
public function makeOptions($value){
//opciok letrehozasa
for($i = 0; $i < count($value); $i++){
echo "<option>$value[$i]</option>";
}
}
public function makeSelect(){
//lenyilo menu letrehozas
echo "<select>";
$this->makeOptions($this->getValue());
echo "</select>";
}
}
print_r($_POST);
$nev = "";
$felhasznalo = "";
$email = "";
$bongeszo = "";
function lekeres(){
$nev = $_POST['nev'];
$felhasznalo = $_POST['felhasznalo'];
$email = $_POST['email'];
$bongeszo = $_POST['bongeszo'];
if($_POST['submit'] == "Submit"){
echo "<div>";
echo $nev;
echo $felhasznalo;
echo $email;
echo $bongeszo;
echo "</div>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
<title>Legördülő menü</title>
</head>
<body style="margin-left: 35%; margin-top: 5%;">
<form name="adatok" actioin="osztaly2.php" method="POST">
<fieldset>
<label for="nev">Nev </label><br>
<input id="nev" type="text" name="nev" value=""><br>
<label for="felhasznalo">Felhasználónév </label><br>
<input id="felhasznalo" type="text" name="felhasznalo" value=""><br>
<label for="email">Email </label><br>
<input id="email" type="text" name="email" value=""><br>
<label for="bongeszo">Bongeszo</label><br>
<?php
$select = new Select(["Firefox", "Chrome", "Edge", "Opera GX", "Safari"]);
$select->makeSelect();
?><br><br>
<input type="submit" name="submit" value="Submit"/>
</fieldset>
</form>
<?php
?>
</body>
</html>

49
osztalyok1/osztaly1.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
class Mezo{
private $nev;
private $ertek;
public function __construct($nev, $ertek){
$this->nev = $nev;
$this->ertek = $ertek;
echo "<br>létrejött az $this->nev objektum<br>";
}
public function __destruct()
{
echo "<br>megszunt az $this->nev <br>";
}
public function getErtek(){
return $this->ertek;
}
public function setErtek($ertek){
$this->ertek = $ertek;
}
public function getNev(){
return $this->nev;
}
public function setNev($nev){
$this->nev = $nev;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<?php
$mezo1 = new Mezo("Tamás", 6);
//$mezo1->ertek = "Tamás";
//$mezo1->setErtek("Tamás");
echo $mezo1->getErtek();
$mezo2 = new Mezo("Zsolt", 9);
//$mezo2->setErtek("Zsolt");
echo $mezo2->getErtek();
?>
</body>
</html>

134
sql/db_elso.sql Normal file
View File

@@ -0,0 +1,134 @@
--
-- Script was generated by Devart dbForge Studio 2020 for MySQL, Version 9.0.689.0
-- Product home page: http://www.devart.com/dbforge/mysql/studio
-- Script date 2021. 12. 13. 9:26:41
-- Server version: 10.4.21
-- Client version: 4.1
--
--
-- Disable foreign keys
--
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
--
-- Set SQL mode
--
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
--
-- Set character set the client will use to send SQL statements to the server
--
SET NAMES 'utf8';
DROP DATABASE IF EXISTS db_elso;
CREATE DATABASE IF NOT EXISTS db_elso
CHARACTER SET utf8
COLLATE utf8_hungarian_ci;
--
-- Set default database
--
USE db_elso;
--
-- Create table `firms`
--
CREATE TABLE IF NOT EXISTS firms (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
address VARCHAR(255) NOT NULL,
postcode INT(11) NOT NULL,
remark TEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 14,
AVG_ROW_LENGTH = 8192,
CHARACTER SET utf8,
COLLATE utf8_hungarian_ci;
--
-- Create table `employees`
--
CREATE TABLE IF NOT EXISTS employees (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
address VARCHAR(255) NOT NULL,
salary INT(10) NOT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 16,
AVG_ROW_LENGTH = 5461,
CHARACTER SET latin1,
COLLATE latin1_swedish_ci;
--
-- Create table `workers`
--
CREATE TABLE IF NOT EXISTS workers (
id INT(11) NOT NULL AUTO_INCREMENT,
empID INT(11) NOT NULL,
firmID INT(11) DEFAULT NULL,
begin DATE DEFAULT NULL,
end DATE DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 8,
AVG_ROW_LENGTH = 5461,
CHARACTER SET utf8,
COLLATE utf8_hungarian_ci;
--
-- Create foreign key
--
ALTER TABLE workers
ADD CONSTRAINT FK_workers_employees_id FOREIGN KEY (empID)
REFERENCES employees(id) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Create foreign key
--
ALTER TABLE workers
ADD CONSTRAINT FK_workers_firms_id FOREIGN KEY (firmID)
REFERENCES firms(id);
--
-- Dumping data for table firms
--
INSERT INTO firms VALUES
(1, 'Zabhegyező Kft', 'Zabhegy', 4556, ' :-(((( ++++'),
(2, 'Réparudi Bt.', 'Salátaföld2', 5005, 'Szántás alatt'),
(4, 'ABC Zrt.', 'Egerszalók', 2451, ':-)'),
(13, 'Nagy Forma Bt.', 'Debrecen', 4031, 'yxncybnxcbxybcmyxbcyxbcmybxcm,byxy');
--
-- Dumping data for table employees
--
INSERT INTO employees VALUES
(7, 'Kiss Kati', 'Szarvas', 5000000),
(9, 'Tóth Miklós', 'Debrecen', 35000000),
(10, 'Nagy Adelka', 'Szarvas', 35000000);
--
-- Dumping data for table workers
--
INSERT INTO workers VALUES
(2, 9, 1, '2019-04-17', NULL),
(3, 7, 2, '2019-04-01', '2019-05-02'),
(4, 10, 2, '2019-05-08', NULL),
(6, 10, 4, '2021-01-01', '2021-11-30'),
(7, 7, 1, '2021-11-26', '2021-11-18');
--
-- Restore previous SQL mode
--
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
--
-- Enable foreign keys
--
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<?php
include "../kozos/kapcsolat.php";
$alkalmazottak = readAll($dbc,'employees');
?>
<html>
<head>
<meta charset="UTF-8">
<title>Alkalmozottak</title>
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<table class="table table-success table-striped my-3" >
<tr>
<?php foreach ($alkalmazottak[0] as $key => $value) : ?>
<th><?= $key; ?></th>
<?php endforeach; ?>
</tr>
<?php foreach ($alkalmazottak as $sor) : ?>
<tr>
<?php foreach ($sor as $value) : ?>
<td><?= $value; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
<a href="index.php" class="btn btn-info" role="button">Vissza</a>
</div>
<script src="../kozos/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<?php
include "../kozos/kapcsolat.php";
$alkalmazottak = readAll($dbc, 'firms');
?>
<html>
<head>
<meta charset="UTF-8">
<title>Cégek</title>
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<table class="table table-success table-striped my-3" >
<tr>
<?php foreach ($alkalmazottak[0] as $key => $value) : ?>
<th><?= $key; ?></th>
<?php endforeach; ?>
</tr>
<?php foreach ($alkalmazottak as $sor) : ?>
<tr>
<?php foreach ($sor as $value) : ?>
<td><?= $value; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
<a href="index.php" class="btn btn-info" role="button">Vissza</a>
</div>
<script src="../kozos/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

30
sql/dbphp1/index.php Normal file
View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<?php
include "kozos/kapcsolat.php";
$sql = "SHOW TABLES;";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
$tablak = $utasitas->fetchAll(PDO::FETCH_COLUMN);
//print_r($tablak);
?>
<html>
<head>
<meta charset="UTF-8">
<title>Adatbázis kezelés</title>
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<table class="table table-success table-striped my-3" >
<?php foreach ($tablak as $tabla) : ?>
<tr>
<td><?= $tabla; ?></td><td> <a href=<?="/$tabla/". $tabla . ".php"; ?>>Megjelenít </a> </td>
</tr>
<?php endforeach; ?>
</table>
</div>
<script src="kozos/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

7
sql/dbphp1/kozos/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
sql/dbphp1/kozos/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
<?php
$host = 'localhost';
$dbuser = 'root';
$password = '';
$dbname = 'db_elso';
try {
$datasourcename = "mysql:host=$host;dbname=$dbname";
echo $datasourcename . "<hr>";
$options = [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$dbc = new PDO($datasourcename, $dbuser, $password, $options);
} catch (PDOException $exc) {
echo "Kapcsolódási hiba:" . $exc->getMessage();
}
function readAll($dbc, $table){
$sql = "SELECT * FROM $table;";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
return $utasitas->fetchAll(PDO::FETCH_ASSOC);
}
function readOne($dbc, $table, $id){
$sql = "SELECT * FROM $table WHERE id=$id;";
$utasitas = $dbc->prepare($sql);
$utasitas->execute();
return $utasitas->fetchAll(PDO::FETCH_ASSOC);
}

View File

@@ -0,0 +1,7 @@
browser.id=SL[/Browsers/FirefoxBrowser
copy.src.files=false
copy.src.on.open=false
copy.src.target=D:\\xampp\\htdocs\\PhpProject1
index.file=index.php
run.as=LOCAL
url=http://localhost/dbphp1/

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>

View File

@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_80
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>dbphp1</name>
</data>
</configuration>
</project>

View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<?php
include "../kozos/kapcsolat.php";
$alkalmazottak = readAll($dbc, 'workers');
?>
<html>
<head>
<meta charset="UTF-8">
<title>Munkaviszonyok</title>
<link href="kozos/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<table class="table table-success table-striped my-3" >
<tr>
<?php foreach ($alkalmazottak[0] as $key => $value) : ?>
<th><?= $key; ?></th>
<?php endforeach; ?>
</tr>
<?php foreach ($alkalmazottak as $sor) : ?>
<tr>
<?php foreach ($sor as $value) : ?>
<td><?= $value; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
<a href="index.php" class="btn btn-info" role="button">Vissza</a>
</div>
<script src="../kozos/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>