Contoh Script Login PHP




========================
CONTOH SCRIPT LOGIN PHP
========================


<html>
<head>
<title>Hanthuuuuu</title>
</head>
<body>
<br/>
<!-- cek pesan notifikasi -->
<?php 
if(isset($_GET['pesan'])){
if($_GET['pesan'] == "gagal"){
echo "Login gagal! username dan password salah!";
}else if($_GET['pesan'] == "logout"){
echo "Anda telah berhasil logout";
}else if($_GET['pesan'] == "belum_login"){
echo "Anda harus login untuk mengakses halaman admin";
}
}
?>
<br/>
<br/>
<center>
<form method="post" action="loginproses.php">
<table>
<tr>
<td>Username</td>
<td>:</td>
<td><input type="text" name="username" placeholder="Masukkan username"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input type="password" name="password" placeholder="Masukkan password"></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" value="LOGIN"></td>
</tr>
</table>
</form>
</body>
</html>
          </div>
        </div>
      </div>
    </div>
    </center>
  </header>




====================================================================================================================================================================================================


=============
LOGIN PROSES
=============




<?php 

session_start();
 

include 'koneksi.php';
 

$username = $_POST['username'];
$password = $_POST['password'];
 

$data = mysqli_query($koneksi,"select * from admin where username='$username' and password='$password'");
 

$cek = mysqli_num_rows($data);
 
if($cek > 0){
$_SESSION['username'] = $username;
$_SESSION['status'] = "login";
header("location:home.html");
}else{
header("location:index.html");
}
?>
 

Comments

Popular posts from this blog

Contoh Script Search Dalam PHP

How to Download Touch Prodigy Not 3 Claw / Cara Download Touch Prodigy Bukan 3 Claw

Sudocreme Antiseptic Healing Cream