Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE IF NOT EXISTS `admin` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `username` varchar(255) NOT NULL,
- `password` varchar(255) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
- INSERT INTO `admin` (`id`, `username`, `password`) VALUES
- (1, 'bayuelsya', 'bayuelsya');
- //index.php
- <!DOCTYPE html>
- <html>
- <head>
- <title>LOGIN BAYU RAKASIWI ELSYA NO.46</title>
- </head>
- <body>
- <h1>LOGIN BAYU</h1>
- <h3>Halaman Login Sederhana</h3>
- <form action="login.php" method="post">
- <table>
- <tr>
- <td>Username</td>
- <td><input type="text" name="username"></td>
- </tr>
- <tr>
- <td>Password</td>
- <td><input type="password" name="password"></td>
- </tr>
- <tr>
- <td></td>
- <td><input type="submit" name="login" value="Log In"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- //Koneksi.php
- <?php
- mysql_connect("localhost","root","");
- mysql_select_db("admin");
- ?>
- //Login.php
- <?php
- include 'koneksi.php';
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = mysql_query("select * from admin where username='$username' and password='$password'");
- $cek = mysql_num_rows($query);
- echo $cek;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement