|
|
|
รบกวนช่วยดูให้หน่อยครับ มันข้าม loopไป....... |
|
|
|
|
|
|
|
ไม่ได้ใส่ user level ใน table member เหรอครับ
|
|
|
|
|
Date :
2015-12-25 14:16:45 |
By :
tomguitar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอดู table หน่อยย
|
|
|
|
|
Date :
2015-12-25 14:55:01 |
By :
tomguitar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code
<?PHP
/// รับค่าusername และ password
$username = $_POST['username'];
$password = $_POST['password'];
/// ตรวจสอบ admin login
$sql = "select * from members where a_username = '$username' and a_password = '$password'";
$result = mysql_query($sql) or die ("error = $sql");
$num = mysql_num_rows($result);
$sql2 = "select * from members ";
$objQuery = mysql_query($sql) or die ("Error Query [".$sql."]");
while($objResult2 = mysql_fetch_array($objQuery))
{
$a_name = $objResult2['a_name'];
$a_lastname = $objResult2['a_lastname'];
}
/// เช็คเงื่อนไข
if($num > 0 )
{
$_SESSION['a_user'] = $username;
date_default_timezone_set('Asia/Bangkok');
$time = @date("d/m/Y H:i:s");
file_put_contents('./assets/log/log_file.txt',$username."|$password| <b>LOGIN</b> |IP = [".$_SERVER['REMOTE_ADDR']."]|".$time.PHP_EOL, FILE_APPEND);
exit("<script>alert('ยินดีต้อนรับเข้าสู่ระบบ คุณ $a_name $a_lastname');window.location='system_index_durable.php';</script>");
}
else
{
/// ตรวจสอบ memmbers
$sql2 = "select * from members_2 where m_username = '$username' and m_password = '$password' ";
$objQuery2 = mysql_query($sql2) or die ("Error Query [".$sql2."]");
while($objResult = mysql_fetch_array($objQuery2))
if($num > 0 )
{
$m_name = $objResult['m_name'];
$m_lastname = $objResult['m_lastname'];
$_SESSION['b_user'] = $username;
date_default_timezone_set('Asia/Bangkok');
$time = @date("d/m/Y H:i:s");
file_put_contents('./assets/log/log_file.txt',$username."|$password| <b>LOGIN</b> |IP = [".$_SERVER['REMOTE_ADDR']."]|".$time.PHP_EOL, FILE_APPEND);
exit("<script>alert('ยินดีต้อนรับเข้าสู่ระบบ คุณ $m_name $m_lastname');window.location='system_index_building.php';</script>");
}
else
{
/// ตรวจสอบ memmbers
$sql3 = "select * from members_3 where m_username = '$username' and m_password = '$password' ";
$objQuery3 = mysql_query($sql3) or die ("Error Query [".$sql3."]");
while($objResult = mysql_fetch_array($objQuery3))
if($num > 0 )
{
$m_name = $objResult['m_name'];
$m_lastname = $objResult['m_lastname'];
$_SESSION['c_user'] = $username;
date_default_timezone_set('Asia/Bangkok');
$time = @date("d/m/Y H:i:s");
file_put_contents('./assets/log/log_file.txt',$username."|$password| <b>LOGIN</b> |IP = [".$_SERVER['REMOTE_ADDR']."]|".$time.PHP_EOL, FILE_APPEND);
exit("<script>alert('ยินดีต้อนรับเข้าสู่ระบบ คุณ $m_name $m_lastname');window.location='index.php';</script>");
}
else
{
$_SESSION['c_user'] = $username;
$_SESSION['c_pass'] = $password;
session_destroy() ;
date_default_timezone_set('Asia/Bangkok');
$time = @date("d/m/Y H:i:s");
file_put_contents('./assets/log/log_file.txt',$username."|$password| <b>LOGIN FAIL</b> |IP = [".$_SERVER['REMOTE_ADDR']."]|".$time.PHP_EOL, FILE_APPEND);
exit("<script>alert('ชื่อผู้ใช้ของคุณไม่ได้อยู่ในระบบ กรูณาล๊อกอินเข้าสู่ระบบใหม่');window.location='form_login.php';</script>");
}
}
}
ประมาณนี้ครับ ลองดู
|
|
|
|
|
Date :
2015-12-25 16:42:14 |
By :
php |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|