Advertisement
Guest User

loginform

a guest
Jul 26th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <?php
  2. session_start()
  3. ?>
  4.  
  5. <html>
  6. <head>
  7. <title>
  8. Login Form
  9. </title>
  10.  
  11. <style>
  12. body {
  13. background-color: #c0c0c0;
  14. padding-top: 50px;
  15. padding-bottom: 50px;
  16. position: relative;
  17. }
  18.  
  19. .container{
  20.  
  21. border-radius: 5px;
  22. padding: 20px;
  23. text-align: center;
  24. }
  25. input[type=text] {
  26. box-shadow: 2px 2px #838789;
  27. opacity: 0.8;
  28. border-radius: 5px;
  29. width: 250px;
  30. height: 40px;
  31. border: 3px darkgrey;
  32. margin:auto;
  33. margin-bottom: 5px;
  34. display: inline-block;
  35. padding: 12px 20px;
  36.  
  37. }
  38.  
  39. input[type=password] {
  40. box-shadow: 2px 2px #838789;
  41. opacity: 0.8;
  42. border-radius: 5px;
  43. width: 250px;
  44. height: 40px;
  45. border: 3px darkgrey;
  46. margin:auto;
  47. margin-bottom: 20px;
  48. display: inline;
  49. padding: 12px 20px;
  50.  
  51.  
  52. }
  53.  
  54. input[type=submit]:hover{
  55.  
  56.  
  57.  
  58. }
  59.  
  60. p{
  61. font-style: italic;
  62. font-family: Verdana;
  63. text-align: center;
  64. }
  65.  
  66. form{
  67. margin: 0 auto;
  68. width:250px;
  69.  
  70. }
  71. </style>
  72.  
  73.  
  74. </head>
  75.  
  76. <body>
  77. <div>
  78. <?php
  79.  
  80. $login = $_POST['login'];
  81. $username=$_POST['username'];
  82. $password=$_POST['password'];
  83. if(isset($login) && !empty($username) &&
  84. !empty($password))
  85. {
  86.  
  87. if($username=='elena' && $password=='1234')
  88. { $_SESSION['valid']=true;
  89. echo 'You have entered a valid username and password';
  90. }
  91. else {
  92. echo 'Wrong username or password';
  93. }
  94. }
  95.  
  96. ?>
  97.  
  98. </div>
  99.  
  100. <div class="container">
  101. <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>"
  102. method="post"; accept-charset="UTF-8">
  103. <p> Username:</p>
  104. <input type="text" align="center" name="username" maxlength="50" autofocus> <br/>
  105. <p>Password: </p>
  106. <input type="password" name="password" maxlength="50"><br/>
  107. <input type="submit" name="login" value="Submit" formtarget="_blank">
  108. </form>
  109.  
  110. </div>
  111. </body>
  112. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement