Skip to content
Snippets Groups Projects
login-content.php 1.64 KiB
<?php
// Getting the values from the form and storing them in variables.
$email = $_POST['email'];
$password = $_POST['password'];
$validate = validate_credentials($email, $password);

if ($validate) {?>
<!-- If it is true is display true page -->
<main class="container">
	<div class="bg-body-tertiary p-5 rounded">
		<h1>Login Success</h1>
		<p class="lead">This example is a quick exercise to illustrate How to login with simple POST method</p>
		<a class="btn btn-lg btn-primary" href="/docs/5.3/components/navbar/" role="button">View navbar docs »</a>
	</div>
</main>
<?} else {?>

<!-- If it is false it displays the login form -->
<main class="form-signin w-100 m-auto">
	<form action="/photogram-project-php/login.php" method="post">
		<img class="mb-4 center" src="/photogram-project-php/assets/brand/devyani_logo_edit_light copy.svg" alt=""
			width="72" height="77">
		<h1 class="h3 mb-3 fw-normal">Please sign in</h1>

		<div class="form-floating">
			<input name="email" type="email" class="form-control" id="floatingInput" placeholder="name@example.com">
			<label for="floatingInput">Email address</label>
		</div>
		<div class="form-floating">
			<input name="password" type="password" class="form-control" id="floatingPassword" placeholder="Password">
			<label for="floatingPassword">Password</label>
		</div>

		<div class="form-check text-start my-3">
			<input class="form-check-input" type="checkbox" value="remember-me" id="flexCheckDefault">
			<label class="form-check-label" for="flexCheckDefault">
				Remember me
			</label>
		</div>
		<button class="hvr-grow-shadow btn btn-primary w-100 py-2 " type="submit">Sign in</button>

	</form>
</main>
<?}?>