|
|
|
ทำหน้า login ค่ะ แล้วมันไม่ยอมเช็คเงือนไขถ้าใส่ username ถูก แต่ว่า password ผิดอ่ะค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<?
session_start();
?>
<? require ("connect.php");
$user = $_POST['username'];
$pass = $_POST['password'];
$remem == $_POST['remember'];
$sql = "select * from user where Username = '$user' and Password = '$pass' ";
$result = mysql_query($sql) or die (mysql_error());
$rs = mysql_fetch_array($result);
if($rs['Username']!='' and $rs['Password']!=''){
if($remem!=""){
$time = time()+(60*60*24*365);
setcookie('remem', $rs['Username'], $time);
$_SESSION['password']=$rs['Password'];
header("Refresh:0;url=main.php");
} else {
$_SESSSION['user']=$rs['Username'];
$_SESSION['pass']=$rs['Password'];
header("Refresh:0;url=main.php");
}
} else if($rs['Username']!='' and $rs['Password']==''){
echo "<script language='javascript'> alert('Incorrect Password'); </script>";
} else if($rs['Username']=='' and $rs['Password']==''){
header("Refresh:0;url=login.php");
echo "<script language='javascript'> alert('Invalid Username'); </script>";
}
?>
|
|
|
|
|
Date :
2012-01-03 22:56:22 |
By :
บังเอิญผ่านมาเห็น |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|