Advertisement
Guest User

Untitled

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