Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_SESSION)){
- session_start();
- }
- include_once "functions.php";
- /*
- call function to check if username and password is valid($_POST["username"], $_POST["password"])
- if yes - $_SESSION = function to get user data and go to dashboard
- if no - message for wrong password or username
- */
- if (isset($_POST, $_POST["username"], $_POST["password"])) {
- if( isUserValid($_POST["username"], $_POST["password"])){
- $_SESSION = getUser($_POST["username"]);
- header("Location: dashboard.php");
- }
- else {
- echo "Wrong username or password";
- }
- }
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>login</title>
- <link rel="stylesheet" href="login.css">
- </head>
- <body>
- <header>Welcome to MySvalka</header>
- <!--
- form with :
- field for username
- field for password
- login button
- link to register page
- -->
- <main>
- <div id="form">
- <form method="post" action="login.php" ">
- <label for="username">Username: </label>
- <input type="text" name="username" required><br>
- <label for="password">Password: </label>
- <input type="text" name="password" required><br>
- <input type="submit" name="login" value="Log in" id="submit">
- </form>
- </div>
- <div id="link"><a href="register.php">Register now</a></div>
- </main>
- <footer>Enjoy</footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement