Skip to content
Snippets Groups Projects
Commit 0deeeff3 authored by Raghav's avatar Raghav
Browse files

Added new page if Credential true with POST: Success

parent c82d6af3
No related branches found
No related tags found
No related merge requests found
<form action="/photogram-project-php/test.php" method="post"> <?
// Getting the values from the form and storing them in variables.
$username = $_POST['email'];
$password = $_POST['password'];
$validate = validate_credentials($username, $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"> <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> <h1 class="h3 mb-3 fw-normal">Please sign in</h1>
...@@ -20,3 +38,6 @@ ...@@ -20,3 +38,6 @@
<button class="hvr-grow-shadow btn btn-primary w-100 py-2 " type="submit">Sign in</button> <button class="hvr-grow-shadow btn btn-primary w-100 py-2 " type="submit">Sign in</button>
</form> </form>
</main>
<?}?>
html 0 → 120000
/home/raghav_gr/htdocs/var/www/html
\ No newline at end of file
...@@ -3,4 +3,12 @@ ...@@ -3,4 +3,12 @@
include $_SERVER['DOCUMENT_ROOT']. "/photogram-project-php/_templates/$name.php"; include $_SERVER['DOCUMENT_ROOT']. "/photogram-project-php/_templates/$name.php";
} }
function validate_credentials($username, $password){
if($username == "raghav@gmail.com" and $password == "raghav"){
return true;
}else{
return false;
}
}
?> ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment