|
|
|
แก้อย่างไรจะให้บันทึกได้เป็น thai windows แบบ php และเรียกตัวใช้งานเก่าได้อย่างไรและบันทึกในเครื่องแล้วไม่หาย |
|
|
|
|
|
|
|
Code (PHP)
<?php
$dayweek = array(1 => "Sunday",
2 => "Monday",
3 => "Tuesday",
4 => "Wednesday",
5 => "Thursday",
6 => "Friday",
7 => "Satuday");
$dayweekThai = array(1 => "ÇѹÍÒ·ÔµÂì",
2 => "Çѹ¨Ñ¹·Ãì",
3 => "ÇѹÍѧ¤ÒÃ",
4 => "Çѹ¾Ø¸",
5 => "Çѹ¾ÄËÑÊ",
6 => "ÇѹÈØ¡Ãì",
7 => "ÇѹàÊÒÃì");
function showtime($getleveltime) // input
{
switch($getleveltime)
{
case '1' : $showtime ="08:00:00"; break;
case '2' : $showtime ="08:50:00"; break;
case '3' : $showtime ="09:40:00"; break;
case '4' :$showtime ="10:30:00"; break;
case '5' :$showtime ="11:20:00"; break;
case '6' :$showtime ="12:10:00"; break;
case '7' :$showtime ="13:10:00"; break;
case '8' :$showtime ="14:00:00"; break;
case '9' :$showtime ="14:50:00"; break;
case '10' :$showtime ="15:40:00"; break;
case '11' :$showtime ="16:30:00"; break;
case '12' :$showtime ="17:20:00"; break;
case '13' :$showtime ="18:10:00"; break;
case '14' :$showtime ="19:00:00"; break;
case '15' :$showtime ="19:50:00"; break;
}
return $showtime;
}
function timeennrolloff($getleveltime) // input
{
switch($getleveltime)
{
case '1' :$showtime = "08:50:00"; break;
case '2' :$showtime ="09:40:00"; break;
case '3' :$showtime ="10:30:00"; break;
case '4' :$showtime ="11:20:00"; break;
case '5' :$showtime ="12:10:00"; break;
case '6' :$showtime ="13:10:00"; break;
case '7' :$showtime ="14:00:00"; break;
case '8' :$showtime ="14:50:00"; break;
case '9' :$showtime ="15:40:00"; break;
case '10' :$showtime ="16:30:00"; break;
case '11' :$showtime ="17:20:00"; break;
case '12' :$showtime ="18:10:00"; break;
case '13' :$showtime ="19:00:00"; break;
case '14' :$showtime ="19:50:00"; break;
case '15' :$showtime ="20:40:00"; break;
}
return $showtime;
}
Function Datediff($datefrom,$dateto)
{
$startDate = strtotime($datefrom);
$lastDate = strtotime($dateto);
$differnce = $startDate - $lastDate;
// $differnce = ($differnce / (60*60*24)); //???????????????? return ????????????????
return $differnce;
}
function dayofweek($datestr)
{
$datearr = explode("-", $datestr);
$datestamp=mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]);
$date = getdate($datestamp);
$dayofweek = $date["weekday"];
return $dayofweek;
}
//
global $config,$usersess,$comm,$lang,$dataset,$picUpload,$file;
require_once("header.inc");
require_once ("config.inc.php");
require_once ("include/variables.inc.php");
// ??????? ???? ----------------------------------------------------------------------------
require_once ("global.inc.php");
require_once ("include/mysql.inc.php");
require_once("include/myclass/mclasses.inc.php"); // Call my Class
require_once("include/myclass/dataset.inc.php"); // Call Data Base
require_once("include/myclass/components.inc.php"); // Call Data Base
$stuid = $_GET['stuid'];
$classid = $_GET['classid'];
///
$Tstudentid = db_getvar('studentmaster',"STUDENTCODE=$studentid","STUDENTID");
@mysql_connect($host,$user,$pwd); // ?????????
$sql_temp = "
SELECT `enrollitem`.studentid, `enrollitem`.classid, `classtimetable`.WEEKDAY,
`classtimetable`.TIMEPERIODFROM, `classtimetable`.TIMEPERIODTO
FROM db_mscconsule.enrollitem `enrollitem`
INNER JOIN
db_mscconsule.classtimetable `classtimetable`
ON (`enrollitem`.classid = `classtimetable`.CLASSID) ";
$sql_temp .= " where enrollitem.classid ='$classid' and studentid = '$Tstudentid' ";
$result=mysql_db_query($dbname,$sql_temp);
$NRow=mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$WEEKDAY = $row["WEEKDAY"] ;
$TIMEPERIODFROM = $row["TIMEPERIODFROM"] ;
$TIMEPERIODTO = $row["TIMEPERIODTO"] ;
}
$TIMEstart = showtime($TIMEPERIODFROM);
$TIMEend = showtime($TIMEPERIODTO);
echo "<TABLE align=center cellSpacing=0 cellPadding=0 width=98% border=0 bgcolor=#686898>";
echo "<TR><TD> <font color=#FFFFFF><b>??????????? :$dayweekThai[$WEEKDAY] </b></Font> </TD></TR> ";
echo "<TR><TD> <font color=#FFFFFF><b>??????????? ?????? :$TIMEPERIODFROM : ???? [$TIMEstart] </b></Font> </TD></TR> ";
echo "<TR><TD> <font color=#FFFFFF><b>?????????? ?????? :$TIMEPERIODTO : ???? [$TIMEend] </b></Font> </TD></TR> ";
// ????????????
@mysql_connect($host,$user,$pwd);
$sql = "
SELECT `userinfo`.studentid, `checkinout`.CHECKTIME
FROM db_mscconsule.userinfo `userinfo`
INNER JOIN
db_mscconsule.checkinout `checkinout`
ON (`userinfo`.USERID = `checkinout`.USERID) ";
$sql .= " where studentid ='$studentid' order by CHECKTIME asc ";
mysql_query("SET NAMES TIS620");
$result=mysql_db_query($dbname,$sql);
$NRow=mysql_num_rows($result);
// ????????
echo "<TABLE align=center cellSpacing=0 cellPadding=0 width=98% border=0 bgcolor=#000000>";
echo "<TR><TD>";
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1 align='center'>";
echo "<tr bgcolor=#686898>";
echo "<td align=center width=9%><font color=#FFFFFF><b>ÃËÑÊÇÔªÒ</b></font></td>\n";
echo "<td align=center width=15%><font color=#FFFFFF><b>ª×èÍÇÔªÒ</b></font></td>\n";
echo "<td align=center width=15%><font color=#FFFFFF><b>??????</b></font></td>\n";
echo "<td align=center width=15%><font color=#FFFFFF><b>????????</b></font></td>\n";
echo "<td align=center width=25%><font color=#FFFFFF><b>????????</b> </font></td>\n";
echo "</tr>\n\n";
$n = 1;
while ($row = mysql_fetch_array($result)) {
$bgc = ($bgc=="#FAF2E6") ? "#FFFFCC" : "#FAF2E6";
$No = sprintf("%05d",$n);
$Day = trim(substr($row["CHECKTIME"],0,10)); // ??????????????
$time = trim(substr($row["CHECKTIME"],11,10)); // ??????????????
//$Name = $row["COURSENAME"];
$Reply = $row["Reply"];
// ??????????????????
#$ReplyDate = substr($row["ReplyDate"],0,11); // ????????????
//$dayofweek = date( 'w', $row["CHECKTIME"]);
$Mdayofweek = dayofweek($Day);
if ($dayweek[$WEEKDAY] == $Mdayofweek ) {
$n = $n +1;
// check ??????
// check ???????
echo "<tr bgColor=$bgc><td><center><a href='showtable.php'>",$No,"</a></center></td>";
echo "<td><center>",$Day,"</center></td>";
echo "<td><center>[$time]<center></td>"; // ???????
echo "<td><center>[$time]<center></td>"; // ????????
$Caclutime = Datediff($time,$TIMEstart); // ???? ??
$mCac = $Caclutime/60; // ???????????? // ????? ? 15 ?????????????????? ???????
if( $mCac <= 15 )
{
$note = "???????? ".$mCac.'????';
} elseif ( $mCac >= 30 )
{
$note = "??? ??????????????? 30 ??????????? ".$mCac.'????';
}
echo "<td><center>$note<center></td></TR>";
}
}
echo "</table>\n";
echo "</TD></TR>\n";
echo "</TABLE>\n";
?>
Tag : PHP
|
|
|
|
|
|
Date :
2011-04-21 10:31:40 |
By :
ย๊ะ |
View :
742 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้า convert เป็น ??? ไปแล้วก็เสียใจด้วยครับ ผมเคยพยายามมาแล้ว หาทางไม่เจอ ต้องพิมพ์ใหม่
|
|
|
|
|
Date :
2011-04-21 11:43:18 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|