Advertisement
Guest User

PHP

a guest
Nov 8th, 2016
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2. mysql_connect("localhost", "root", "");
  3. mysql_select_db("blog1");
  4. ?>
  5. <html>
  6. <head>
  7.     <title>Login</title>
  8. </head>
  9. <body>
  10.     <?php
  11.         if(isset($_POST['submit'])) {
  12.             $name = $_POST['name'];
  13.             $pass = $_POST['password'];
  14.  
  15.             $result = mysql_query("SELECT * FROM users WHERE name='$name' AND '$pass'");
  16.             $num = mysql_num_rows($result);
  17.             echo $num;
  18.         } else {
  19.     ?>
  20.     <form action='login.php' method='post'>
  21.     Username: <input type='text' name='name' /><br />
  22.     Password: <input type='password' name='password' /><br />
  23.     <input type='submit' name='submit' value='Login' />
  24.     </form>
  25.     <?php
  26.     }
  27.     ?>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement