Advertisement
Guest User

Untitled

a guest
Feb 27th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. <?php
  2.  
  3. $msg = '';
  4. include 'include/connection.inc.php';
  5. if(isset($_POST['login'])) {
  6.    
  7.     $username = $_POST['username'];
  8.     $password = $_POST['password'];
  9.    
  10.     header("Location:dashboard.php");
  11.     if(!$password || !$username) {
  12.         $msg = "Username or password incorrect!";
  13.         echo '<p class = "error">'.$msg.'</p>';
  14.  
  15.  
  16.         }
  17.  
  18.  
  19.  
  20.     }
  21. ?>
  22.  
  23.  
  24. <!DOCTYPE html>
  25. <html lang="en">
  26. <head>
  27.     <meta charset="UTF-8">
  28.     <link type="text/css" rel="stylesheet" href="css/style.css" >
  29.     <title>PHP&amp;MySQL: Login | Zadaca 3</title>
  30. </head>
  31. <body>
  32.     <div class="login-form">
  33.         <div class="login-header">
  34.             <h2 align="center">Login</h2>
  35.         </div>
  36.         <p class="error"<?php echo $msg; ?>></p>
  37.         <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="POST">
  38.             <div class="form-group">
  39.                 <label class="loginlabel">Username</label><input type="text" name="username" />
  40.             </div>
  41.             <div class="form-group">
  42.                 <label class="loginlabel">Password</label><input type="password" name="password" />
  43.             </div>
  44.             <div class="form-group>">
  45.                 <input type="submit" name="login" class="login-button" value="Login">
  46.             </div>
  47.         </form>
  48.     </div>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement