Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php
  2. if (!isset($_SESSION)){
  3. session_start();
  4. }
  5.  
  6. include_once "functions.php";
  7. /*
  8. call function to check if username and password is valid($_POST["username"], $_POST["password"])
  9. if yes - $_SESSION = function to get user data and go to dashboard
  10. if no - message for wrong password or username
  11. */
  12. if (isset($_POST, $_POST["username"], $_POST["password"])) {
  13. if( isUserValid($_POST["username"], $_POST["password"])){
  14. $_SESSION = getUser($_POST["username"]);
  15. header("Location: dashboard.php");
  16. }
  17. else {
  18. echo "Wrong username or password";
  19. }
  20. }
  21. ?>
  22.  
  23.  
  24. <!doctype html>
  25. <html lang="en">
  26. <head>
  27. <meta charset="UTF-8">
  28. <meta name="viewport"
  29. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  30. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  31. <title>login</title>
  32. <link rel="stylesheet" href="login.css">
  33. </head>
  34. <body>
  35. <header>Welcome to MySvalka</header>
  36. <!--
  37. form with :
  38. field for username
  39. field for password
  40. login button
  41.  
  42. link to register page
  43. -->
  44. <main>
  45. <div id="form">
  46. <form method="post" action="login.php" ">
  47.  
  48. <label for="username">Username: </label>
  49. <input type="text" name="username" required><br>
  50.  
  51. <label for="password">Password:&nbsp;</label>
  52. <input type="text" name="password" required><br>
  53.  
  54. <input type="submit" name="login" value="Log in" id="submit">
  55. </form>
  56. </div>
  57. <div id="link"><a href="register.php">Register now</a></div>
  58. </main>
  59.  
  60. <footer>Enjoy</footer>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement