|
$host = "localhost";
$user = "admin_eplanxxx";
$passwd = "KKR@Eplanxxx346";
$dbname = "admin_eplan2025";
function checkuser($username, $password)
{
$host = "localhost";
$user = "admin_eplanxxx";
$passwd = "KKR@Eplanxxx346";
$dbname = "admin_eplan2025";
$link = mysql_connect($host, $user, $passwd) or die("Unable to Connect");
$sql = "SET NAMES UTF8";
mysql_db_query($dbname, $sql);
$sql = "select curtime() as time_t";
$result = mysql_db_query($dbname, $sql);
$rs = mysql_fetch_array($result);
$time_t = substr($rs['time_t'], 0, 5);
$username = stripslashes($username);
$username = mysql_real_escape_string($username);
$username = htmlspecialchars($username);
$password = stripslashes($password);
$password = mysql_real_escape_string($password);
$password = htmlspecialchars($password);
$sql = "select a.office_id, a.user_name, a.pass_word, b.office_name from user_login a left join officer b on a.office_id = b.office_id where a.user_name = '$username' and a.pass_word = '$password' and b.on_duty = 'T'";
$result = mysql_db_query($dbname, $sql);
$rs = mysql_fetch_array($result);
if ((strlen($rs['user_name']) == 0) || (strlen($rs['pass_word']) == 0)) {
return false;
} else {
return true;
}
mysql_close($link);
}
function nformat($num, $pos)
{
if ($pos == '2') {
$ntmp = number_format($num, 3);
$ntmp = substr($ntmp, 0, strlen($ntmp) - 1);
} else {
$ntmp = number_format($num);
}
if (($ntmp == '0') || ($ntmp == '0.00')) $ntmp = '';
return $ntmp;
}
function n_format($num, $pos)
{
if ($pos == '2') {
$ntmp = number_format($num, 3);
$ntmp = substr($ntmp, 0, strlen($ntmp) - 1);
} else {
$ntmp = number_format($num);
}
if (($ntmp == '0') || ($ntmp == '0.00')) $ntmp = '0.00';
return $ntmp;
}
function shotdate($dtmp)
{
$thaimonth = array("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.");
$yn = substr($dtmp, 0, 4) + 543;
$yn = substr($yn, 2, 2);
$mn = substr($dtmp, 4, 2) - 1;
$dn = substr($dtmp, 6, 2) + 0;
$thaidate = $dn . " " . $thaimonth[$mn] . " " . $yn;
return $thaidate;
}
function shot_date($dtmp)
{
$thaimonth = array("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.");
$yn = substr($dtmp, 0, 4) + 543;
$yn = substr($yn, 2, 2);
$mn = substr($dtmp, 5, 2) - 1;
$dn = substr($dtmp, 8, 2) + 0;
$thaidate = $dn . " " . $thaimonth[$mn] . " " . $yn;
return $thaidate;
}
function birth_date($dtmp)
{
$thaimonth = array("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.");
$yn = substr($dtmp, 0, 4) + 543;
$mn = substr($dtmp, 4, 2) - 1;
$dn = substr($dtmp, 6, 2) + 0;
$thaidate = $dn . " " . $thaimonth[$mn] . " " . $yn;
return $thaidate;
}
function longdate($dtmp)
{
if (strlen($dtmp) > '0') {
$thaimonth = array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
$yn = substr($dtmp, 0, 4) + 543;
$mn = substr($dtmp, 4, 2) - 1;
$dn = substr($dtmp, 6, 2) + 0;
$thaidate = $dn . " เดือน " . $thaimonth[$mn] . " พ.ศ. " . $yn;
} else {
$thaidate = "";
}
return $thaidate;
}
function long_date($dtmp)
{
if (strlen($dtmp) > '0') {
$thaimonth = array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
$yn = substr($dtmp, 0, 4) + 543;
$mn = substr($dtmp, 5, 2) - 1;
$dn = substr($dtmp, 8, 2) + 0;
$thaidate = $dn . " " . $thaimonth[$mn] . " " . $yn;
} else {
$thaidate = "";
}
return $thaidate;
}
function space($n)
{
$area = " ";
for ($i = 1; $i < $n; $i++) {
$area = $area . " ";
}
return $area;
}
Highcharts Example
|