Advertisement
Guest User

Untitled

a guest
May 15th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if (isset($_SESSION['user'])){
  5. header("Location: home.php");
  6. }
  7. if (isset($_POST['login'])){
  8. $user = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11. if ($user == "samad" && $password == "root"){
  12. $_SESSION['user'] = $user;
  13. echo '<script type="text/javascript"> window.open("home.php","_self");</script>';
  14. } else {
  15. echo "failed to login";
  16. }
  17. }
  18. ?>
  19.  
  20. <!DOCTYPE html>
  21. <html lang="en">
  22. <head>
  23. <meta charset="UTF-8">
  24. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  25. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  26. <title>Document</title>
  27. </head>
  28. <body>
  29. <style>
  30. .form{
  31. width: 600px;
  32. }
  33.  
  34.  
  35. input[type=submit] {
  36. width: 100%;
  37. background-color: #4CAF50;
  38. color: white;
  39. padding: 14px 20px;
  40. margin: 8px 0;
  41. border: none;
  42. border-radius: 4px;
  43. cursor: pointer;
  44. }
  45.  
  46. input[type=submit]:hover {
  47. background-color: #45a049;
  48. }
  49.  
  50. div {
  51. border-radius: 5px;
  52. background-color: #f2f2f2;
  53. padding: 20px;
  54. }
  55. </style>
  56.  
  57.  
  58. <div class="form">
  59. <h1>Vänligen logga in</h1>
  60. <form action="home.php">
  61. <label for="fname">Your Name</label>
  62. <input type="text" id="fname" name="firstname" placeholder="Your name..">
  63.  
  64. <label for="lname">Your Password</label>
  65. <input type="password" id="lname" name="lastname" placeholder="Your password..">
  66.  
  67. <input type="submit" value="Submit">
  68. </form>
  69. </div>
  70.  
  71.  
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement