Ekspresi | Belajar HTML dan PHP | Sunda | Kontak | Gmail | Uang Adsense
Kuliah Sistem Informasi,
PMB Online STMIK Jabar 2020
STMIK JABAR
LP3I Tasikmalaya
STAI Al-Falah
Belajar Pemrograman PHP, MySQL, Framework CI, Domain, Hosting dan CMS Wordpress
Inkubator | Daftar Isi | Bisnis Bitcoin | Tools Penting | PrivacyPolicy | Inggris Arab

Thursday, June 4, 2020

Login

config.php
<?php
//koneksi ke database mysql, silahkan di rubah dengan koneksi agan sendiri
$koneksi = mysqli_connect("localhost","root","","komtas");

//cek jika koneksi ke mysql gagal, maka akan tampil pesan berikut
if (mysqli_connect_errno()){
echo "Gagal melakukan koneksi ke MySQL: " . mysqli_connect_error();
}
?>


**
lg_index.php
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
</head>
<body>
<h2>Login Admin</h2>
<!-- 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";
}
}
?>
<form method="post" action="lg_cek_login.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>

**

lg_cek_login.php
<?php 
// mengaktifkan session php
session_start();

// menghubungkan dengan koneksi
include 'config.php';

// menangkap data yang dikirim dari form
$username = $_POST['username'];
$password = md5($_POST['password']);

// menyeleksi data admin dengan username dan password yang sesuai
$data = mysqli_query($koneksi,"select * from loginku where username='$username' and password='$password'");

// menghitung jumlah data yang ditemukan
$cek = mysqli_num_rows($data);

if($cek > 0){
$_SESSION['username'] = $username;
$_SESSION['status'] = "login";
header("location:hai.php");
}else{
header("location:lg_index.php?pesan=gagal");
}
?>

**

Buatlah satu file lagi, namanya hai.php

Cari

Name File: cari.php
Ketik script di bawah ini:

<html>
<body>
<?php
//koneksi ke database mysql, silahkan di rubah dengan koneksi agan sendiri
$koneksi = mysqli_connect("localhost","root","","stmikj2");

//cek jika koneksi ke mysql gagal, maka akan tampil pesan berikut
if (mysqli_connect_errno()){
 echo "Gagal melakukan koneksi ke MySQL: " . mysqli_connect_error();
}
?>

<form action="" method="get">
 <label>Cari :</label>
 <input type="text" name="cari">
 <input type="submit" value="Cari">
</form>

<?php
if(isset($_GET['cari'])){
 $cari = $_GET['cari'];
 echo "<b>KDMK: ".$cari."</b>";
}
?>

<table border="1">
 <tr>
  <th>KDMK</th>
  <th>MK</th>
 </tr>

 <?php
 if(isset($_GET['cari'])){
  $cari = $_GET['cari'];

  $data = mysqli_query($koneksi,"select * from mk where kdmk like '%$cari'");
 }
 else{
  $data = mysqli_query($koneksi,'select * from mk');
 }
 //$no = 1;
 while($d = mysqli_fetch_array($data)){
 ?>
 <tr>
  <td><?php echo $d['kdmk'];?></td>
  <td><?php echo $d['mk'];?></td>
 </tr>
 <?php } ?>
</table>

</body>
</html>

Monday, May 11, 2020

Halaman Depan HTML

<!DOCTYPE html>
<html>
<head>
<title>Katabah</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body background-color: white>
<style type="text/css">
html,body{
padding: 0;
margin:0;
font-family: sans-serif;
}

.menu-malasngoding{
background-color: green;
}

.menu-malasngoding ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}

.menu-malasngoding > ul > li {
float: left;
}


.menu-malasngoding li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}

.menu-malasngoding li a:hover{
background-color: #2525ff;
}

li.dropdown {
display: inline-block;
}

.dropdown:hover .isi-dropdown {
display: block;
}

.isi-dropdown a:hover {
color: #fff !important;
}

.isi-dropdown {
position: absolute;
display: none;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
background-color: #f9f9f9;
}

.isi-dropdown a {
color: #3c3c3c !important;
}

.isi-dropdown a:hover {
color: #232323 !important;
background: #f3f3f3 !important;
}
</style>


<div class="wrap">
<div class="header">

<b>Penerimaan Mahasiswa Baru TA 2019-2020 Online</b>
</div>


<div class="menu-malasngoding">

<ul>
    <li class="dropdown"><a href="#">Menu Dropdown</a>
    <ul class="isi-dropdown">
<li><a href="#">Sub Menu 1</a></li>
<li><a href="#">Sub Menu 2</a></li>

</ul>
</li>

<li><a href="#">Home</a></li>
<li><a href="" target="_blank">Cara Pendaftaran</a>
</li>

<li><a href="" target="_blank">Daftar</a>
</li>

</ul>

</div>


<div class="badan">
<div class="sidebar">
<table border=1>
<tr><td>
<a href="" target=_blank>Login Mahasiswa</a><br>
Sebelum Login, <br>Anda harus mengisi data dulu di menu Daftar!
<br><br>
<a href="" target=_blank>Khusus Admin</a><br>
<br><br>

Hubungi kami melalui WhatsApp (WA): <br>
Aa: <br> 08...<br><br>
Teteh: <br>08...<br><br>


<br><br>
<br>
<br><br>
<br><br>
<br><br>
<br><br>
<br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br>


<br>
</tr></td>
</table>
</div>
<div class="content">
    <table border=1 width=100%>
        <tr><td>
           
            <br>
           <marquee align="center" behavior="alternate" onmouseover="this.stop()" onmouseout="this.start()">
           <b>Mahasiswa yang telah dinyatakan lulus Gelombang 1, 2, dan 3,<br> harap segera melakukan <a href=""</a>REGISTRASI</b> </marquee>
<br><br>
<a href="" target=_blank><b>Download Brosur 1</b><br></a>
<a href="" target=_blank><b>Download Brosur 2</b><br></a>
<br>

<b>Biaya Pendaftaran:</b><br>
Gelombang 1: Rp. 200<br>

<br>

<br>
<img src="" border=0 width=100% height=425 align="left"><br>
<img src="" border=0 width=100% height=425 align="left">

</td></tr>
</table>
</div>
</div>
<div class="clear"></div>
<div class="footer">

</div>
</div>

<div align="center">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
Copyright © 2020 Katabah.com All rights reserved.<br>
</div>
</body>
</html>