/** * 전화번호 */ function SetTelFormat(obj) { val = obj.value; if(val.length < 8) { obj.value = ""; obj.focus(); alert("올바른 전화번호를 입력하세요."); return false; } str = ""; for(i=0; i
/************************************************ PHP Ver 5.1 이상일때 타임존 버그 해결. ************************************************/ $date_area = $date_area?$date_area:"Asia/Seoul"; if(function_exists("date_default_timezone_set")) { @date_default_timezone_set($date_area); } function datetimeFunc() { return true; } /** * 시간포맷 년월일시분초 */ function GetDatetime($format='Y-m-d H:i:s',$unixtime = '') { if(!d..
//Trim function trim(val,optval) { if(optval == "compress") { val = val.replace(/\s+/g, ""); }else if(optval == "trim") { val= val.replace(/^\s+/, "").replace(/\s+$/, ""); }else if(optval == "rtrim") { val = val.replace(/\s+$/, ""); }else if(optval == "ltrim") { val = val.replace(/^\s+/, ""); }else { val= val.replace(/^\s+/, "").replace(/\s+$/, ""); } return val; }
/****************************** scandir() : php5에서 디렉토리 목록 반환 ******************************/ if(function_exists("scandir") == false) { function scandir($d,$o = 0) { if(!is_dir($d)) { return false; } $arr = Array(); if ($dh = opendir($d)) { while (($e = readdir($dh)) !== false) { $arr[] = $e; } closedir($dh); } if($o == 1) { return rsort($arr,SORT_STRING); } return sort($arr,SORT_STRING);; } }
5.X 버전 select Auto_increment from information_schema.tables where table_schema = '[db_name]' and table_name = '[table_name]' 4.X 버전 이상 show table status from [db_name] like '[table_name]'; 초기화 데이터가 있을때 alter table [table_name] auto_increment = 1; 없을때. truncate table [table_name];
/************************************************ 퍼센트 ************************************************/ function GetPercent($val,$total) { if($val) { return ($val/$total)*100; }else { return 0; } } /************************************************ 전체 값에서 퍼센트에 해당하는 값을 뺀 값 ************************************************/ function GetDepercentRemain($per,$total) { return $total-(($per/100)*$total)..