Advertisement
Guest User

Untitled

a guest
May 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2. mysql_connect ('localhost', 'robin_1', 'banaan');
  3. mysql_select_db ('robin_test');
  4. ?>
  5. <html>
  6.  
  7. <head><link rel="stylesheet" type="text/css" href="style.css" /></head>
  8.  
  9. <body>
  10.  
  11. <div id="container">
  12.  
  13. <?php
  14.     if ( isset($_POST["submit"]) ) {
  15.  
  16.         if( empty($_POST['username']) or empty($_POST['password']) ) {
  17.            
  18.             echo 'Oeps, iets vergeten invullen';
  19.            
  20.         } else {
  21.        
  22.             mysql_query("SELECT * FROM user WHERE username = '" . $_POST['username'] . "' AND password = '" . $_POST['password'] . "'");
  23.  
  24.             $_SESSION['login'] = 1;
  25.             $_SESSION['username'] = $_POST['username'];
  26.          
  27.             echo "Login succesful. <br />";
  28.             echo "U bent" . $_SESSION['username'] . ", ja toch?";
  29.         }
  30.  
  31.      }
  32. ?>
  33.    
  34.     <form method="post">
  35.     Username: <input type="text" name="username" /><br />
  36.     Password: <input type="password" name="password" /><br />
  37.     <input type="submit" name="submit" value="Log in" />
  38.     </form>
  39.    
  40. </div>
  41.  
  42. </body>
  43.  
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement