Advertisement
Guest User

Untitled

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