ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: jengseo01 ที่ 11 กรกฎาคม 2014, 07:51:56



หัวข้อ: อะไรผิดช่วยที ทำไมมันค้างอยู่ checklogin
เริ่มหัวข้อโดย: jengseo01 ที่ 11 กรกฎาคม 2014, 07:51:56
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]


หัวข้อ: Re: อะไรผิดช่วยที ทำไมมันค้างอยู่ checklogin
เริ่มหัวข้อโดย: max30012540 ที่ 11 กรกฎาคม 2014, 08:18:27
สุดจะทนกับการวางโค้ดบน SMF
http://www.lnwcode.com/3397/%E0%B8%AB%E0%B8%B1%E0%B8%A7%E0%B8%82%E0%B9%89%E0%B8%AD%3A+%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3%E0%B8%9C%E0%B8%B4%E0%B8%94%E0%B8%8A%E0%B9%88%E0%B8%A7%E0%B8%A2%E0%B8%97%E0%B8%B5+%E0%B8%97%E0%B8%B3%E0%B9%84%E0%B8%A1%E0%B8%A1%E0%B8%B1%E0%B8%99%E0%B8%84%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%AD%E0%B8%A2%E0%B8%B9%E0%B9%88+checklogin


หัวข้อ: Re: อะไรผิดช่วยที ทำไมมันค้างอยู่ checklogin
เริ่มหัวข้อโดย: lnwnuyhod ที่ 11 กรกฎาคม 2014, 08:42:30
โค๊ด:
$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");


หัวข้อ: Re: อะไรผิดช่วยที ทำไมมันค้างอยู่ checklogin
เริ่มหัวข้อโดย: jengseo01 ที่ 11 กรกฎาคม 2014, 09:45:41
สุดจะทนกับการวางโค้ดบน SMF
[url]http://www.lnwcode.com/3397/%E0%B8%AB%E0%B8%B1%E0%B8%A7%E0%B8%82%E0%B9%89%E0%B8%AD%3A+%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3%E0%B8%9C%E0%B8%B4%E0%B8%94%E0%B8%8A%E0%B9%88%E0%B8%A7%E0%B8%A2%E0%B8%97%E0%B8%B5+%E0%B8%97%E0%B8%B3%E0%B9%84%E0%B8%A1%E0%B8%A1%E0%B8%B1%E0%B8%99%E0%B8%84%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%AD%E0%B8%A2%E0%B8%B9%E0%B9%88+checklogin[/url]


อะไรนิ


หัวข้อ: Re: อะไรผิดช่วยที ทำไมมันค้างอยู่ checklogin
เริ่มหัวข้อโดย: xvlnw.com ที่ 11 กรกฎาคม 2014, 12:04:37
ถ้าเงื่อนไขไม่ถูกต้อง หรือว่า user ไม่ได้มีอยู่ในฐานข้อมูล มันก็จะเรียกใช้ Javascript มาแสดง ลอง echo อะไรก่อนนั้นดูครับ คาดว่า javascript อาจจะไม่ทำงาน มันก็เลยค้างอยู่แบบนั้นครับ