include '../includes/config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { $kartyaId = test_input($_POST["kartyaId"]); $vez_nev = test_input($_POST["vez_nev"]); $ker_nev = test_input($_POST["ker_nev"]); $elonev = test_input($_POST["elonev"]); $email = test_input($_POST["email"]); $telefon = test_input($_POST["telefon"]); $lakhely_varos = test_input($_POST["lakhely_varos"]); $lakhely_varosresz = test_input($_POST["lakhely_varosresz"]); $felh_nev = test_input($_POST["felh_nev"]); $jelszo = test_input($_POST["jelszo"]); $thely = test_input($_POST["thely"]); $email_in_use = db_getUserId(null, $email, null); $username_in_use = db_getUserId($felh_nev, null, null); $card_in_use = db_getUserId(null, null, $kartyaId); if ($email_in_use === FALSE && $username_in_use === FALSE && $card_in_use === FALSE) { /* ************* HTML E-MAIL KÜLDÉSE ************* */ $to = $email; $subject = "HRP Interaktív Program - Regisztráció"; $message = "Szia!"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; //$headers .= 'From: <*****@*****.**>' . "\r\n"; //$headers .= 'Cc: myboss@example.com' . "\r\n"; mail($to, $subject, $message, $headers); /* *********************************************** */ $hash = password_hash($jelszo, PASSWORD_BCRYPT, ['cost' => 10]); $ret1 = db_addUser($email, $felh_nev, $kartyaId, $hash, $vez_nev, $ker_nev, $elonev, $telefon, $lakhely_varos, $lakhely_varosresz); $stmt = $conn->prepare("UPDATE kartya SET vallalat_telephely=? WHERE kartya_id=?"); $ret2 = $stmt->execute(array($thely, $kartyaId));
<?php $active = "login"; $color = "magenta"; include_once 'includes/config.php'; if (isset($_SESSION["is_auth"])) { header('location: lecke.php'); exit; } if (isset($_POST['login-submit'])) { if (!empty($_POST['username']) && !empty($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; $userId = db_getUserId($username, null, null); $cardIsActive = db_testCardValidation($userId, null, null, null); $userFirstName = db_getUserFirstName($username, null, null); $userLastLogin = db_getUserLastLogin($username, null, null); db_updateLastLogin(null, $username, null, null); $timeWindowName = db_getUserTimeWindow(null, $username, null, null); $hash = db_getUserHash($userId, $username, null, null); if ($userId && $hash) { if (password_verify($password, $hash)) { if ($cardIsActive) { $_SESSION['is_auth'] = true; $_SESSION['userId'] = $userId; $_SESSION['userFirstName'] = $userFirstName; $_SESSION['userLastLogin'] = $userLastLogin; $_SESSION['timeWindowName'] = $timeWindowName; if (isset($_POST['remember_me'])) { storeNewAuthToken($userId); }
$passw_uj_re = test_input($_POST['new_passw_re']); $validate['passw_re'] = preg_match("/[^\"'\\{\\}\\[\\]\\(\\)]{6,20}\$/", $passw_uj_re); } else { $passw_uj_re = null; } if ($userEmail != $userEmail_uj || $varos != $varos_uj || $userName != $userName_uj || $telefon != $telefon_uj || $varosresz != $varosresz_uj || isset($passw_uj)) { $valtozas = true; } else { $valtozas = false; } $hash = db_getUserHash($userId, null, null, null); if ($hash && !in_array(false, $validate) && $valtozas) { if (password_verify($passw_regi, $hash)) { $username_ok = true; if ($userName_uj != $userName) { if (db_getUserId($userName_uj, null, null) !== FALSE) { $username_ok = false; } } if ($username_ok) { if (isset($passw_uj)) { if ($passw_uj == $passw_uj_re) { $hash = password_hash($passw_uj, PASSWORD_BCRYPT, ['cost' => 10]); } else { $msg = "Új jelszó és Új jelszó ismét mezők nem egyeznek!"; } } if (!isset($msg)) { if (db_updateUser($userId, $userEmail_uj, $userName_uj, $hash, $telefon_uj, $varos_uj, $varosresz_uj)) { $msgColor = "darkgreen"; $msg = "Adatok sikeresen módosítva!";
<?php include_once 'includes/config.php'; if (isset($_SESSION["admin_is_auth"])) { header('location: admin.php'); exit; } if (isset($_POST['login-submit'])) { if (!empty($_POST['username']) && !empty($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; $userId = db_getUserId($username); $hash = db_getUserHash($userId, $username); if ($userId && $hash) { if (password_verify($password, $hash)) { $_SESSION['admin_is_auth'] = true; $_SESSION['admin_userId'] = $userId; header('location: admin.php'); exit; } else { $message = "Hibás felhasználónév vagy jelszó!"; } } else { $message = "Hibás felhasználónév vagy jelszó!"; } } else { $message = "Kérjük, írja be felhasználónevét és jelszavát!"; } } ?> <!DOCTYPE html>