<?php include "/library/koneksi.php"?>
<?php
if(isset($_POST['btnlogin'])){
session_start();
$email = $_POST['email'];
$password = md5($_POST['password']);
$key = substr($_SESSION['key'],0,5);
$captcha = $_REQUEST['captcha'];
if($captcha == $key){
$sql_1 = mysql_query("SELECT * FROM tbpelanggan WHERE email = '$email' AND password = '$password' aktif = '1'");
while($row=mysql_fetch_array($sql_1)){
if($row > 0) {
$_SESSION['sUSER'] = $email;
$_SESSION['sNAMA'] = $row['nama'];
header( 'Location: index.php' ) ;
}
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="stylesheet" type="text/css" href="style.css">
<title></title>
</head>
<script type="text/javascript">
function CekField(){
if(document.login_member.email.value == ""){
alert ("Masukkan ID User.");
document.login_member.email.focus();
return false;
}else if(document.login_member.password.value == ""){
alert ("Masukkan Password.");
document.login_member.password.focus();
return false;
}else if(document.login_member.captcha.value == ""){
alert ("Masukkan captcha.");
document.login_member.captcha.focus();
return false;
}else{
document.login_member.action = "login.php";
}
}
function Fokus(){
document.login_member.email.focus();
}
</script>
<body onLoad="Fokus();">
<div id="wrape">
<div id="content">
<!-- *********************************** Content middle *********************************** -->
<div id="contentmiddle">
<div class="skn-cont-frm" style="width:500px; margin-left:200px; margin-bottom:30px;">
<div class="skn-box-top"><div class="l"><div class="m"></div></div></div>
<div class="skn-register">
<div class="skn-box-mid">
<h5 class="title">Login Pelanggan</h5>
<form name="login_member" id="login_member" method="post" onSubmit="return CekField();">
<table align="center" width="400px" cellspacing="0" cellpadding="5" border="0">
<tbody>
<?php
if(isset($_POST['btnlogin'])){
$email = $_POST['email'];
$password = $_POST['password'];
$key=substr($_SESSION['key'],0,5);
$captcha = $_REQUEST['captcha'];
if($captcha!=$key){
?>
<tr>
<td colspan="2">
<b style="color:#F00;">Masukkan Captcha dengan benar</b>
</td>
</tr>
<?
}else{
$sql_1 =mysql_query("SELECT * FROM tbpelanggan WHERE email = '$email' AND password = '$password'");
$rs_1 = mysql_fetch_array($sql_1);
if($rs_1 == 0) {
?>
<tr>
<td colspan="2">
<b style="color:#F00;">ID User / Password salah atau Akun tidak aktif.</b>
</td>
</tr>
<?
}
}
}
?>
<tr>
<td width="150px">Email</td>
<td><input type="text" id="email" name="email" class="input-text" style="width:175px;"></td>
</tr>
<tr>
<td width="150px">Password</td>
<td><input type="password" id="password" name="password" class="input-text" style="width:175px;"></td>
</tr>
<tr valign="top">
<td> Masukkan Captcha</td>
<td><img src="captcha.php"><p style="margin-bottom:0px; margin-top:5px;"><input type="text" name="captcha" id="captcha" class="input-text" style="width:100px;" autocomplete="off"></p></td>
</tr>
<tr>
<td align="right" colspan="2">
<div class="button-wrap" style="margin:0px;"><div class="sider"><input type="submit" value="Login" id="btnlogin" name="btnlogin" class="input-button"></div></div>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div class="skn-box-btm"><div class="l"><div class="m"></div></div></div>
</div>
</div>
<!-- *********************************** footer *********************************** -->
<? include "library/footer-login.php"?>
<div style="clear:both"></div>
</div>
</div>
</body>
</html>
Saya udah coba tadi mas,, tapi saya masih belum bisa memprosesnya mas.. tolong dong mas..
ini script login saya mas.. Terima Kasih..