2018-06-17 21:36:38 +02:00
|
|
|
<?php
|
|
|
|
//<!--Login-->
|
|
|
|
if( (isset($_POST['loginName'])) && isset($_POST['loginPassword'])){
|
|
|
|
|
|
|
|
$name = ($_POST['loginName']);
|
|
|
|
$pswd = ($_POST['loginPassword']);
|
|
|
|
$pswd = md5($pswd);
|
|
|
|
|
2018-06-17 23:24:47 +02:00
|
|
|
$stmt = $database->prepare("SELECT id, username FROM user WHERE '$name'=username AND password='$pswd'");
|
2018-06-17 21:36:38 +02:00
|
|
|
$stmt->execute();
|
|
|
|
$result = $stmt->get_result();
|
|
|
|
|
|
|
|
if ($result->num_rows == 1) {
|
|
|
|
$object = $result->fetch_object();
|
|
|
|
$_SESSION['user'] = $object->id;
|
2018-06-17 23:24:47 +02:00
|
|
|
$_SESSION['username'] = $object->username;
|
|
|
|
echo "Einloggen erfolgreich <br> Willkommen " . $_SESSION['username'];
|
2018-06-18 21:19:04 +02:00
|
|
|
//header("refresh:1;");
|
|
|
|
header('Location: index.php?page=myFriendsBook');
|
2018-06-17 21:36:38 +02:00
|
|
|
} else {
|
|
|
|
echo "Einloggen fehlgeschlagen";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
2018-06-17 20:12:19 +02:00
|
|
|
<p></p>
|
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
2018-06-17 21:36:38 +02:00
|
|
|
<div class="alert alert-dark" role="alert">
|
|
|
|
<h4> Login into your FriendsBook Account!</h4>
|
|
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
<!--Login-->
|
|
|
|
<form id="login-form" action="index.php?page=login" method="post">
|
|
|
|
<div class="input-group input-group-sm mb-3">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text" id="inputGroup-sizing-sm">Username</span>
|
|
|
|
</div>
|
2018-06-18 14:44:49 +02:00
|
|
|
<input type="text" class="form-control" name="loginName" aria-label="Small" aria-describedby="inputGroup-sizing-sm" required>
|
2018-06-17 21:36:38 +02:00
|
|
|
</div>
|
|
|
|
<div class="input-group input-group-sm mb-3">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text" id="inputGroup-sizing-sm">Password</span>
|
|
|
|
</div>
|
2018-06-18 14:44:49 +02:00
|
|
|
<input type="password" class="form-control" name="loginPassword" aria-label="Small" aria-describedby="inputGroup-sizing-sm" required>
|
2018-06-17 21:36:38 +02:00
|
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
<button id="btnLogin" type="submit" style="float: right;" class="btn btn-primary">Login</button>
|
|
|
|
<div id="login-status"></div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2018-06-17 20:12:19 +02:00
|
|
|
</div>
|
|
|
|
</div> <!-- Ende container login -->
|