อะไรผิดช่วยที ทำไมมันค้างอยู่ checklogin

เริ่มโดย jengseo01, 11 กรกฎาคม 2014, 07:51:56

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

jengseo01

Conn.php
<?php
include('xxx.inc.php');

include(
'xxx.php');

$DB NewADOConnection('mysql');

$host "localhost" ;
$username "xxxx" ;
$password "xxx" 
$db "xxx" 


$DB->Connect($host$username$password$db);# M'soft style data retrieval with binds
$DB->Execute("SET NAMES UTF8");

?>


checklogin.php
<?php
session_start
();
session_save_path("./session/");
if(
$_REQUEST[code]==""){
echo
"กรุณาป้อนโค้ด";
echo
"<br><br><input type='button' value='back to edit' onclick='history.back();'></center>";
exit();
}
include 
"include/Conn.php";
mysql_select_db("$db");
$strSQL "SELECT * FROM member WHERE username = '".trim($_POST['txtusername'])."' and password = '".trim($_POST['txtpassword'])."'";
$objQuery mysql_query($strSQL);
$objResult mysql_fetch_array($objQuery);
if(!$objResult)
{
echo"<script language="javascript"> alert('กรุณากรอก username และ password'); </script>"
echo"<meta http-equiv='refresh' content='2;url=login.php'>";

}
else
{
$_SESSION["username"] = $objResult["username"];
$_SESSION["status"] = $objResult["status"];

session_write_close();

if($objResult["status"] == "ADMIN")
{
header("location:admin_page.php");//  ADMIN
exit();
}
else
{
header("location:user_page.php");// user
exit();
}
}
$name=$_SESSION['username'];
mysql_close();
?>


[/code]


lnwnuyhod


$DB = NewADOConnection('mysql');
$DB->Connect($host, $username, $password, $db);# M'soft style data retrieval with binds
$DB->Execute("SET NAMES UTF8");

ลองแบบนี้ดูครับ

$connect = mysql_connect( $host,$username,$password);
$condb = mysql_select_db($db);
mysql_query("set NAMES utf8");
mysql_query("SET character_set_results=utf8");


xvlnw.com

ถ้าเงื่อนไขไม่ถูกต้อง หรือว่า user ไม่ได้มีอยู่ในฐานข้อมูล มันก็จะเรียกใช้ Javascript มาแสดง ลอง echo อะไรก่อนนั้นดูครับ คาดว่า javascript อาจจะไม่ทำงาน มันก็เลยค้างอยู่แบบนั้นครับ
[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw