1. koneksi.php
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "data";
$konek = mysql_connect($host, $user, $password) or die ('Koneksi Gagal! ');
mysql_select_db($db);
?>
2. login.php
<?php
session_start();
if(isset($_SESSION['username'])) {
header('location:menu.php'); }
require_once("koneksi.php");
?>
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(images/ERTIGA.gif);
background-repeat: no-repeat;
background-color: #FFFFFF;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style1 {color: #0000FF}
.style7 {font-size: 14px}
.style10 {color: #0000FF; font-size: 24px; font-weight: bold; font-family: "Times New Roman", Times, serif;}
-->
</style></head>
<body>
<center>
<form action="proseslogin.php" method="post">
<tr><td colspan="2" align="center"><h1 align="right" class="style1"><img src="images/dc.jpg" width="308" height="78"></h1>
</td></tr>
<div align="right">
<table border="0" align="right" bordercolor="#FFFFFF" bgcolor="#6CCFFF">
<tr>
<td> </td>
<td> </td>
<td width="2" rowspan="4"> </td>
<td colspan="3" rowspan="2"><div align="center" class="style10">LOGIN </div></td>
<td width="17" rowspan="3"> </td>
</tr>
<tr>
<td width="1"> </td>
<td width="1"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Username </td>
<td><input type="" name="username"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="60">Password</td>
<td width="9"> </td>
<td width="144"><input type="password"name="password"></td>
<td> </td>
</tr>
<tr><td height="36" colspan="7" align="right"><div align="center">
<input type="submit" value="Login">
<input type="reset" value="Batal">
</div></td></tr>
<tr valign="bottom"><td height="59" colspan="7" align="center"><p>Belum Punya akun ? <a href="daftar.php"><b>Daftar</b></a></p>
<p> </p></td></tr>
</table>
</div>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form name="form1" method="post" action="">
<span class="style7"> © 2014 Project Pemrograman Web </span>
</form>
<p> </p>
</center>
</body>
</html
3. proseslogin.php
<?php
require_once("koneksi.php");
$username = $_POST['username'];
$pass = $_POST['password'];
$cekuser = mysql_query("SELECT * FROM login WHERE username = '$username'");
if(mysql_num_rows($cekuser) <> 0) {
echo "Username Sudah Terdaftar!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
if(!$username || !$pass) {
echo "Masih ada data yang kosong!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
$cekuser = mysql_query("INSERT INTO login(username, password) VALUES('$username','$pass')");
if(cekuser) {
echo "Pendaftaran Sukses, Silahkan <a href='login.php'>Login</a>";
} else {
echo "Proses Gagal!";
echo "<a href='daftar.php'>Back</a>";
}
}
}
?>
4. daftar.php
<?php
session_start();
if(isset($_SESSION['username'])) {
header('location:index.php'); }
?>
<html>
<head>
<title>Form Pendaftaran</title>
<style type="text/css">
<!--
.style1 {
color: #0000FF;
font-size: 18px;
font-family: "Times New Roman", Times, serif;
}
.style6 {font-size: 12px}
.style7 {font-size: 14px}
.style8 {font-size: 14}
.style10 {color: #0000FF; font-size: 18px; font-family: "Times New Roman", Times, serif; font-weight: bold; }
-->
</style>
</head>
<body>
<center>
<form action="prosesdaftar.php" method="post">
<p><img src="images/dc.jpg" width="372" height="112"></p>
<table width="278" align="center" bgcolor="#95DDFF">
<tr><td colspan="4" align="center"><h1 class="style1"><span class="style10">DAFTAR ADMIN </span></h1>
</td>
</tr>
<tr>
<td width="11"> </td>
<td width="63">Username</td>
<td width="169"> <input type="text" name="username"></td>
<td width="15"> </td></tr>
<tr>
<td> </td>
<td>Password</td>
<td> <input type="password" name="password"></td>
<td> </td></tr>
<tr><td height="39" colspan="4" align="right"><div align="center">
<input type="submit" value="Daftar">
<input type="reset" value="Batal">
</div></td></tr>
<tr><td colspan="4" align="center"><p>Sudah Punya akun ? <a href="login.php"><b>Login</b></a></p>
<p> </p></td></tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
<form name="form1" method="post" action="">
<span class="style6"><span class="style7"><span class="style8"> ©</span>2014 Project Pemrograman Web </span></span>
</form>
<p> </p>
</center>
</body>
</html>
5. prosesdaftar.php
<?php
require_once("koneksi.php");
$username = $_POST['username'];
$pass = $_POST['password'];
$cekuser = mysql_query("SELECT * FROM login WHERE username = '$username'");
if(mysql_num_rows($cekuser) <> 0) {
echo "Username Sudah Terdaftar!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
if(!$username || !$pass) {
echo "Masih ada data yang kosong!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
$cekuser = mysql_query("INSERT INTO login(username, password) VALUES('$username','$pass')");
if(cekuser) {
echo "Pendaftaran Sukses, Silahkan <a href='login.php'>Login</a>";
} else {
echo "Proses Gagal!";
echo "<a href='daftar.php'>Back</a>";
}
}
}
?>
6. logout.php
<?php
session_start();
unset($_SESSION['username']);
?>
<style type="text/css">
<!--
.style1 {color: #0000FF}
-->
</style>
<center>
<h2> </h2>
<h2><img src="images/New folder/book1 copy.jpg" width="105" height="77" /></h2>
<h2 class="style1">Anda Telah Berhasil Logout..!!</h2>
Silahkan klik <b><a href="menu-utama.php">Disini <b>Untuk Kembali Ke Menu Utama
</center>
<title>Logout </title>
<style type="text/css">
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "data";
$konek = mysql_connect($host, $user, $password) or die ('Koneksi Gagal! ');
mysql_select_db($db);
?>
2. login.php
<?php
session_start();
if(isset($_SESSION['username'])) {
header('location:menu.php'); }
require_once("koneksi.php");
?>
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(images/ERTIGA.gif);
background-repeat: no-repeat;
background-color: #FFFFFF;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style1 {color: #0000FF}
.style7 {font-size: 14px}
.style10 {color: #0000FF; font-size: 24px; font-weight: bold; font-family: "Times New Roman", Times, serif;}
-->
</style></head>
<body>
<center>
<form action="proseslogin.php" method="post">
<tr><td colspan="2" align="center"><h1 align="right" class="style1"><img src="images/dc.jpg" width="308" height="78"></h1>
</td></tr>
<div align="right">
<table border="0" align="right" bordercolor="#FFFFFF" bgcolor="#6CCFFF">
<tr>
<td> </td>
<td> </td>
<td width="2" rowspan="4"> </td>
<td colspan="3" rowspan="2"><div align="center" class="style10">LOGIN </div></td>
<td width="17" rowspan="3"> </td>
</tr>
<tr>
<td width="1"> </td>
<td width="1"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Username </td>
<td><input type="" name="username"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="60">Password</td>
<td width="9"> </td>
<td width="144"><input type="password"name="password"></td>
<td> </td>
</tr>
<tr><td height="36" colspan="7" align="right"><div align="center">
<input type="submit" value="Login">
<input type="reset" value="Batal">
</div></td></tr>
<tr valign="bottom"><td height="59" colspan="7" align="center"><p>Belum Punya akun ? <a href="daftar.php"><b>Daftar</b></a></p>
<p> </p></td></tr>
</table>
</div>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form name="form1" method="post" action="">
<span class="style7"> © 2014 Project Pemrograman Web </span>
</form>
<p> </p>
</center>
</body>
</html
3. proseslogin.php
<?php
require_once("koneksi.php");
$username = $_POST['username'];
$pass = $_POST['password'];
$cekuser = mysql_query("SELECT * FROM login WHERE username = '$username'");
if(mysql_num_rows($cekuser) <> 0) {
echo "Username Sudah Terdaftar!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
if(!$username || !$pass) {
echo "Masih ada data yang kosong!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
$cekuser = mysql_query("INSERT INTO login(username, password) VALUES('$username','$pass')");
if(cekuser) {
echo "Pendaftaran Sukses, Silahkan <a href='login.php'>Login</a>";
} else {
echo "Proses Gagal!";
echo "<a href='daftar.php'>Back</a>";
}
}
}
?>
4. daftar.php
<?php
session_start();
if(isset($_SESSION['username'])) {
header('location:index.php'); }
?>
<html>
<head>
<title>Form Pendaftaran</title>
<style type="text/css">
<!--
.style1 {
color: #0000FF;
font-size: 18px;
font-family: "Times New Roman", Times, serif;
}
.style6 {font-size: 12px}
.style7 {font-size: 14px}
.style8 {font-size: 14}
.style10 {color: #0000FF; font-size: 18px; font-family: "Times New Roman", Times, serif; font-weight: bold; }
-->
</style>
</head>
<body>
<center>
<form action="prosesdaftar.php" method="post">
<p><img src="images/dc.jpg" width="372" height="112"></p>
<table width="278" align="center" bgcolor="#95DDFF">
<tr><td colspan="4" align="center"><h1 class="style1"><span class="style10">DAFTAR ADMIN </span></h1>
</td>
</tr>
<tr>
<td width="11"> </td>
<td width="63">Username</td>
<td width="169"> <input type="text" name="username"></td>
<td width="15"> </td></tr>
<tr>
<td> </td>
<td>Password</td>
<td> <input type="password" name="password"></td>
<td> </td></tr>
<tr><td height="39" colspan="4" align="right"><div align="center">
<input type="submit" value="Daftar">
<input type="reset" value="Batal">
</div></td></tr>
<tr><td colspan="4" align="center"><p>Sudah Punya akun ? <a href="login.php"><b>Login</b></a></p>
<p> </p></td></tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
<form name="form1" method="post" action="">
<span class="style6"><span class="style7"><span class="style8"> ©</span>2014 Project Pemrograman Web </span></span>
</form>
<p> </p>
</center>
</body>
</html>
5. prosesdaftar.php
<?php
require_once("koneksi.php");
$username = $_POST['username'];
$pass = $_POST['password'];
$cekuser = mysql_query("SELECT * FROM login WHERE username = '$username'");
if(mysql_num_rows($cekuser) <> 0) {
echo "Username Sudah Terdaftar!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
if(!$username || !$pass) {
echo "Masih ada data yang kosong!<br/>";
echo "<a href='daftar.php'>Back</a>";
} else {
$cekuser = mysql_query("INSERT INTO login(username, password) VALUES('$username','$pass')");
if(cekuser) {
echo "Pendaftaran Sukses, Silahkan <a href='login.php'>Login</a>";
} else {
echo "Proses Gagal!";
echo "<a href='daftar.php'>Back</a>";
}
}
}
?>
6. logout.php
<?php
session_start();
unset($_SESSION['username']);
?>
<style type="text/css">
<!--
.style1 {color: #0000FF}
-->
</style>
<center>
<h2> </h2>
<h2><img src="images/New folder/book1 copy.jpg" width="105" height="77" /></h2>
<h2 class="style1">Anda Telah Berhasil Logout..!!</h2>
Silahkan klik <b><a href="menu-utama.php">Disini <b>Untuk Kembali Ke Menu Utama
</center>
<title>Logout </title>
<style type="text/css">
0 50 Kometar:
Posting Komentar