You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
4.4 KiB
98 lines
4.4 KiB
<?php
|
|
if(isset($_GET["logout"])){
|
|
session_start();
|
|
unset($_SESSION["login"]);
|
|
session_unset();
|
|
session_destroy();
|
|
|
|
session_start();
|
|
session_regenerate_id(true);
|
|
header('Clear-Site-Data: "cache"');
|
|
header("Location: index.php");
|
|
die();
|
|
}else{
|
|
$liteload = true; $sqldependent = true; include "header.php";
|
|
if(isset($_POST["submit"])){
|
|
if(isset($_POST["username"]) && isset($_POST["password"])){
|
|
$sql = "SELECT * FROM `auth` WHERE `username` = '".$conn->real_escape_string($_POST['username'])."'";
|
|
$result = $conn->query($sql);
|
|
if ($result != TRUE) {
|
|
$loginerror = "Adatbázishiba: ".$conn->error;
|
|
}else{
|
|
if (!empty($result) && $result->num_rows > 0) {
|
|
$sqlvals = $result->fetch_assoc();
|
|
if(password_verify($_POST["password"], $sqlvals["password"])){
|
|
$_SESSION["login"] = true;
|
|
$_SESSION["id"] = $sqlvals["id"];
|
|
if(isset($_POST["rememberme"])){
|
|
$params = session_get_cookie_params();
|
|
setcookie(session_name(), $_COOKIE[session_name()], time() + 60*60*24*30, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
|
|
}
|
|
header("Location: index.php");
|
|
}else{
|
|
$loginerror = "Nincs ilyen felhasználónév/jelszó.";
|
|
}
|
|
}else{
|
|
$loginerror = "Nincs ilyen felhasználónév/jelszó.";
|
|
}
|
|
mysqli_free_result($result);
|
|
}
|
|
$conn->close();
|
|
}
|
|
}
|
|
?>
|
|
|
|
<body class="login-page" style="background-color: #3949ab;"> <!-- indigo darken-1 -->
|
|
<div class="login-box">
|
|
<div class="logo">
|
|
<img src="<?php echo $curdir; ?>images/logo.png" height="50px" style="margin:0 auto; display: block; max-width: 50%; height: auto;">
|
|
<a href="javascript:void(0);">Par<b>Edu</b></a>
|
|
<small><insert catchphrase here></small>
|
|
</div>
|
|
<div class="card">
|
|
<div class="body">
|
|
<form id="sign_in" method="POST" action="#">
|
|
<div class="msg">Jelentkezzen be a felület eléréséhez</div>
|
|
<div class="input-group">
|
|
<span class="input-group-addon">
|
|
<i class="material-icons">person</i>
|
|
</span>
|
|
<div class="form-line">
|
|
<input type="text" class="form-control" name="username" placeholder="Felhasználónév" required autofocus>
|
|
</div>
|
|
</div>
|
|
<div class="input-group">
|
|
<span class="input-group-addon">
|
|
<i class="material-icons">lock</i>
|
|
</span>
|
|
<div class="form-line">
|
|
<input type="password" class="form-control" name="password" placeholder="Jelszó" required>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-6 p-t-5">
|
|
<input type="checkbox" name="rememberme" id="rememberme" class="filled-in chk-col-green">
|
|
<label for="rememberme">Emlékezz rám</label>
|
|
</div>
|
|
<div class="col-xs-6">
|
|
<button class="btn btn-block bg-green waves-effect" type="submit" name="submit"><i class="material-icons">vpn_key</i><span>BEJELENTKEZÉS</span></button>
|
|
</div>
|
|
</div>
|
|
<?php if(isset($loginerror)){ echo '
|
|
<div class="card bg-red" style="display:flex; justify-content:center; align-items:center;">
|
|
<span><b>Hiba történt</b>: '.$loginerror.'</span>
|
|
</div>'; } ?>
|
|
<div class="row m-t-15 m-b--20">
|
|
<div class="col-xs-6">
|
|
<a href="contact.php">Kapcsolatfelvétel</a>
|
|
</div>
|
|
<div class="col-xs-6 align-right">
|
|
<a href="forgot-password.php">Elfelejtett jelszó?</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include "footer.php"; } ?>
|