minor changes
This commit is contained in:
parent
c4c5fc1fb8
commit
bc227e3393
@ -68,10 +68,12 @@
|
||||
?>
|
||||
|
||||
<div id="content">
|
||||
<br><span> Session User: <?php echo $_SESSION['user']; ?> </span>
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['username'])){
|
||||
echo("<br><span> Herzlich Willkomen " . $_SESSION['username'] . "</span>");
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Include the footer-->
|
||||
|
@ -25,6 +25,7 @@ async function getNewUniqueLink() {
|
||||
|
||||
//<!--Register-->
|
||||
document.getElementById('btnCreate').addEventListener("click" , async (event) => {
|
||||
event.preventDefault();
|
||||
const formData = new FormData(document.getElementById('create-form'));
|
||||
try {
|
||||
const response = await fetch('php/signup.php', {
|
||||
|
@ -1 +0,0 @@
|
||||
<?php echo json_encode($_SESSION['user']) ?>
|
@ -6,13 +6,13 @@
|
||||
$pswd = ($_POST['registerPassword']);
|
||||
$email = ($_POST['registerMail']);
|
||||
|
||||
$search_user = $database->prepare("SELECT ID FROM user WHERE user='$name '");
|
||||
$search_user = $database->prepare("SELECT ID FROM user WHERE username='$name '");
|
||||
$search_user->execute();
|
||||
$search_result = $search_user->get_result();
|
||||
|
||||
if ($search_result->num_rows == 0) {
|
||||
$pswd = md5($pswd);
|
||||
$stmt = $database->prepare("INSERT INTO user(user, email, password) VALUES (?,?,?)");
|
||||
$stmt = $database->prepare("INSERT INTO user(username, email, password) VALUES (?,?,?)");
|
||||
$stmt->bind_param("sss", $name, $email, $pswd);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
|
@ -6,14 +6,15 @@ if( (isset($_POST['loginName'])) && isset($_POST['loginPassword'])){
|
||||
$pswd = ($_POST['loginPassword']);
|
||||
$pswd = md5($pswd);
|
||||
|
||||
$stmt = $database->prepare("SELECT id FROM user WHERE '$name'=user AND password='$pswd'");
|
||||
$stmt = $database->prepare("SELECT id, username FROM user WHERE '$name'=username AND password='$pswd'");
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows == 1) {
|
||||
$object = $result->fetch_object();
|
||||
$_SESSION['user'] = $object->id;
|
||||
echo "Einloggen erfolgreich";
|
||||
$_SESSION['username'] = $object->username;
|
||||
echo "Einloggen erfolgreich <br> Willkommen " . $_SESSION['username'];
|
||||
header("refresh:1;");
|
||||
} else {
|
||||
echo "Einloggen fehlgeschlagen";
|
||||
|
@ -8,7 +8,7 @@
|
||||
</div>
|
||||
<hr />
|
||||
<!--Register-->
|
||||
<form id="create-form" action="index.php" method="post">
|
||||
<form id="create-form" action="index.php?page=login" method="post">
|
||||
|
||||
<div class="input-group input-group-sm mb-3">
|
||||
<div class="input-group-prepend">
|
||||
|
Loading…
Reference in New Issue
Block a user