Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. CREATE TABLE IF NOT EXISTS `admin` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `username` varchar(255) NOT NULL,
  4. `password` varchar(255) NOT NULL,
  5. PRIMARY KEY (`id`)
  6. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  7.  
  8.  
  9. INSERT INTO `admin` (`id`, `username`, `password`) VALUES
  10. (1, 'bayuelsya', 'bayuelsya');
  11.  
  12. //index.php
  13.  
  14.  
  15.  
  16. <!DOCTYPE html>
  17. <html>
  18. <head>
  19. <title>LOGIN BAYU RAKASIWI ELSYA NO.46</title>
  20. </head>
  21. <body>
  22. <h1>LOGIN BAYU</h1>
  23. <h3>Halaman Login Sederhana</h3>
  24. <form action="login.php" method="post">
  25. <table>
  26. <tr>
  27. <td>Username</td>
  28. <td><input type="text" name="username"></td>
  29. </tr>
  30. <tr>
  31. <td>Password</td>
  32. <td><input type="password" name="password"></td>
  33. </tr>
  34. <tr>
  35. <td></td>
  36. <td><input type="submit" name="login" value="Log In"></td>
  37. </tr>
  38. </table>
  39. </form>
  40. </body>
  41. </html>
  42.  
  43. //Koneksi.php
  44. <?php
  45. mysql_connect("localhost","root","");
  46. mysql_select_db("admin");
  47. ?>
  48.  
  49. //Login.php
  50. <?php
  51. include 'koneksi.php';
  52.  
  53. $username = $_POST['username'];
  54. $password = $_POST['password'];
  55.  
  56. $query = mysql_query("select * from admin where username='$username' and password='$password'");
  57. $cek = mysql_num_rows($query);
  58. echo $cek;
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement