Advertisement
Guest User

Untitled

a guest
May 20th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 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.     <form method="post">
  14.     Username: <input type="text" name="username" /><br />
  15.     Password: <input type="password" name="password" /><br />
  16.     <input type="submit" name="submit" value="Log in" />
  17.     </form>
  18.    
  19.     <?php
  20.         if ( isset($_POST["submit"]) ) {
  21.    
  22.             if( empty($_POST['username']) or empty($_POST['password']) ) {
  23.                
  24.                 echo 'Oeps, iets vergeten invullen';
  25.                
  26.             } else {
  27.            
  28.                     mysql_query("SELECT * FROM user WHERE username = '" . $_POST['username'] . "' AND password = '" . $_POST['password'] . "'");
  29.  
  30.                 $_SESSION['username'] = $_POST['username'];
  31.              
  32.                         echo "Login succesful. <br />";
  33.                 echo "U bent" . $_SESSION['username'] . ", ja toch?";
  34.                 }
  35.  
  36.          }
  37.     ?>
  38.    
  39. </div>
  40.  
  41. </body>
  42.  
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement