1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| < html > < head > < title >Form Login</ title > </ head > < body > < center > < form action = "ceklogin.php" method = "post" > < table > < tr >< td colspan = "2" align = "center" >< h1 >Form Login </ h1 ></ td ></ tr > < 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 colspan = "2" align = "right" >< input type = "submit" value = "Login" > < input type = "reset" value = "Batal" ></ td ></ tr > </ table > </ form > </ center > </ body > </ html > |
1
2
3
4
| <?php mysql_connect( "localhost" , "root" , "" ) or die ( "Koneksi Gagal" ); mysql_select_db( "latihanweb" ) or die ( "Database Tidak Ditemukan" ); ?> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| <?php include "koneksi.php" ; $username = $_POST [ 'username' ]; $password = $_POST [ 'password' ]; $user = mysql_query( "SELECT * FROM login WHERE username='$username' AND password='$password'" ); $match = mysql_num_rows( $user ); if ( $match ==1){ echo "<h1>Login Berhasil</h1>" ; } else { echo "<h1>Login Gagal</h1>" ; } ?> |