|
|
|
สมัครสมาชิกผ่านแล้าลงในฐานข้อมูลแล้วแต่ไม่สามารถ login ได้ครับ |
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2017-03-12 09:01:05 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือผมต้องเอาโค๊ดส่วนไหนให้ดูครับพอดีไม่แน่ใจว่าปัญหาเกิดจากไฟล์ไหนครับ
|
|
|
|
|
Date :
2017-03-12 15:27:34 |
By :
myboy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ต้องดูโค้ดหน้าที่มีการ query mysql ทั้งตอน login และ register ครับ
ถ้าเป็นไปได้แคปข้อมูลใน database มาให้ดูประกอบด้วยก็ดีครับ
|
|
|
|
|
Date :
2017-03-12 18:58:48 |
By :
tomrambo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จาก database
จาก code นี้ครับ
Code (PHP)
if (isset($_POST['txt_user'])) {
$loginUsername=$_POST['txt_user'];
$password=$_POST['txt_pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "house.php";
$MM_redirectLoginFailed = "login_error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_con_blythe, $con_blythe);
$LoginRS__query=sprintf("SELECT * FROM t_customer WHERE cus_user=%s AND cus_pass=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $con_blythe) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
$loginUserDetail = mysql_fetch_assoc($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//clear ข้อมูลที่เกี่ยวกับ username ชุดก่อนหน้านี้ออก
unset($_SESSION['CustID']);
unset($_SESSION['cus_name']);
// clear ข้อมูลตระกร้าสินค้า
unset($_SESSION['newcart']);
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
$_SESSION['CusID'] = $loginUserDetail['cus_id']; //เพิมเข้าไป
$_SESSION['cus_name'] = $loginUserDetail['cus_name'];
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
ขอบคุณครับ
|
ประวัติการแก้ไข 2017-03-12 20:23:45 2017-03-12 20:24:32
|
|
|
|
Date :
2017-03-12 19:53:18 |
By :
myboy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง echo query ออกมาดูครับว่ามีค่ามาถูกต้องไหม
ปล. ถ้าจะโพสต์โค้ด ใส่ tag php ด้วยครับ เพราะคนเข้ามาอ่านเค้าตาลายครับ
if (isset($_POST['txt_user'])) {
$loginUsername=$_POST['txt_user'];
$password=$_POST['txt_pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "house.php";
$MM_redirectLoginFailed = "login_error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_con_blythe, $con_blythe);
$LoginRS__query=sprintf("SELECT * FROM t_customer WHERE cus_user=%s AND cus_pass=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $con_blythe) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
$loginUserDetail = mysql_fetch_assoc($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//clear ข้อมูลที่เกี่ยวกับ username ชุดก่อนหน้านี้ออก
unset($_SESSION['CustID']);
unset($_SESSION['cus_name']);
// clear ข้อมูลตระกร้าสินค้า
unset($_SESSION['newcart']);
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
$_SESSION['CusID'] = $loginUserDetail['cus_id']; //เพิมเข้าไป
$_SESSION['cus_name'] = $loginUserDetail['cus_name'];
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
//header("Location: ". $MM_redirectLoginFailed );
echo $LoginRS__query;
}
}
|
|
|
|
|
Date :
2017-03-12 20:26:42 |
By :
tomrambo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เป็นที่บรรทัดนี้หรือเปล่าครับ
Code (PHP)
$LoginRS__query=sprintf("SELECT * FROM t_customer WHERE cus_user=%s AND cus_pass=%s",
|
|
|
|
|
Date :
2017-03-12 20:35:00 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|