first commit

This commit is contained in:
andalevente 2023-01-27 12:03:06 +01:00
commit ca42a1e698
5 changed files with 156 additions and 0 deletions

36
bejelentkezes.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=0, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
<title>Bejelentkezés</title>
</head>
<body>
<div class="centerdiv">
<div class="card col-2">
<div class="card-body">
<h3 class="text-center">Bejelentkezés</h3>
<form action="login.php" method="post" autocomplete="off">
<b>E-mail</b>
<br>
<input class="col-12" type="email" name="email" id="email" placeholder="Az ön e-mail címe" required>
<br>
<b>Jelszó</b>
<br>
<input class="col-12" type="password" name="password" id="password" placeholder="Az ön jelszava" required>
<br><br>
<div class="text-center">
<input type="submit" class="btn btn-primary col-12" value="Belépés">
<br>
<a href="regisztracio.html">Regisztráció</a>
</div>
</form>
</div>
</div>
</div>
</body>
</html>

17
home.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Főoldal</title>
</head>
<body>
<div class="card col-2">
<div class="card-body">
<h3><b>Ön sikeresen belépett az alkalmazásba!</b></h3>
Kilépéshez csak zárja be a böngészőt!
</div>
</div>
</body>
</html>

52
login.php Normal file
View File

@ -0,0 +1,52 @@
<?php
session_start();
// Change this to your connection info.
$DATABASE_HOST = 'localhost';
$DATABASE_USER = 'root';
$DATABASE_PASS = '';
$DATABASE_NAME = 'logininfo';
// Try and connect using the info above.
$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME);
if (mysqli_connect_errno()) {
// If there is an error with the connection, stop the script and display the error.
exit('Failed to connect to MySQL: ' . mysqli_connect_error());
}
// Now we check if the data from the login form was submitted, isset() will check if the data exists.
if ( !isset($_POST['email'], $_POST['password']) ) {
// Could not get the data that should have been sent.
exit('Kérem töltse ki a mezőket!');
}
// Prepare our SQL, preparing the SQL statement will prevent SQL injection.
if ($stmt = $con->prepare('SELECT id, jelszo FROM fiokok WHERE email = ?')) {
// Bind parameters (s = string, i = int, b = blob, etc), in our case the username is a string so we use "s"
$stmt->bind_param('s', $_POST['email']);
$stmt->execute();
// Store the result so we can check if the account exists in the database.
$stmt->store_result();
if ($stmt->num_rows > 0) {
$stmt->bind_result($id, $password);
$stmt->fetch();
// Account exists, now we verify the password.
// Note: remember to use password_hash in your registration file to store the hashed passwords.
if (password_verify($_POST['password'], $password)) {
// Verification success! User has logged-in!
// Create sessions, so we know the user is logged in, they basically act like cookies but remember the data on the server.
session_regenerate_id();
$_SESSION['loggedin'] = TRUE;
$_SESSION['name'] = $_POST['email'];
$_SESSION['id'] = $id;
echo 'Üdvözlöm ' . $_SESSION['name'] . '!';
} else {
// Incorrect password
echo 'Helytelen felhasználónév vagy jelszó!';
}
} else {
// Incorrect username
echo 'Helytelen felhasználónév vagy jelszó!';
}
$stmt->close();
}
?>

46
regisztracio.html Normal file
View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Regisztráció</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
crossorigin="anonymous"></script>
</head>
<body>
<div class="centerdiv">
<div class="card col-2">
<div class="card-body">
<h3 class="text-center">Regisztráció</h3>
<form action="login.js" method="post">
<b>Teljes név</b>
<br>
<input class="col-12" type="text" name="nev" id="nev" placeholder="Az ön neve*">
<br>
<b>E-mail</b>
<br>
<input class="col-12" type="email" name="email" id="email" placeholder="Az ön e-mail címe*">
<br>
<b>Jelszó</b>
<br>
<input class="col-12" type="password" name="jelszo" id="jelszo" placeholder="Az ön jelszava*">
<br><br>
<div class="text-center">
<input type="submit" class="btn btn-primary col-12" value="login">
<br>
<a href="bejelentkezes.html">Bejelentkezés</a>
</div>
</form>
</div>
</div>
</div>
</body>
</html>

5
style.css Normal file
View File

@ -0,0 +1,5 @@
.centerdiv{
display: flex;
justify-content: center;
align-items: center;
}