|
|
|
ผมขอรบกวนสอบถามเรือ่งการ login มีปัญหาครับเนื่องจาก login เข้าไปแล้วไม่แสดงไหรเลยครับ |
|
|
|
|
|
|
|
อันนี้คือ source code ครับ
อันนี้คือเว็บที่ใช้อยู่ครับ http://www.protoochaikal.com/student.php
Code (PHP)
<? session_start(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<?
require_once('Connections/db_connect.php');
$MEM_USER = $HTTP_POST_VARS['MEM_USER'];
$MEM_PASS = $HTTP_POST_VARS['MEM_PASS'];
$_SESSION['MEM_USER']= $MEM_USER;
$_SESSION['MEM_PASS']= $MEM_PASS ;
//print $_SESSION['MEM_USER'];
//print "<br>".$_SESSION['MEM_PASS'];
$sql = "SELECT MEM_PASS FROM member WHERE MEM_USER='$MEM_USER' AND MEM_PASS='$MEM_PASS'";
//$sql = "SELECT * FROM MEMBER WHERE MEM_USER='$MEM_USER' AND MEM_PASS='$MEM_PASS'";
//print $sql;
$rs = mysql_query($sql) or die(mysql_error());
$nrow = mysql_num_rows($rs);
$row=mysql_fetch_array($rs);
exit;
//if($nrow >=1){
if($nrow !=0){
// $sql1=" SELECT MEM_SCORE1 FROM MEMBER WHERE MEM_USER = '$MEM_USER' AND MEM_PASS = '$MEM_PASS' ";
// //print $sql1;
// $rs1 = mysql_query($sql1);
// $nrow1 = mysql_num_rows($rs1);
// $row1=mysql_fetch_array($rs1);
// if($row1==0) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=chap_1.php?ck=0\"> ";
// }else {
//print " <meta http-equiv=\"refresh\" content=\"0; URL=chap_1.php?ck=0\"> ";
//$sql2=" SELECT MEM_PRETEST_VALUE, MEM_SCORE1, MEM_SCORE2, MEM_SCORE3, MEM_SCORE_POST FROM MEMBER WHERE MEM_USER ='$MEM_USER' and MEM_PASS='$MEM_PASS' ";
$sql2=" SELECT * FROM clince WHERE mem_user ='$MEM_USER' and mem_pass='$MEM_PASS' ";
//print $sql2;
$rs2 = mysql_query($sql2);
$nrow2 = mysql_num_rows($rs2);
$row2=mysql_fetch_array($rs2);
$score1=$row2['mem_pretest_value'];
$score2=$row2['mem_score1'];
$score3=$row2['mem_score2'];
$score4=$row2['mem_score3'];
$score5=$row2['mem_score4'];
$score6=$row2['mem_score5'];
$score7=$row2['mem_score6'];
$score8=$row2['mem_score7'];
$score9=$row2['mem_score8'];
$score10=$row2['mem_score9'];
$score11=$row2['mem_score10'];
$score12=$row2['mem_score11'];
$score13=$row2['mem_score12'];
$score14=$row2['mem_score13'];
$score15=$row2['mem_score14'];
$score16=$row2['mem_score15'];
$score17=$row2['mem_score16'];
$score18=$row2['mem_score17'];
$score19=$row2['mem_score18'];
$score20=$row2['mem_score_post'];
//echo "1:".$score1." 2:".$score2." 3:".$score3." 4:".$score4." 5:".$score5;
if(($score>0) || ($score1==0)) {
//print " <meta http-equiv=\"refresh\" content=\"0; URL=chap_1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap_1.php?cK=0\"> ";
}else if($score2<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap1.php\"> ";
}else if($score3<8) {
//print " <meta http-equiv=\"refresh\" content=\"0; URL=test2.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap2.php\"> ";
}else if($score4<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap3.php\"> ";
}else if($score5<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap4.php\"> ";
}else if($score6<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap5.php\"> ";
}else if($score7<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap6.php\"> ";
}else if($score8<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap7.php\"> ";
}else if($score9<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap8.php\"> ";
}else if($score10<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap9.php\"> ";
}else if($score11<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap10.php\"> ";
}else if($score12<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap11.php\"> ";
}else if($score13<16) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap12.php\"> ";
}else if($score14<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap13.php\"> ";
}else if($score15<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap14.php\"> ";
}else if($score16<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap15.php\"> ";
}else if($score17<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap16.php\"> ";
}else if($score18<8) {
//print " <meta http-equiv=\"refresh\" content=\"0; URL=test3.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap17.php\"> ";
}else if($score19<8) {
// print " <meta http-equiv=\"refresh\" content=\"0; URL=test1.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap18.php\"> ";
}else if($score20<15) {
//print " <meta http-equiv=\"refresh\" content=\"0; URL=test4.php\"> ";
print " <meta http-equiv=\"refresh\" content=\"0; URL=test4.php\"> ";
}else if (($score1>0)&&($score2>=8)&&($score3>=8)&&($score4>=8)&&($score5>=8)&&($score6>=8)&&($score7>=8)&&($score8>=8)&&($score9>=8)&&($score10>=8)&&($score11>=8)&&($score12>=8)&&($score13>=8)&&($score14>=8)&&($score15>=15)&&($score16>=15)&&($score17>=15)&&($score18>=15)&&($score19>=15)&&($score20>=15)){
print " <meta http-equiv=\"refresh\" content=\"0; URL=chap_1.php?cK=1\"> ";
}
// }
}else {
print "<script>";
print "alert('username หรือ password ไม่ถูกต้องค่ะ');";
print "location.href='index.php';";
print "</script>";
}
?>
|
|
|
|
|
Date :
2012-06-14 09:44:05 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณที่แนะนำครับ บรรทัดไหนเหรอครับ
|
|
|
|
|
Date :
2012-06-14 10:26:41 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับขอบคุณครับ
|
|
|
|
|
Date :
2012-06-14 10:29:33 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอนนี้ปัญหามาเกิดขึ้นอีกแบบครับ พอเอา exit ออก
หน้านี้ค้างแบบนี้ตลอดเลยครับซึ่งคลิ๊กอะรก็ไม่ได้ครับ
http://www.protoochaikal.com/student.php
|
ประวัติการแก้ไข 2012-06-14 10:52:48
|
|
|
|
Date :
2012-06-14 10:51:20 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $nrow;
มันได้ค่าอะไรครับ หรือไม่ลอง debug แบบ echo ดูว่าใน if มันเข่้า statement ไหนครับ
|
|
|
|
|
Date :
2012-06-14 11:33:30 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้างั้นเราควรนำ echo ไว้ตรงส่วนไหนได้บ้างครับ หมายถึงช่่วงไหนน่ะคับ มีตัวอย่างคำสั่งไหมครับพอดีผมเพิ่งหัดเขียนครับ ขอบคุณครับ
|
ประวัติการแก้ไข 2012-06-14 11:56:48
|
|
|
|
Date :
2012-06-14 11:35:55 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|