Advertisement
Guest User

Untitled

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