1. halaman login
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Login</title>
<style type="text/css">
<!--
.style1 {color: #0F6}
.style2 {color: #000}
body {
background-image: url(bg.jpg);
}
.button
{
border-radius:15px;
}
-->
</style>
</head>
<body>
<table width="427" height="237" border="1" align="center">
<tr>
<th height="40" bgcolor="#0000CC" scope="row"><span class="style1">LOGIN<tr>
<th height="151" scope="row"><form id="form1" name="form1" method="post" action="ceklogin.php">
<div align="center"></div>
<table width="200" border="1" align="center">
<tr>
<td class="style2 style1">username</td>
<td class="style2 style1"> </td>
<td class="style2"><span class="style1">
<label>
<input type="text" name="user" id="textfield" />
</label>
</span></td>
</tr>
<tr>
<td class="style2 style1">password</td>
<td class="style2 style1"> </td>
<td class="style2"><span class="style1">
<label>
<input type="password" name="pass" id="textfield2" />
</label>
</span></td>
</tr>
<tr>
<td colspan="3" class="style2 style1"><label>
<div align="center" class="button">
<input type="submit" name="button" id="button" value="Login" />
<input type="reset" name="button2" id="button2" value="reset" />
</div>
</label>
<label></label></td>
</tr>
</table>
</form>
</th>
</tr>
<tr>
<th bgcolor="#0000CC" scope="row"><span class="style1">©kokoyajje»</span></th>
</tr>
</body>
</html>
2. cek login
<?php
$username = $_POST['user'];
$password = $_POST['pass'];
$user="zack";
$pass="programmer";
if($username =="" or $password=="")
{
echo"<script language='javascript'>
alert('anda belum login');
location='index.php';
</script>";
}
else
{
if($username == $user && $password == $pass)
{
session_start();
$_SESSION['user'] = $username;
echo"<script language='javascript'>
window.location='admin_index.php';
</script>";
}
else
{
echo"<script language='javascript'>
alert('Username atau Password SALAH ~');
location='index.php';
</script>";
}
}
?>
kode php halaman login dan cek login
posted on 2:16:00 PM
in
HTML,
Other programming,
PHP,
Tutorial
Langganan:
Posting Komentar (Atom)