1. File : index.php <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/data_siswa/gbr/12.jpg"> <title>zambigo@k.bja</title>
<link href="http://localhost/data_siswa/pelengkap/all.css"1 rel="stylesheet" type="text/css"/> </head>
<body> <div
id="header"> &nbs p;&nb sp;
<a href="http://localhost/data_siswa/index.php"><input type="submit" class="submit" name="Daftar" value="Home"></a>
<a href="http://localhost/data_siswa/entri/ent_mah_com.php"><input type="submit" class="submit" name="Daftar" value="Entri Data"></a>
<a href="http://localhost/data_siswa/login/login.html"><input type="submit" class="submit" name="Daftar" value="Edit Data"></a>
<a href="http://localhost/data_siswa/lihat/search.php"><input type="submit" class="submit" name="Daftar" value="Pencarian Data"></a>
<a href="http://localhost/data_siswa/lihat/data_rows.php"><input type="submit" class="submit" name="Daftar" value="Lihat Data Mahasiswa "></a>
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div>
<div id="nav_left">
<img src="http://localhost/data_siswa/gbr/logos.jpg" width="150" height="55" border="0" alt=""> </div>
<div id="nav_left_link"> <div id="stylelink"> <?php
print date('j F Y'); ?>
<br>
<span class="menu_caption">Main Menu </span><br/> <ul>
<li><a href="http://localhost/data_siswa/index.php">Home</a></li>
<li><a href="http://localhost/data_siswa/entri/ent_mah_com.php">Entri Data</a></li> <li><a href="http://localhost/data_siswa/login/login.html">Edit Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/data_rows.php">Lihat Data Mahasiswa</a></li> </ul>
<img src="http://localhost/data_siswa/gbr/hi.gif" width="150" height="60" border="0" > </ul>
</div> </div>
<div id="box_isi"><div align="center"> <?php
$file = fopen("counter.txt","r");
$hitung = fread($file,filesize("counter.txt")); $hitung++;
echo "Anda pengunjung ke : <br>"; echo "<b><blink>"; echo substr("000000",0,6-strlen($hitung)).$hitung; echo "</b></blink>"; fclose($file); $file=fopen("counter.txt","w"); fwrite($file,$hitung); fclose($file); ?><br><br>
<table align=center border="0">
<tr valign='bottom'><td><img src="gbr/pai.jpg" width="50" height="45" border="0" ></td> <td><img src="gbr/pat.jpg" width="380" height="45" border="0" ></td>
<td><img src="gbr/paa.jpg" width="50" height="45" border="0" ></td></tr> <tr><td><img src="gbr/pti.jpg" width="50" height="210" border="0" ></td>
<td><img src='gbr/sma.JPG' align='center' width='380' height='210' border='0'></td> <td><img src="gbr/pta.jpg" width="50" height="210" border="0" ></td></tr>
<tr valign='top'><td><img src="gbr/pbi.jpg" width="50" height="45" border="0" ></td> <td><img src="gbr/pat.jpg" width="380" height="45" border="0" ></td>
<td><img src="gbr/pba.jpg" width="50" height="45" border="0" ></td></tr> </table></div></div></div> </body> </html> 2. File : edit/dat_sis.php <?php include "../login/main.php";
echo ("<link href='http://localhost/data_siswa/pelengkap/all.css'1 rel='stylesheet' type='text/css'/>");
echo ("<table border=1 width=1010 align=center>");
echo ("<tr align=center bgcolor='#cccccc'><td colspan=9>Daftar Nama Mahasiswa</td></tr>"); echo ("<tr align=center bgcolor='#ccccdd'>
<td width='8%'>NIM</td> <td width='16%'>Nama</td>
<td width='22%'>Alamat</td> <td width='15%'>Prop_Asal</td> <td width='33%'>SMU Asal</td> <td width='10%'>Jurusan</td> <td width='26%' colspan=3>Angkatan</td> </tr>"); mysql_connect("localhost","root",""); mysql_select_db("comp");
$perintah="SELECT * FROM siswa ORDER BY nim"; $tamp_data=mysql_query($perintah); while($data=mysql_fetch_row($tamp_data)) { echo ("<tr align=center> <td>$data[0]</td> <td>$data[1]</td> <td>$data[2]</td> <td>$data[3]</td> <td>$data[4]</td> <td>$data[5]</td> <td>$data[6]</td>");
echo ("<td width='5%'><a href=\"form_edit.php?id=$data[0]\">
<img src='http://localhost/data_siswa/gbr/spid.jpg' height=20 width=25 title='edit'></a></td>
<td width='5%'><a href=\"hapus_ang.php?id=$data[0]\">
<img src='http://localhost/data_siswa/gbr/hap.jpg' height=20 width=25 title='hapus'></a></td></tr>"); } echo ("</table>"); ?> 3. File : edit/edit.php <?php mysql_connect("localhost","root",""); mysql_select_db("comp");
$ubah="UPDATE siswa SET nim='$nim', nama='$nama', alamat='$alamat', prop_asal='$prop_asal', smu_asal='smu_asal',
jurusan='$jurusan', angkatan='$angkatan' WHERE nim='$id'"; mysql_query($ubah); header("location:dat_sis.php"); ?> 4. File : edit/form_edit.php <?php mysql_connect("localhost","root",""); mysql_select_db("comp");
$perintah="SELECT * FROM siswa WHERE nim='$id'"; $hasil=mysql_query($perintah); $baris=mysql_fetch_array($hasil); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/siswa/gbr/12.jpg"> <title>zambigo@k.bja</title>
<link href="http://localhost/data_siswa/pelengkap/all.css"1 rel="stylesheet" type="text/css"/> </head>
<body> <div
id="header"> &nbs p;
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div>
<div id="box_isi">
<div align="center"><b><h3>Edit Data Mahasiswa</h3></b></div> <form action="edit.php" method="post">
<input type="hidden" name="id" value='<?echo "$baris[nim]"?>'> <table align='center'>
<tr>
<td>NIM</td><td>: <input type="text" name="nim" value='<? echo"$baris[nim]"?>' size="20"></td>
</tr> <tr>
<td>Nama</td><td>: <input type="text" name="nama" value='<? echo"$baris[nama]"?>' size="20"></td>
</tr> <tr>
<td>Alamat</td><td>: <input type="text" name="alamat" value='<? echo"$baris[alamat]"?>' size="20"></td>
</tr> <tr>
<td>Prop_Asal</td><td>: <input type="text" name="prop_asal" value='<? echo"$baris[prop_asal]"?>' size="20"></td>
</tr> <tr>
<td>SMU Asal</td><td>: <input type="text" name="smu_asal" value='<? echo"$baris[smu_asal]"?>' size="20"></td>
</tr> <tr>
<td>Jurusan</td><td>: <input type="text" name="jurusan" value='<? echo"$baris[jurusan]"?>' size="20"></td>
</tr> <tr>
<td>Angkatan</td><td>: <input type="text" name="angkatan" value='<? echo"$baris[angkatan]"?>' size="20"></td>
</tr> <tr>
<td></td><td> <input type="submit" name="edit" value="Ubah"></td> </tr> </div></div> </body> </html> 5. File : edit/hapus.php <?php mysql_connect("localhost","root",""); mysql_select_db("comp");
$perintah="DELETE FROM siswa WHERE nim=$id"; $hapus=mysql_query($perintah); header("location:dat_sis.php"); ? 6. File : edit/hapus_ang.php <?php mysql_connect("localhost","root",""); mysql_select_db("comp");
$perintah="DELETE FROM siswa WHERE nim=$id"; $hapus=mysql_query($perintah); header("location:dat_sis.php"); ?> 7. File : entri/ent_mah_com.php <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/data_siswa/gbr/12.jpg">
<title>zambigo@k.bja</title>
<link href="http://localhost/data_siswa/pelengkap/all.css"1 rel="stylesheet" type="text/css"/> </head>
<body> <div
id="header"> &nbs p;
<a href="http://localhost/data_siswa/index.php"><input type="submit" class="submit" name="Daftar" value="Home"></a>
<a href="http://localhost/data_siswa/entri/ent_mah_com.php"><input type="submit" class="submit" name="Daftar" value="Entri Data"></a>
<a href="http://localhost/data_siswa/login/login.html"><input type="submit" class="submit" name="Daftar" value="Edit Data"></a>
<a href="http://localhost/data_siswa/lihat/search.php"><input type="submit" class="submit" name="Daftar" value="Pencarian Data"></a>
<a href="http://localhost/data_siswa/lihat/data_rows.php"><input type="submit" class="submit" name="Daftar" value="Lihat Data Mahasiswa "></a>
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div>
<div id="nav_left">
<img src="http://localhost/data_siswa/gbr/logos.jpg" width="150" height="55" border="0" alt=""> </div>
<div id="nav_left_link"> <div id="stylelink"> <?php
print date('j F Y'); ?><br>
<span class="menu_caption">Main Menu </span><br/> <ul>
<li><a href="http://localhost/data_siswa/index.php">Home</a></li>
<li><a href="http://localhost/data_siswa/entri/ent_mah_com.php">Entri Data</a></li> <li><a href="http://localhost/data_siswa/login/login.html">Edit Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/search.php">Pencarian Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/data_rows.php">Lihat Data Mahasiswa</a></li> </ul>
<img src="http://localhost/data_siswa/gbr/hi.gif" width="150" height="60" border="0" > </ul>
</div> </div>
<div id="box_isi">
<form action="ent_sim.php" method="post" target="_self" name="form1"> <table cellpadding="2" cellspacing="2" border="0" align="center" width="400">
<tr >
<td colspan="2" align="center"><b><h3>Entry Data Mahasiswa</h3></b></td> </tr>
<tr>
<td width="89">NIM</td>
<td width="311"><input type="text" name="nim" size="25" maxlength="35"></td> </tr>
<tr>
<td>Nama</td>
<td><input type="text" name="nama" size="25" maxlength="35"></td> </tr>
<tr>
<td>Alamat</td>
<td><input type="text" name="alamat" size="25" maxlength="35"></td> </tr>
<tr>
<td>Prop_Asal</td>
<td><input type="text" name="prop_asal" size="25" maxlength="35"></td> </tr>
<tr>
<td>SMU Asal</td>
<td><input type="text" name="smu_asal" size="25" maxlength="35"></td> </tr>
<tr>
<td>Jurusan</td>
<td><input type="text" name="jurusan" size="25" maxlength="35"></td> </tr>
<tr>
<td>Angkatan</td>
<td><input type="text" name="angkatan" size="25" maxlength="35"></td> </tr>
<tr>
<td></td>
<td><input type="submit" name="simpan" value="Simpan"></td> </tr> </table> </form> </body> </html> 8. file : entri/ent_sim.php <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/data_siswa/gbr/12.jpg"> <title>zambigo@k.bja</title>
</head> <body> <div
id="header"> &nbs p;
<a href="http://localhost/data_siswa/index.php"><input type="submit" class="submit" name="Daftar" value="Home"></a>
<a href="http://localhost/data_siswa/entri/ent_mah_com.php"><input type="submit" class="submit" name="Daftar" value="Entri Data"></a>
<a href="http://localhost/data_siswa/login/login.html"><input type="submit" class="submit" name="Daftar" value="Edit Data"></a>
<a href="http://localhost/data_siswa/lihat/search.php"><input type="submit" class="submit" name="Daftar" value="Pencarian Data"></a>
<a href="http://localhost/data_siswa/lihat/data_rows.php"><input type="submit" class="submit" name="Daftar" value="Lihat Data Mahasiswa "></a>
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div>
<div id="nav_left">
<img src="http://localhost/data_siswa/gbr/logos.jpg" width="150" height="55" border="0" alt=""> </div>
<div id="nav_left_link"> <div id="stylelink"> <?php
print date('j F Y'); ?><br>
<span class="menu_caption">Main Menu </span><br/> <ul>
<li><a href="http://localhost/data_siswa/index.php">Home</a></li>
<li><a href="http://localhost/data_siswa/entri/ent_mah_com.php">Entri Data</a></li> <li><a href="http://localhost/data_siswa/login/login.html">Edit Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/search.php">Pencarian Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/data_rows.php">Lihat Data Mahasiswa</a></li> </ul>
<img src="http://localhost/data_siswa/gbr/hi.gif" width="150" height="60" border="0" > </ul> </div> </div> <div id="box_isi"> <?php $koneksi=mysql_connect("localhost", "root", "") or die ("Gagal koneksi");
mysql_select_db(comp, $koneksi) or die ("Gagal pilih database");
$sql_input="INSERT INTO siswa (nim,nama,alamat,prop_asal,smu_asal,jurusan,angkatan) VALUES ('$nim','$nama','$alamat','$prop_asal','$smu_asal','$jurusan','$angkatan')"; mysql_query($sql_input, $koneksi)
or die ("Gagal koneksi".mysql_error());
echo "<b>Data yang berhasil dimasukan</b><br>"; echo "NIM : $nim<br>";
echo "Nama : $nama<br>"; echo "Alamat : $alamat<br>";
echo "Prop_Asal : $prop_asal<br>"; echo "SMU Asal : $smu_asal<br>"; echo "Jurusan : $jurusan<br>"; echo "Angkatan : $angkatan<br>"; ?> <a href="ent_mah_com.php">Kembali</a> </div></div> </body> </html> 9. file : lihat/data_rows.php <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/data_siswa/gbr/12.jpg"> <title>zambigo@k.bja</title>
<link href="http://localhost/data_siswa/pelengkap/all.css"1 rel="stylesheet" type="text/css"/> </head>
<body> <div
id="header"> &nbs p;
<a href="http://localhost/data_siswa/index.php"><input type="submit" class="submit" name="Daftar" value="Home"></a>
<a href="http://localhost/data_siswa/entri/ent_mah_com.php"><input type="submit" class="submit" name="Daftar" value="Entri Data"></a>
<a href="http://localhost/data_siswa/login/login.html"><input type="submit" class="submit" name="Daftar" value="Edit Data"></a>
<a href="http://localhost/data_siswa/lihat/search.php"><input type="submit" class="submit" name="Daftar" value="Pencarian Data"></a>
<a href="http://localhost/data_siswa/lihat/data_rows.php"><input type="submit" class="submit" name="Daftar" value="Lihat Data Mahasiswa "></a>
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div> <?php $namahost="localhost"; $namauser="root"; $password=""; $namadbs="comp";
$koneksi = mysql_connect($namahost, $namauser, $password) or die ("Gagal koneksi".mysql_error());
mysql_select_db($namadbs, $koneksi) or die ("Gagal pilih database".nysql_error()); //seleksi data
$hasil=mysql_query ("SELECT * FROM siswa ORDER BY nim") or die ("Gagal query".mysql_error());
//mengkondisikan data ada atau tidak ada if (mysql_num_rows($hasil) >0)
{
//apabila ada print date('j F Y');
echo "<table width=1000 cellpadding=0 border=1>"; echo "<tr>";
echo "<td colspan=7 align=center bgcolor='#cccccc'><b>Daftar Mahasiswa</b></td>"; echo "</tr>";
echo "<tr align=center bgcolor='#ccccaa'>"; echo "<td><b>NIM</b></td>"; echo "<td> <b>Nama</b></td>"; echo "<td><b>Alamat</b></td>"; echo "<td><b>Prop_Asal</b></td>"; echo "<td><b>SMU Asal</b></td>"; echo "<td><b>Jurusan</b></td>"; echo "<td><b>Angkatan</b></td>"; echo "</tr>";
//menampilkan isi data
while($baris = mysql_fetch_row($hasil)) {
//menampilkan data berdasarkan nomor baris kolomnya echo "<tr align=center>"; echo "<td> $baris[0] </td>"; echo "<td> $baris[1] </td>"; echo "<td> $baris[2] </td>"; echo "<td> $baris[3] </td>"; echo "<td> $baris[4] </td>";
echo "<td> $baris[5] </td>"; echo "<td> $baris[6] </td>"; echo "</tr>"; } echo "</table>"; } else {
echo "Pada tabel siswa data kosong"; //menutup koneksi
mysql_close($koneksi); exit();
}
//menutup koneksi untuk menampilkan data mysql_free_result($hasil); mysql_close($koneksi); ?> </body> </html> 10.file : lihat/koneksi.php <?php
// set beberapa variabel untuk mengakses basis data MySQL. // nama server basis data MySQL
$server = "localhost";
// nama pengguna basis data
$namauser = "root"; // misalkan user adalah 'test' // password pengguna basis data
$passuser = ""; // misalkan password adalah 'test' // nama basis data
$db = "comp";
// membuka koneksi PHP ke basis data MySQL
$koneksi = mysql_connect($server, $namauser, $passuser) or die("Salah server, nama pengguna, atau passwordnya!"); ?> 11.file : lihat/query_buat.php <html> <head> <title>Data Zamb</title> </head> <body>
<?php
$namahost="localhost"; $namauser="root"; $password=""; $namadbs="comp";
$koneksi=mysql_connect($namahost, $namauser, $password) or die ("Gagal koneksi".mysql_error());
mysql_query("CREATE DATABASE IF NOT EXISTS $namadbs", $koneksi) or die ("Gagal buat database".mysql_error());
mysql_select_db($namadbs, $koneksi) or die ("Gagal pilih database".mysql_error());
mysql_query("CREATE TABLE IF NOT EXISTS siswa
(nim INT(3) NOT NULL AUTO_INCREMENT, nama VARCHAR(50) NOT NULL,
alamat VARCHAR(100) NOT NULL, prop_asal VARCHAR(50) NOT NULL, smu_asal VARCHAR(50) NOT NULL, jurusan ENUM('TI','TM','TK','SI','MI'), angkatan VARCHAR(20) NOT NULL, PRIMARY KEY (nim))", $koneksi)
or die ("Gagal buat table".mysql_error()); ?> </body> </html> 12.file : lihat/query_insert.php <html> <head> <title>Data Zamb</title> </head> <body> <?php $namahost="localhost"; $namauser="root"; $password=""; $namadbs="comp";
$koneksi = mysql_connect($namahost, $namauser, $password) or die ("Gagal koneksi".mysql_error());
mysql_select_db($namadbs, $koneksi) or die ("Gagal pilih database".mysql_error()); mysql_query(" INSERT INTO siswa SET nama='anas',
prop_asal='Lampung',
smu_asal='SMU Teladan Lampung', jurusan='TI',
angkatan='2001-2002'
") or die ("Gagal query".mysql_error()); mysql_query(" INSERT INTO siswa SET nama='jack',
alamat='Jl.blimbing, Way Jepara, LamTim', prop_asal='Lampung',
smu_asal='SMU Teladan Larangan', jurusan='TI',
angkatan='2001-2002'
") or die ("Gagal query".mysql_error()); ?> </body> </html> 13.file : lihat/search.php <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/data_siswa/gbr/12.jpg"> <title>zambigo@k.bja</title>
<link href="http://localhost/data_siswa/pelengkap/all.css"1 rel="stylesheet" type="text/css"/> </head>
<body> <div
id="header"> &nbs p;
<a href="http://localhost/data_siswa/index.php"><input type="submit" class="submit" name="Daftar" value="Home"></a>
<a href="http://localhost/data_siswa/entri/ent_mah_com.php"><input type="submit" class="submit" name="Daftar" value="Entri Data"></a>
<a href="http://localhost/data_siswa/login/login.html"><input type="submit" class="submit" name="Daftar" value="Edit Data"></a>
<a href="http://localhost/data_siswa/lihat/search.php"><input type="submit" class="submit" name="Daftar" value="Pencarian Data"></a>
<a href="http://localhost/data_siswa/lihat/data_rows.php"><input type="submit" class="submit" name="Daftar" value="Lihat Data Mahasiswa "></a>
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div>
<div id="nav_left">
<img src="http://localhost/data_siswa/gbr/logos.jpg" width="150" height="55" border="0" alt=""> </div>
<div id="nav_left_link"> <div id="stylelink"> <?php
print date('j F Y'); ?><br>
<span class="menu_caption">Main Menu </span><br/> <ul>
<li><a href="http://localhost/data_siswa/index.php">Home</a></li>
<li><a href="http://localhost/data_siswa/entri/ent_mah_com.php">Entri Data</a></li> <li><a href="http://localhost/data_siswa/login/login.html">Edit Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/search.php">Pencarian Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/data_rows.php">Lihat Data Mahasiswa</a></li> </ul>
<img src="http://localhost/data_siswa/gbr/hi.gif" width="150" height="60" border="0" > </ul>
</div> </div>
<div id="box_isi"> <?php
// cek apakah kondisi form terkirim atau tidak if (!$cari)
{
// jika form tidak dalam kondisi terkirim, // tampilkan form pencarian nama ?>
<center>
<form action="<?php echo $PHP_SELF ?>" method="POST"> <font size=5>Pencarian Data Anggota Sakura.Comp</font> <p>
<h4>Masukkan nama yang dicari :</h4> <p>
<input type="text" name="form_nama" size="30" maxlength="50"> <input type="submit" name="cari" value=" Cari Data ">
</form> </center> <?php }
else {
// jika form dalam kondisi terkirim,
// lakukan pencarian dan tampilkan hasilnya // ambil variabel untuk koneksi basis data require("koneksi.php");
// tentukan query dan kriteria pencarian
$query = "SELECT * FROM siswa WHERE NAMA LIKE '%$form_nama%'"; // lakukan proses query
$hasil = mysql_db_query($db,$query,$koneksi); // cek apakah pencarian ada hasilnya
$jml_rec = mysql_num_rows($hasil); if (!$jml_rec)
{
// jika pencarian tidak ada hasilnya, // tampilkan pesan gagal
?>
<center>
<font size=5>Nama Anggota tidak ditemukan!</font><p> <a href="<?php echo $PHP_SELF?>">Klik di sini
untuk kembali</a> </center> <?php } else {
// jika pencarian memberikan hasil, // tampilkan dalam halaman html
// membuat tabel untuk menampilkan hasil pencarian echo "<font size=5>Hasil Pencarian ".
"Ditemukan $jml_rec Data</font><br>\n";
echo "<table border=1 cellpadding=1 cellspacing=0>\n"; echo "<tr>\n";
echo "<td>NIM</td>\n"; echo "<td>Nama</td>\n"; echo "<td>Alamat</td>\n"; echo "<td>Prop_Asal</td>\n"; echo "<td>SMU Asal</td>\n"; echo "<td>Jurusan</td>\n"; echo "<td>Angkatan</td>\n"; echo "</tr>\n";
// gunakan perulangan while
// perulangan akan terjadi sepanjang masih // ditemukan record
while (list($nim,$nama,$alamat,$prop_asal,$smu_asal,$jurusan,$angkatan) = mysql_fetch_row($hasil))
{
// modifikasi beberapa variabel hasil // mysql_fetch_row()
$angkatan = $angkatan;
// format dalam baris dan kolom tabel echo "<tr>\n"; echo "<td>$nim</td>\n"; echo "<td>"; echo "$nama"; echo "</td>\n"; echo "<td>$alamat</td>\n"; echo "<td>$prop_asal</td>\n"; echo "<td>$smu_asal</td>\n"; echo "<td>$jurusan</td>\n"; echo "<td>$angkatan</td>\n"; echo "</tr>\n"; } echo "</table>\n"; echo "<p>\n";
echo "<a href=$PHP_SELF>Klik di sini ". "untuk kembali</a>\n";
// bebaskan memori yang digunakan untuk proses mysql_free_result($hasil); } } ?> </div></p> </div> </body> </html> 14. file : lihat/tabel_login.php <?php include "koneksi.php"; mysql_select_db($db, $koneksi);
mysql_query("CREATE TABLE IF NOT EXISTS login (id int(3) AUTO_INCREMENT,
username VARCHAR(50) NOT NULL, password VARCHAR(100) NOT NULL, PRIMARY KEY (id))", $koneksi)
or die ("Gagal buat table".mysql_error()); mysql_query(" INSERT INTO login SET id='',
username='admin',
password='21232f297a57a5a743894a0e4a801fc3' ") or die ("Gagal query".mysql_error());
?>
<?php
session_start(); include "config.php" ;
$username = $_POST['username']; $password = $_POST['password'];
$passwordhash = md5($password); // mengenkripsikannya untuk dicocokan dengan database $perintahnya = "select username, password from login where username = '$username' and password = '$passwordhash'"; $jalankanperintahnya = mysql_query($perintahnya); $ada_apa_enggak = mysql_num_rows($jalankanperintahnya); if ($ada_apa_enggak >= 1 ) { $_SESSION['username'] = $username; header("location: ../edit/dat_sis.php"); } else header("location: login.html"); ?> 16.file : login/config.php <?php $host = "localhost"; $username = "root"; $password = ""; $databasename = "comp";
$connection = mysql_connect($host, $username, $password) or die("Kesalahan Koneksi ... !!"); mysql_select_db($databasename, $connection) or die("Databasenya Error");
?>
17.file : login/login.html
<!DOCTYPE html
"http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US"> <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="http://localhost/data_siswa/gbr/12.jpg"> <title>zambigo@k.bja</title>
<link href="http://localhost/data_siswa/pelengkap/all.css"1 rel="stylesheet" type="text/css"/> </head>
<body> <div
id="header"> &nbs p;
<a href="http://localhost/data_siswa/index.php"><input type="submit" class="submit" name="Daftar" value="Home"></a>
<a href="http://localhost/data_siswa/entri/ent_mah_com.php"><input type="submit" class="submit" name="Daftar" value="Entri Data"></a>
<a href="http://localhost/data_siswa/login.html"><input type="submit" class="submit" name="Daftar" value="Edit Data"></a>
<a href="http://localhost/data_siswa/lihat/search.php"><input type="submit" class="submit" name="Daftar" value="Pencarian Data"></a>
<a href="http://localhost/data_siswa/lihat/data_rows.php"><input type="submit" class="submit" name="Daftar" value="Lihat Data Mahasiswa "></a>
<p class="judul_header_kecil">Ahlan Wasahlan fi</p> <h1 class="judul_header_besar">zambigo@k.bja</h1>
<p class="judul_header_kecil">"Isykariiman Aumut Syahiidan"</p> </div>
<div id="nav_left">
<img src="http://localhost/data_siswa/gbr/logos.jpg" width="150" height="55" border="0" alt=""> </div>
<div id="nav_left_link"> <div id="stylelink">
<span class="menu_caption">Main Menu </span><br/> <ul>
<li><a href="http://localhost/data_siswa/index.php">Home</a></li>
<li><a href="http://localhost/data_siswa/entri/ent_mah_com.php">Entri Data</a></li> <li><a href="http://localhost/data_siswa/login/login.html">Edit Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/search.php">Pencarian Data</a></li>
<li><a href="http://localhost/data_siswa/lihat/data_rows.php">Lihat Data Mahasiswa</a></li> </ul>
<img src="http://localhost/data_siswa/gbr/hi.gif" width="150" height="60" border="0" > </ul>
</div> </div>
<div id="box_isi">
<form method=post action=cek.php>
<tr><td colspan='2' align='center'><img src="../gbr/frantic.gif" width="200" height="160" border="0" alt=""></td></tr>
<tr><td>username</td>
<td><input type=text name=username></tr> <tr><td>password</td>
<td><input type=password name=password></tr> <tr><td></td>
<td><input type=submit name=submit value=Login></tr> </form> </table></div></div></div> </body> </html> 18.file : login/logout.php <?php session_start(); if ($_REQUEST['maukeluar'] == "iya") { if(ISSET($_SESSION['username'])) { UNSET($_SESSION['username']); } } header("location: login.html"); session_destroy(); ?> 19.file : login/main.php <?php session_start(); if (ISSET($_SESSION['username'])) { print $_SESSION['username'];
print "<br><a href=../login/logout.php?maukeluar=iya>logout</a>"; }
header("location: ../login/login.html"); ?> 20.file : pelengkap/all.css /* ############################################# judul : zambigoak.indo.tc author : bch.zambigoak.bja date : januari 2008 ############################################### */
/* medefinisikan header untuk bagian atas */ #header { position: static; height: 110px; width: 98%; /* banner */ background-image: url("http://localhost/data_siswa/gbr/net.jpg"); padding-top: 3%; padding-right: 2%; padding-bottom: 2%: padding-left: 4%; line-height: 0em; left: 50px; right: 50px; } /* tulisan assalamualaikum */ .judul_header_kecil {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1em; color: #00FF00; letter-spacing: 1em; padding-left:70px; align: center; } /* tulisan zambigoak */ .judul_header_besar {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 2em; color: #f4d8a6; letter-spacing: 0.5em;/*spasi*/ text-decoration: line-through; padding-left:70px; }
#footer{ position: static; height: 90px; width: 100%; /* banner */ background-color: #132500; padding-top: 2%; padding-right: 2%; padding-bottom: 2%: padding-left: 4%; line-height: 0em; left: 50px; right: 50px; } .footer_kecil {
font-family: urw chancery l; font-size: 1em; color: #00FF00; letter-spacing: 0.3em; text-align : center; } /* ############################################# */ /* mendevinikasikan navigasi bagian kanan */
/* kotak luar go */ #nav_left { background-color:#6F6F6F; height: 60px; width: 170px; line-height: 0.1; padding: 0.5em; border-bottom-width: 6px; border-bottom-style: solid; border-bottom-color: #aaaa; }
/* background main menu*/ #nav_left_link { background-color: #867963; height: 295px; width: 170px; padding: 0.5em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #aafdaa; }
#nav_left_menu_caption { background-color: blue; height: 20px; width: 170px; padding: 0.5em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: red; } /* tulisan menu */ .menu_caption {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1em;
color: #fff;
text-align: center; vertical-align: middle; }
#stylelink a:link, #stylelink a:visited { display: block;
border-top: 1px solid white;/* baris pada menu */ border-bottom: 1px solid blue;/* baris pada menu */ background-color:#84703F;/* background pada home */ font-weight: italic;/* bentuk tulisan home tebal atau lainnya*/ color: #EBE2E2;/* warna tulisan home */
width: 100px; padding-top: 0px; padding-right: 0px; padding-bottom: 3px; padding-left: 10px; text-decoration: none; } #stylelink a:hover {
border-top: 1px solid blue; background-color:#EEB348; background-image: none; font-weight: bold; text-decoration: none; color: #red; }
/* mengubah style pada text box cari */ .txt_cari {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;
color: blue;/* warna tulisan */
background-color: #ffffff;/* warna kotak text */ height: 20px;
width: 100px;
}
/* mengubah botton cari */ .bt_cari {
background-color: #c6c3b1;/* warna kotak */ font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold;
color: #8B6914;/* tulisan go */ }
/* mendevinisikan bagian bawah tau heder */ #bawah {
background-color:#e5f4z6 ;/* warna kotak bawah */ height: 75px; width: 90%; padding-right: 2em; padding-left: 4em; padding-top: 1em: padding-bottom: 1em; vertical-align: none; } .copyright_bawah {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;
font-family: urw chancery l;
color: #333666;/* tulisan di kotak bawah */ text-align: center;
}
/*###############################################*/ /*mendefikasikan bagian isi atau cointen yang ada di tengah*/ /* garis berdiri */ #box_isi { position: absolute; height: auto; width:75%; left: 204px; top: 150px; padding: 1em; border-left-width: 3px; border-left-style: double; border-left-color: #d3d4aa; border-right-width: 3px; border-right-style: double; border-right-color: #d3d4aa; } .hurup_besar_isi {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 4em;
font-weight: bold; color: #8B6914;
float: left; padding-top: 0.1em; padding-right: 0.1em; padding-bottom: 0.1em: padding-left: 0.1em; text-align: center; } .isi {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 1.2em;
color: #000;/* warna tulisan isi */ line-height: 2em; text-align: justify; vertical-align: none; } /*bacground utama*/ body {
font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #AaaA9A; margin: auto; padding: 0.2em; } .submit{ background-color: #c7d8b4; border: 2px dotted #a5b5b2; text-decoration: underline; font-weight: bolder;
color: #8B6914; }
p {
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;
}
21.file : pelengkap/counter.txt