diff --git a/_templates/login-content.php b/_templates/login-content.php index 34c8c43edef1c541753a55307c506d65851c260c..408b99c30e054f5ae4ec580b709b6c55e208725b 100644 --- a/_templates/login-content.php +++ b/_templates/login-content.php @@ -1,4 +1,22 @@ -<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"> <h1 class="h3 mb-3 fw-normal">Please sign in</h1> @@ -20,3 +38,6 @@ <button class="hvr-grow-shadow btn btn-primary w-100 py-2 " type="submit">Sign in</button> </form> +</main> +<?}?> + diff --git a/html b/html new file mode 120000 index 0000000000000000000000000000000000000000..33abc79ce1b502fd74d674706e5c9139656eb9ba --- /dev/null +++ b/html @@ -0,0 +1 @@ +/home/raghav_gr/htdocs/var/www/html \ No newline at end of file diff --git a/libs/load.php b/libs/load.php index 103993af51529966acc47450ac439a17765aa736..2dc45d2ffd85c7fea8404b60f5a463a7f16c9315 100644 --- a/libs/load.php +++ b/libs/load.php @@ -3,4 +3,12 @@ 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