Anda di halaman 1dari 5

MEMBUAT WEBSITE DINAMIS SEDERHANA

Langkah 1 :
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd>
<html>
<head>
<title>Web Portal Ebsof</title>
<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
</head>
<body>
<table width=800 border=0 align=center cellpadding=0 cellspacing=0>
<tr bgcolor=#003366>
<td height=100 colspan=2>&nbsp;</td>
</tr>
<tr bgcolor=#CCFF66>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
<td width=200 height=600 valign=top bgcolor=#00CCFF>&nbsp;</td>
<td valign=top>&nbsp;</td>
</tr>
<tr bgcolor=#0099FF>
<td height=80 colspan=2>&nbsp;</td>
</tr>
</table>
</body>
</html> - See more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-websitedinamis-bagian-1.html#sthash.KKUiWlJD.dpuf
Jika anda ingin medesign layout seperti gambar diatas anda cukup mengcopy script diatas
dan menyimpanya dengan nama file index.php folder Xampp-> Htdocs->buat folder baru
di dalam Htdocs, dan simpan file index.php didalamnya. - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-website-dinamis-bagian1.html#sthash.KKUiWlJD.dpuf

Langkah 2 :
Membuat halaman Admin
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
<style type=text/css>
<!
.style1 {

font-family: Georgia, Times New Roman, Times, serif;


font-weight: bold;
}
>
</style>
</head>
<body>
<table width=800 border=0 align=center cellpadding=0 cellspacing=0>
<tr bgcolor=#CCCC00>
<td height=100 colspan=2><span>Welcome To Admin </span></td>
</tr>
<tr>
<td width=200 height=200 bgcolor=#99FF66>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr bgcolor=#CCCC00>
<td height=40 colspan=2>&nbsp;</td>
</tr>
</table>
</body>
</html> - See more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-websitedinamis-part-ii.html#sthash.NI8YXf4S.dpuf
jika anda sudah mengikuti sesuai langkah-langkah diatas kemudian anda cukup simpan
dengan nama admin.php di folder yang sama dengan index.php - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-website-dinamis-partii.html#sthash.NI8YXf4S.dpuf

Langkah 3
Membuat koneksi.php
<?php
$server= localhost;
$username = root;
$password = ;
$database = db_web;
mysql_connect($server,$username,$password) or die (Koneksi Gagal);
mysql_select_db($database) or die (Database Tidak Bisa Di Buka );
?> - See more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-koneksi-databasephp-mysql.html#sthash.6PJLZ5Qi.dpuf
$server,$username,$password,$database merupakan sebuah variabel, dan db_web
merupakan nama database dari website yang ingin kita buat nanti. - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-koneksi-database-phpmysql.html#sthash.6PJLZ5Qi.dpuf
Jika sudah selesai dengan langkah-langkah diatas silakan anda simpan atau save dengan nama
file koneksi.php, di folder yang sama dengan index.php,admin.php - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-koneksi-database-phpmysql.html#sthash.6PJLZ5Qi.dpuf

Langkah 4
Membuat Form Login
1. buka lah dan aktifkan software Xampp Control->Service Apache dan Mysql->buat lah
data base baru dengan nama db_ebsof pada phpmyadmin anda - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-login-denganphpmysql.html#sthash.QpY8geVw.dpuf

2. Setelah itu buatlah tabel, di dalam database db_ebsof dengan nama tbl_user
berikut script nya tbl_user: - See more at: http://hasifdiary.blogspot.com/2013/08/caramembuat-from-login-dengan-phpmysql.html#sthash.QpY8geVw.dpuf
CREATE TABLE `db_ebsof`.`tbl_user` (`id_user` INT( 3 ) NOT NULL AUTO_INCREMENT
PRIMARY KEY ,`username` VARCHAR( 40 ) NOT NULL ,`password` VARCHAR( 40 ) NOT NULL
,`level` VARCHAR( 40 ) NOT NULL ,`blokir` ENUM( Y, N ) NOT NULL) ENGINE = MYISAM ; - See

more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-login-denganphpmysql.html#sthash.QpY8geVw.dpuf


INSERT INTO `db_ebsof`.`tbl_user` (
`id_user` ,`username` ,`password` ,`level` ,`blokir`)VALUES (1, admin, admin, admin, N

- See more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-login-denganphpmysql.html#sthash.QpY8geVw.dpuf


selanjutnya anda hanya perlu Menambahkan Form Login ini di antara code berikut :
<td width=200 height=600 valign=top bgcolor=#00CCFF>
</td>
- See more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-login-denganphpmysql.html#sthash.QpY8geVw.dpuf

Kode Form Login :


<table width=200 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><form name=form1 method=post action=cek_login.php>
<table width=200 border=0 cellspacing=0 cellpadding=2>
<tr bgcolor=#003366>
<td height=30 colspan=2><div align=center><strong>Form Login
</strong></div></td>
</tr>
<tr>
<td width=74 height=30>Username</td>
<td width=126>:
<input name=username type=text id=username size=10></td>
</tr>
<tr>
<td height=30>Password</td>
<td>:
<input name=password type=password id=password size=10></td>
</tr>

<tr>
<td height=30>&nbsp;</td>
<td><input type=submit name=Submit value=Login></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table> - See more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-logindengan-phpmysql.html#sthash.QpY8geVw.dpuf
dibawah ini adalah code cek_login.php yang berfungsi memproses dan mengecek user id
dan password yang di inputkan itu benar atau salah dan tersimpan di database : - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-login-denganphpmysql.html#sthash.QpY8geVw.dpuf
<?php
// pemanggilan file koneksi
include koneksi.php;
// pembuatan variabel pada penginputan username dan password
$username = $_POST['username'];
$pass
= $_POST['password'];
// Pengecekan user id dan password dengan yang ada di database
$login=mysql_query(SELECT * FROM tbl_user WHERE username=$username AND
password=$pass AND blokir=N');
$ketemu = mysql_num_rows($login);
$r=mysql_fetch_array($login);
if ($ketemu > 0) {
session_start ();
$_SESSION[namauser] = $r[username];
$_SESSION[passuser] = $r[password];
$_SESSION[leveluser]= $r[level];
header(location:admin.php);
}
else {
echo <center>LOGIN GAGAL
Username atau Password Anda Tidak benar
Atau Acount Anda Sedang Di blokir
;
echo <a href=index.php>Ulangi Lagi</a>;
}
?>
copy paste, coding php di atas ke text editor, simpan dengan nama cek_login.php di folder
yang sama dengan file-file yang telah kita buat sebelumnya..
Untuk melihat hasil nya, silahkan jalankan file index.php.. dan masukkan
userid : admin
password : admin

maka akan masuk ke halaman admin, dan jika user id dan password salah,, akan keluar pesan
username atau Password Tidak benar, Atau Acount Anda Sedang Di blokir. - See more at:
http://hasifdiary.blogspot.com/2013/08/cara-membuat-from-login-denganphpmysql.html#sthash.QpY8geVw.dpuf

Langkah 5
Membuat form logout

silakan anda buat seperti gambar diatas Dengan nama logout.php ke folder yang sama
dengan File, : index.php, Koneksi.php, cek_login.php. dll dan selamat mencoba - See
more at: http://hasifdiary.blogspot.com/2013/08/cara-membuat-websiter-dinamispart.html#sthash.iyEQt2Yr.dpuf

Anda mungkin juga menyukai