Viewing file: show.php (22.73 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
include("../include/FunctionDB.php");
include("../config.inc.php");
include("../function.php");
ConnectDB();
$sql = "SELECT * FROM personal_tb WHERE Teacher_code='$Teacher_code'";
$res = mysql_query($sql);
$rs = mysql_fetch_array($res);
?>
ตอบปัญหาจากข้อมูลที่แจ้งมาค่ะ
// ติดต่อ database เพื่ออ่านข้อมูล
mysql_connect($host,$user,$passwd);
mysql_query("SET NAMES 'tis620'");
$sql = "select * from webboard_data where No='$No'";
$result = mysql_db_query($dbname,$sql);
$NRow = mysql_num_rows($result);
if($NRow==0) { echo "Error2"; exit(); }
$row = mysql_fetch_array($result);
// กำหนดค่าตัวแปร เพื่อนำไปแสดง
$Question = $row["Question"];
$Note = $row["Note"];
$Name = $row["Name"];
$Namer = $row["Namer"];
$Member = $row["Member"];
$Email = $row["Email"];
$Date = $row["Date"];
$tDate = convert_date($row["Date"]);
//$Image = $row["Image"];
$nphoto = $row["nphoto"];
$pageviewdata = $row["pageview"];
//add คนดู
mysql_query("update webboard_data set pageview=pageview+1 where No=$No");
// ตรวจสอบรูปแบบการแสดง IP Address
switch ($showIP) {
case "ALL" : $IP = "(".$row["IP"].")"; break;
case "BAN" : $IP = "(".substr($row["IP"],0,strrpos($row["IP"],".")).".*)"; break;
case "NONE": $IP = ""; break;
default : $IP = $row["IP"];
}
if($Member) {
$sql = "select * from webboard_member where User='$Name'";
$result = mysql_db_query($dbname,$sql);
$NRow = mysql_num_rows($result);
if($NRow==0) { echo "Error3"; exit(); }
$row = mysql_fetch_array($result);
// กำหนดค่าตัวแปร เพื่อนำไปแสดง
$ICQ = $row["ICQ"];
$WebName = $row["WebName"];
$URL = $row["URL"];
$picname = $row["nphoto"];
$icon = $row["icon"];
}
// แสดงข้อมูลของคำถาม(กระทู้)
echo " \n";
echo "\n";
echo "\t$Question \n";
echo " | \n";
echo "\n";
echo " \n";
echo "\t\n";
echo "\t\n";
// ตรวจสอบว่ามีรูปหรือไม่
$picname = substr ($nphoto, -4);
if ( $picname == ".swf" ) {
echo "\t\t ";
}
elseif($nphoto) {
echo "\t\t \n";
}
echo "\t\t$Note\n";
echo "\t | \n";
echo "\t \n";
echo " \n";
echo " | \n";
echo "\n";
echo "\t\n";
echo "\t\n";
if($Member){
echo "\t\t\n";
if($URL!="http://") {
echo "\t\t\n";
//echo "\t\t\n";
}
// if($ICQ) {
// echo "\t\t\n";
// }
echo "\t\t\n";
}
//}
echo "\t | \n";
echo "\t\n";
// ตรวจสอบการแสดงรูปกราฟฟิกซองจดหมาย
if($icon != "000" ){
if(($Member)&&($Email!=""))
{
switch ($s_mail) {
case "1" : echo "\t\tโดยคุณ $Name \n"; break;
case "2" : echo "\t\tโดยคุณ $Name \n"; break;
default : echo "\t\tโดยคุณ $Name \n";
}
}
elseif($Email!="")
{
// เลือกระบบการส่งอีเมล์
switch ($s_mail)
{
case "1" : echo "\t\tโดยคุณ $Name \n"; break;
case "2" : echo "\t\tโดยคุณ $Name \n"; break;
default : echo "\t\tโดยคุณ $Name \n";
}
}
else {
echo "\t\tโดยคุณ $Name \n";
}
//echo "\t\t$IP\n " ;
//echo "\t\t[$tDate]\n";
//echo "\t | \n";
//echo "\t \n";
}
//เริ่มแก้
elseif(($Member)&&($Email!=""))
{
switch ($s_mail) {
case "1" : echo "\t\tโดยคุณ $Name \n"; break;
case "2" : echo "\t\tโดยคุณ $Name \n"; break;
default : echo "\t\tโดยคุณ $Name \n";
}
}
elseif($Email!="")
{
// เลือกระบบการส่งอีเมล์
switch ($s_mail)
{
case "1" : echo "\t\tโดยคุณ $Name \n"; break;
case "2" : echo "\t\tโดยคุณ $Name \n"; break;
default : echo "\t\tโดยคุณ $Name \n";
}
}
else {
echo "\t\tโดยคุณ $Name \n";
}
echo "\t\t$IP\n " ;
echo "\t\t[$tDate]\n";
echo "\t | \n";
echo "\t \n";
echo " |
\n";
echo "