Viewing file: Function.php (3.12 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!-- <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> -->
<?php
// Function ทาง Date,Mate
$ThaiMonth = array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$ThaiSubMonth = array("ม.ค.","ก.พ.","มี.ค.","ม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$Degree = array("ปริญญาตรี","ปริญญาโท","ปริญญาเอก");
/////////////////////////////////// Display Thai Day ///////////////////////////////////
function getThaiMonth()
{
global $ThaiMonth;
for( $i=0; $i<=11; $i++ )
{
$a = $i+1;
if( $a == 1 )
echo"\n\t<option value=\"$a\" selected>$ThaiMonth[$i]</option>\n ";
else
echo"\n\t<option value=\"$a\">$ThaiMonth[$i]</option>\n ";
}
}
/////////////////////////////////////////////////////////////////////////////////
function getThaiSubMonth( $a )
{
global $ThaiSubMonth;
$a = $a -1;
for( $i=0; $i<=11; $i++ )
{
if( $a == $i )
return $a = $ThaiSubMonth[$i];
}
}
///////////////////////////// Display Thai Month ////////////////////////////////////////////////////////////////////////
function getDay1to31()
{
for( $i=1; $i<=31; $i++ )
{
if( $i == 1 )
echo"\n\t<option value=\"$i\" selected>$i</option>\n ";
else
echo"\n\t<option value=\"$i\">$i</option>\n ";
}
}
/////////////////// Display Thai Year ////////////////////////////////////////////////////////////////////
function get2Year()
{
$today = getdate();
$year = $today[year];
for( $x=$year-50; $x<=2010; $x++ )
{
$z = $x+547;
if( $x == ($year+10) )
echo"\n\t<option value=\"$x\" selected>$z</option>\n ";
else
echo"\n\t<option value=\"$x\">$z</option>\n ";
}
}
/////////////////// Display Year ////////////////////////////////////////////////////////////////////
function getYear( $year )
{
return $year = ( $year + 543 );
}
///////////////////////////// Display Degree
function getThaiDegree()
{
global $ThaiMonth;
for( $i=0; $i<=2; $i++ )
{
$a = $i+1;
if( $a == 1 )
echo"\n\t<option value=\"$a\" selected>$Degree[$i]</option>\n ";
else
echo"\n\t<option value=\"$a\">$Degree[$i]</option>\n ";
}
}
//////////////////////////////////////////
function TxtThaiMonth( $a )
{
global $ThaiMonth;
$a = $a -1;
for( $i=0; $i<=11; $i++ )
{
if( $a == $i )
return $a = $ThaiMonth[$i];
}
}
//////////////////* ฟังก์ชั่นตรวจสอบความยาวของสตริง เช่น CheckLenght( $mPassword, 6 ) */
function CheckLenght( $txt , $width )
{
if( strlen( $txt ) >= $width )
return true;
return false;
}
//////////////////////////////* ฟังก์ชั่นตรวจสอบรูปแบบของ Email Address */
function validEmail ( $email )
{
if ( ! eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$", $email ) )
return false;
return true;
}
////////////////* ฟังก์ชั่นตรวจสอบข้อมูลที่นำเข้าว่า เป็นตัวอักษรภาษาอังกฤษ กับ ตัวเลขหรือไม่ */
function CheckEngNumAlpha ( $txt )
{
if ( ! ereg( "[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890]", $txt ) )
return true;
}
?>
|