$db=mysql_connect ("192.168.63.192", "bectero", "Ananhuhu") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("bectero");
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_unicode_ci');
mysql_query('SET NAMES utf8');
?>
function dteNow() {
$dteToday = date("Y-m-d H:i:s");
//$dteToday = date("Y-m-d H:i:s",mktime (date("H")+14, date("i"), date("s"), date("m"), date("d"), date("Y")));
$dteNow = $dteToday;
return $dteNow;
}
function TodayDate(){
$dteToday = getdate();
$strToDay = $dteToday["mon"]."/".$dteToday["mday"]."/".$dteToday["year"];
$TodayDate = $strToDay;
return $TodayDate;
}
function RLDateFormat($str_date , $strFormat, $int_lang){
//Display on Document
if ($str_date != ""){
$arr_zero = array("0","0","");
$dte=strpos($str_date," ");
if ($dte != 0) {
$dte=substr($str_date, 0,$dte);
$time=strrpos($str_date," ");
$time=substr($str_date, $time);
list($year, $month, $day) = explode("-", $dte);
list($hour, $minutes, $seconds) = explode(":", $time);
}else{
$dte=$str_date;
list($year, $month, $day) = explode("-", $dte);
}
$int_year_date = $year;
if ($int_lang == 1){
$arr_month = array("Jan","Feb","Mar", "Apr" , "May" , "Jun" , "Jul" , "Aug" , "Sep", "Oct" , "Nov","Dec");
$arr_fullmonth = array("January","February","March", "April" , "May" , "June" , "July" , "August" , "September", "October" , "November","December");
}else{
$arr_month = array("..","..","..", ".." , ".." , ".." , ".." , ".." , "..", ".." , "..","..") ;
$arr_fullmonth = array("Ҥ","Ҿѹ","չҤ", "¹" , "Ҥ" , "Զع¹" , "áҤ" , "ԧҤ" , "ѹ¹", "Ҥ" , "Ȩԡ¹","ѹҤ");
$int_year_date = $int_year_date + 543;
}
switch ($strFormat){
case "md,yyyy" :
$strDateFormat = $arr_month[$month - 1]." ". $day.", ".$int_year_date;
break;
case "d/m/yy" :
$strDateFormat = $day."/".$arr_month[$month - 1]."/".substr($int_year_date,-2);
break;
case "d/m/yyyy" :
$strDateFormat = $day."/".$month."/".$year;
break;
case "d/m/y" :
$strDateFormat = $arr_zero[strlen(strval($day))].$day."/".$arr_zero[strlen(strval($month))].$month."/".substr($int_year_date,-2);
break;
case "d.m.y" :
$strDateFormat = $arr_zero[strlen(strval($day))].$day.".".$arr_zero[strlen(strval($month))].$month.".".substr($int_year_date,-2);
break;
case "dmyy" :
$strDateFormat = $day." ".$arr_month[$month-1]." ".substr($int_year_date,-2);
break;
case "dmyyyy" :
$strDateFormat = $day." ".$arr_month[$month-1]." ".$int_year_date;
break;
case "dm" :
$strDateFormat = $arr_zero[strlen(strval($day))].$day.".".$arr_zero[strlen(strval($month))].$month;
break;
case "d" :
$strDateFormat = $arr_zero[strlen(strval($day))].$day;
break;
case "yyyy" :
$strDateFormat = $year;
break;
case "dmmyyyy(h:m)" :
$strDateFormat = $day." ".$arr_fullmonth[$month - 1]." ".$int_year_date." (" . $hour. ":" . $arr_zero[strlen(strval($minute))].$minute. ")";
break;
case "d/m/y-hh:mm" :
$strDateFormat = $arr_zero[strlen(strval($day))].$day."/".$arr_zero[strlen(strval($month))].$month."/".substr($int_year_date,-2)." - ".$hour.":".$arr_zero[strlen(strval($minute))].$minute;
break;
case "d/m/y-hh:mmAM" :
//If hour(str_date) >
$intHour = $hour;
if (($intHour >= 0) && ($intHour < 12)) {
$strAMPM = "AM";
}else{
$intHour = $intHour - 12;
$strAMPM = "PM";
}
$strDateFormat = $arr_zero[strlen(strval($day))].$day."/".$arr_zero[strlen(strval($month))].$month."/".substr($int_year_date,-2)." - ".$arr_zero[strlen(strval($intHour))].$intHour& ":".$arr_zero[strlen(strval($minute))].$minute." ".$strAMPM;
break;
case "dmmyy" :
$strDateFormat = $day." ".$arr_fullmonth[$month - 1]." ".substr($int_year_date,-2);
break;
case "dmmyyyy" :
$strDateFormat = $day." ".$arr_fullmonth[$month - 1]." ".$int_year_date;
break;
case "d/mm/yyyy" :
$strDateFormat = $day."/".$arr_month[$month-1]."/".$int_year_date;
break;
default :
$strDateFormat = $arr_zero[strlen(strval($day))].$day."/".$arr_month[$month-1]."/".substr($int_year_date,-2);
}
}else{
$strDateFormat = "- ";
}
$RLDateFormat = $strDateFormat;
return $RLDateFormat;
}
function StrToDateSerial($dte_date){
if (trim($dte_date) == "" ){
$dte_temp = "";
}else{
$dte_temp = $dte_date;
$arr_date_part = split("-", $dte_temp);
$dte_temp = date("Y-m-d", mktime(0, 0, 0, intval(trim($arr_date_part[1])) ,intval(trim($arr_date_part[0])), intval(trim($arr_date_part[2]))) );
}
$StrToDateSerial = $dte_temp;
return $StrToDateSerial;
}
function StrToDateSerial_3($dte_date){
if (trim($dte_date) == "" ){
$dte_temp = "";
}else{
$dte_temp = $dte_date;
$arr_date_part = split("/", $dte_temp);
$dte_temp = date("Y-m-d", mktime(0, 0, 0, intval(trim($arr_date_part[1])) ,intval(trim($arr_date_part[0])), intval(trim($arr_date_part[2]))) );
}
$StrToDateSerial = $dte_temp;
return $StrToDateSerial;
}
function DateFormat($str_date , $int_lang){
//Display on Document
if ($str_date != "") {
$dte=strpos($str_date," ");
if ($dte != 0) {
$dte=substr($str_date, 0,$dte);
$time=strrpos($str_date," ");
$time=substr($str_date, $time);
list($year, $month, $day) = explode("-", $dte);
list($hour, $minutes, $seconds) = explode(":", $time);
}else{
$dte=$str_date;
list($year, $month, $day) = explode("-", $dte);
}
if ($int_lang == 1) {
$arr_month = array("Jan","Feb","Mar", "Apr" , "May" , "Jun" , "Jul" , "Aug" , "Sep", "Oct" , "Nov","Dec");
}else{
$arr_month = array("..","..","..", ".." , ".." , ".." , ".." , ".." , "..", ".." , "..","..") ;
}
$arr_zero = array("0","");
$int_year_date = $year;
if ($int_lang == 1) {
$int_year_date = $int_year_date;
$DateFormat = $arr_zero[strlen(strval($day))].$day."/".$arr_month[$month-1]."/".substr($int_year_date,-2);
}else{
$int_year_date = $int_year_date + 543;
$DateFormat = $arr_zero[strlen(strval($day))].$day." ".$arr_month[$month-1]." ".substr($int_year_date,-2);
}
}else{
$DateFormat = "-";
}
return $DateFormat;
}
function DateValueFormat($str_date){
$dte=strpos($str_date," ");
if ($dte != 0) {
$dte=substr($str_date, 0,$dte);
$time=strrpos($str_date," ");
$time=substr($str_date, $time);
list($year, $month, $day) = explode("-", $dte);
list($hour, $minutes, $seconds) = explode(":", $time);
}else{
$dte=$str_date;
list($year, $month, $day) = explode("-", $dte);
}
$arr_zero = array("0","");
$DateValueFormat = $day."-".$month."-". $year;
return $DateValueFormat;
}
function DateValueFormat_3($str_date){
$dte=strpos($str_date," ");
if ($dte != 0) {
$dte=substr($str_date, 0,$dte);
$time=strrpos($str_date," ");
$time=substr($str_date, $time);
list($year, $month, $day) = explode("-", $dte);
list($hour, $minutes, $seconds) = explode(":", $time);
}else{
$dte=$str_date;
list($year, $month, $day) = explode("-", $dte);
}
$arr_zero = array("0","");
$DateValueFormat3 = $day."/".$month."/". $year;
return $DateValueFormat3;
}
function getDayOfMonth( $int_month, $int_year ){
$DOMonth = array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
$LDOMonth = array( 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ( ($int_year % 4) == 0 ) {
if ( ($int_year % 100 == 0) && ($int_year % 400 != 0) ){
$getDayOfMonth = $DOMonth[$int_month-1];
}
$getDayOfMonth = $LDOMonth[$int_month-1];
}else{
$getDayOfMonth = $DOMonth[$int_month-1];
}
return $getDayOfMonth;
}
function getDateTime($intDay, $intMonth, $intYear, $intHour, $intMinute, $strPeriod){
$strDateTime = $intMonth."/".$intDay."/".$intYear." ".$intHour.":".$intMinute.":00 ".$strPeriod;
$getDateTime = $strDateTime;
return $getDateTime;
}
?>
function genPageNumber($strUrl, $intPage, $intTotalPage, $intTotalRow, $bitSelectAll , $intPagePerOnce){
$strPage = "";
$intPage = intval($intPage);
//------- Set << mark ------
if ($bitSelectAll==true) {
$strPage = "Showing All [Total ".$intTotalRow."]";
echo $strPage;
}else{
//--- Page per Once ---
$intTotalRange = floor(intval( $intTotalPage / $intPagePerOnce ));
if (($intTotalPage % $intPagePerOnce) > 0) { $intTotalRange = $intTotalRange + 1;}
$intCurrentRange = floor(intval( $intPage / $intPagePerOnce ));
if (($intPage % $intPagePerOnce) > 0) { $intCurrentRange = $intCurrentRange + 1;}
if ($intCurrentRange <= 0) { $intCurrentRange = 1;}
$intStartPage = (( $intCurrentRange - 1 ) * $intPagePerOnce ) + 1;
$intEndPage = $intStartPage + $intPagePerOnce - 1;
//--- [Next Page Number] ---
$intNextFromPage = $intEndPage + 1;
$intNextToPage = $intNextFromPage + $intPagePerOnce - 1;
if ($intNextToPage > $intTotalPage) { $intNextToPage = $intTotalPage;}
//--- [Previous Page Number] ---
$intPrevFromPage =$intStartPage - $intPagePerOnce;
$intPrevToPage = $intPrevFromPage + $intPagePerOnce - 1;
$intParamPosition = strpos($strUrl, "?");
if ($intParamPosition > 0) {
$strParamSymbol = "&";
}else{
$strParamSymbol = "?";
}
if ($intCurrentRange > 1 ) {
$strPageNumber = "<< ". $intPrevFromPage."-".$intPrevToPage." | ";
}
for ($iPage = $intStartPage; $iPage<=$intEndPage; $iPage++){
if ($intTotalPage >= $iPage) {
$strPageLink = "".$iPage." ";
$strPageNumber = $strPageNumber.$strPageLink." | ";
}
}
if ( $intTotalRange > 1 ) {
if ($intCurrentRange < $intTotalRange) {
//------- Set >> mark ------
if ($intNextFromPage < $intNextToPage) {
$strToPage = $intNextFromPage."-".$intNextToPage;
}else{
$strToPage = $intNextFromPage;
}
$strPageNumber = $strPageNumber."".$strToPage." >> ";
}
}
if ($intTotalPage > 1) {
//--- show page number ---
$strPageNumber = $strPageNumber." [Show All ] ";
}else{
$strPageNumber = "";
}
$strPage = "Page ".$intPage." of ".$intTotalPage." [Total ".$intTotalRow."] ".$strPageNumber;
}
$genPageNumber = $strPage;
return $genPageNumber;
}
function genPageNumber2($strUrl, $intPage, $intTotalPage, $intTotalRow, $bitSelectAll , $intPagePerOnce){
$strPage = "";
$intPage = intval($intPage);
//------- Set << mark ------
if ($bitSelectAll==true) {
$strPage = "Showing All [Total ".$intTotalRow."]";
echo $strPage;
}else{
//--- Page per Once ---
$intTotalRange = floor(intval( $intTotalPage / $intPagePerOnce ));
if (($intTotalPage % $intPagePerOnce) > 0) { $intTotalRange = $intTotalRange + 1;}
$intCurrentRange = floor(intval( $intPage / $intPagePerOnce ));
if (($intPage % $intPagePerOnce) > 0) { $intCurrentRange = $intCurrentRange + 1;}
if ($intCurrentRange <= 0) { $intCurrentRange = 1;}
$intStartPage = (( $intCurrentRange - 1 ) * $intPagePerOnce ) + 1;
$intEndPage = $intStartPage + $intPagePerOnce - 1;
//--- [Next Page Number] ---
$intNextFromPage = $intEndPage + 1;
$intNextToPage = $intNextFromPage + $intPagePerOnce - 1;
if ($intNextToPage > $intTotalPage) { $intNextToPage = $intTotalPage;}
//--- [Previous Page Number] ---
$intPrevFromPage =$intStartPage - $intPagePerOnce;
$intPrevToPage = $intPrevFromPage + $intPagePerOnce - 1;
$intParamPosition = strpos($strUrl, "?");
if ($intParamPosition > 0) {
$strParamSymbol = "&";
}else{
$strParamSymbol = "?";
}
if ($intCurrentRange > 1 ) {
$strPageNumber = "<< ". $intPrevFromPage."-".$intPrevToPage." | ";
}
for ($iPage = $intStartPage; $iPage<=$intEndPage; $iPage++){
if ($intTotalPage >= $iPage) {
$strPageLink = "".$iPage." ";
$strPageNumber = $strPageNumber.$strPageLink." | ";
}
}
if ( $intTotalRange > 1 ) {
if ($intCurrentRange < $intTotalRange) {
//------- Set >> mark ------
if ($intNextFromPage < $intNextToPage) {
$strToPage = $intNextFromPage."-".$intNextToPage;
}else{
$strToPage = $intNextFromPage;
}
$strPageNumber = $strPageNumber."".$strToPage." >> ";
}
}
if ($intTotalPage > 1) {
//--- show page number ---
$strPageNumber = $strPageNumber." [Show All ] ";
}else{
$strPageNumber = "";
}
$strPage = "Page ".$intPage." of ".$intTotalPage." [Total ".$intTotalRow."] ".$strPageNumber;
}
$genPageNumber = $strPage;
return $genPageNumber;
}
function genPageNumberAjax($strUrl, $intPage, $intTotalPage, $intTotalRow, $bitSelectAll , $intPagePerOnce, $strFunction){
$strPage = "";
$intPage = intval($intPage);
//------- Set << mark ------
if ($bitSelectAll==true) {
$strPage = "Show All [".$intTotalRow." Records]";
echo $strPage;
}else{
//--- Page per Once ---
$intTotalRange = floor(intval( $intTotalPage / $intPagePerOnce ));
if (($intTotalPage % $intPagePerOnce) > 0) { $intTotalRange = $intTotalRange + 1;}
$intCurrentRange = floor(intval( $intPage / $intPagePerOnce ));
if (($intPage % $intPagePerOnce) > 0) { $intCurrentRange = $intCurrentRange + 1;}
if ($intCurrentRange <= 0) { $intCurrentRange = 1;}
$intStartPage = (( $intCurrentRange - 1 ) * $intPagePerOnce ) + 1;
$intEndPage = $intStartPage + $intPagePerOnce - 1;
//--- [Next Page Number] ---
$intNextFromPage = $intEndPage + 1;
$intNextToPage = $intNextFromPage + $intPagePerOnce - 1;
if ($intNextToPage > $intTotalPage) { $intNextToPage = $intTotalPage;}
//--- [Previous Page Number] ---
$intPrevFromPage =$intStartPage - $intPagePerOnce;
$intPrevToPage = $intPrevFromPage + $intPagePerOnce - 1;
$intParamPosition = strpos($strUrl, "?");
if ($intParamPosition > 0) {
$strParamSymbol = "&";
}else{
$strParamSymbol = "?";
}
if ($intCurrentRange > 1 ) {
$strPageNumber = "<< ". $intPrevFromPage."-".$intPrevToPage." | ";
}
for ($iPage = $intStartPage; $iPage<=$intEndPage; $iPage++){
if ($intTotalPage >= $iPage) {
$strPageLink = "".$iPage." ";
$strPageNumber = $strPageNumber.$strPageLink." | ";
}
}
if ( $intTotalRange > 1 ) {
if ($intCurrentRange < $intTotalRange) {
//------- Set >> mark ------
if ($intNextFromPage < $intNextToPage) {
$strToPage = $intNextFromPage."-".$intNextToPage;
}else{
$strToPage = $intNextFromPage;
}
$strPageNumber = $strPageNumber."".$strToPage." >> ";
}
}
if ($intTotalPage > 1) {
//--- show page number ---
$strPageNumber = $strPageNumber." [Show All ] ";
}else{
$strPageNumber = "";
}
$strPage = "Page ".$intPage." of ".$intTotalPage." [Total ".$intTotalRow."] ".$strPageNumber;
}
//End If
$genPageNumberAjax = $strPage;
return $genPageNumberAjax;
}
function genPageNumberBox($strUrl, $intPage, $intTotalPage, $intTotalRow, $bitSelectAll){
$strPage = "";
$strHidden = "";
$intPage = intval($intPage);
//------- Set << mark ------
if ($bitSelectAll==true) {
$strPage = "
Showing All [Total ".($intTotalRow+1)."]
";
}else{
$intStartPage = 1;
$intEndPage = $intTotalPage;
$intParamPosition = strpos($strUrl, "?");
if ($intParamPosition > 0) {
$strParamSymbol = "&";
//-----Generate hidden input -----
$strTemp = substr(strUrl, intParamPosition + 1);
$strTemp = split("&", $strTemp);
for ($i=0;$i";
}
}else{
$strParamSymbol = "?";
}
$strPageNumber = "Page ";
$strPageNumber .= " ";
if ($intPage == $intStartPage) {
$strPageNumber .= " ";
}else{
$strPageNumber .= " ";
}
$strPageNumber .= " ";
$strPageNumber .= "".$intPage." of ".$intTotalPage." ";
$strPageNumber .= " ";
if ($intPage == $intEndPage) {
$strPageNumber .= " ";
}else{
$strPageNumber .= " ";
}
$strPageNumber .= " ";
if ($intTotalPage == 1) {
$strPageNumber .= "[ Show All ] ";
}else{
$strPageNumber .= "[ Show All ] ";
}
$strPageNumber .= " ";
?>
if ($intTotalPage == 1) {
$strPage = "";
}else{
$strPage = "";
}
}
$genPageNumberBox = $strPage;
return $genPageNumberBox;
}
?>
- Green Day Live In Bangkok : http://greenday.bectero.com