\n"; echo "\n"; print_r($str); echo "\n\n"; echo ""; return true; } return false; } /*---------------------------------------- pageing function & mysql limit function -----------------------------------------*/ function page_index($total,$p=1,$link="",$rownum=20,$scale=10,$prev_section_img = "" ,$next_section_img = "" ,$prev_img = "" ,$next_img = "", $first_img = "", $last_img = "", $outside_using="N") { //페이지가 없으면 첫페이지 if(empty($p)) $p = 1; $orig_page = $p; //$total이 없으면 1 if(empty($total) or $total <= 0){ $total = 1; } $link = str_replace("&&","&",$link); if(substr($link,0,1) == "&") $link = substr($link,1); //filename 없으면 자기자신 $filename=$_SERVER['PHP_SELF']; $total_page = @ceil( $total / $rownum ) ; $total_zone = ceil($total_page/$scale); // 총 블럭 수 $zone = ceil($p/$scale); //현재 블럭 $first_page = ($zone -1) * $scale; $last_page = $zone * $scale; if($total_zone <= $zone) { $last_page = $total_page; } //img 처리 if(empty($prev_section_img)) $prev_section_img ="";//"◀"; else $prev_section_img = " 이전블럭 "; if(empty($next_section_img)) $next_section_img ="";//"▶"; else $next_section_img = " 다음블럭 "; if(empty($prev_img)) $prev_img ="◀"; else $prev_img = " 이전 "; if(empty($next_img)) $next_img ="▶"; else $next_img = " 다음 "; if(empty($first_img)) $first_img = "1"; else $first_img = " "; if(empty($last_img)) $last_img = "".$total_page.""; else $last_img = " "; # 처음 페이지 링크 if ($orig_page > 1) { $f_first_page = "FIRST"; } else { $f_first_page = "FIRST"; } # 마지막 페이지 링크 if ($orig_page < $total_page) { $l_last_page = "LAST"; } else { $l_last_page = "LAST"; } //이전페이지 링크 if($orig_page > 1){ $p = $orig_page - 1 ; $pre_page ="
  • "; }else{ $pre_page = "
  • "; } //다음 페이지 링크 if($orig_page < $total_page){ $p = $orig_page + 1 ; $next_page ="
  • "; }else{ $next_page = "
  • "; } //이전블록에 대한 링크 if($zone > 1){ $p = $first_page; $p_zone = ""; }else{ $p_zone = ""; }; //다음블록에 대한 링크 if($zone < $total_zone){ $p = $last_page + 1; $n_zone =""; }else{ $n_zone = ""; } //각페이지로 이동 링크 for($page_link = $first_page+1 ; $page_link <= $last_page; $page_link++){ if($orig_page == $page_link){ $this_page .= "
  • $page_link
  • "; }else{ $this_page .="
  • $page_link
  • "; } //if($page_link < $last_page) $this_page .= "I"; } if ($outside_using == "N") { //$f_first_page = ""; //$l_last_page = ""; } else { //$f_first_page = $f_first_page . " ... "; //$l_last_page = " ... " . $l_last_page; } //$page_index = $f_first_page . $p_zone." ".$pre_page." ".$this_page." ".$next_page." ".$n_zone . $l_last_page; $page_index = $pre_page.$this_page.$next_page; return $page_index; } function page_index_cate($total,$p=1,$link="",$rownum=20,$scale=10,$prev_section_img = "" ,$next_section_img = "" ,$prev_img = "" ,$next_img = "", $first_img = "", $last_img = "", $outside_using="N") { //페이지가 없으면 첫페이지 if(empty($p)) $p = 1; $orig_page = $p; //$total이 없으면 1 if(empty($total) or $total <= 0){ $total = 1; } $link = str_replace("&&","&",$link); if(substr($link,0,1) == "&") $link = substr($link,1); //filename 없으면 자기자신 $filename=$_SERVER['PHP_SELF']; $total_page = @ceil( $total / $rownum ) ; $total_zone = ceil($total_page/$scale); // 총 블럭 수 $zone = ceil($p/$scale); //현재 블럭 $first_page = ($zone -1) * $scale; $last_page = $zone * $scale; if($total_zone <= $zone) { $last_page = $total_page; } //img 처리 if(empty($prev_section_img)) $prev_section_img ="";//"◀"; else $prev_section_img = " 이전블럭 "; if(empty($next_section_img)) $next_section_img ="";//"▶"; else $next_section_img = " 다음블럭 "; if(empty($prev_img)) $prev_img ="◀"; else $prev_img = " 이전 "; if(empty($next_img)) $next_img ="▶"; else $next_img = " 다음 "; if(empty($first_img)) $first_img = "1"; else $first_img = " "; if(empty($last_img)) $last_img = "".$total_page.""; else $last_img = " "; # 처음 페이지 링크 if ($orig_page > 1) { $f_first_page = "FIRST"; } else { $f_first_page = "FIRST"; } # 마지막 페이지 링크 if ($orig_page < $total_page) { $l_last_page = "LAST"; } else { $l_last_page = "LAST"; } //이전페이지 링크 if($orig_page > 1){ $p = $orig_page - 1 ; $pre_page ="
  • Prev
  • "; }else{ $pre_page = "
  • Prev
  • "; } //다음 페이지 링크 if($orig_page < $total_page){ $p = $orig_page + 1 ; $next_page ="
  • Next
  • "; }else{ $next_page = "
  • Next
  • "; } //이전블록에 대한 링크 /*if($zone > 1){ $p = $first_page; $p_zone = "$prev_section_img"; }else{ $p_zone =$prev_section_img; };*/ //다음블록에 대한 링크 /*if($zone < $total_zone){ $p = $last_page + 1; $n_zone ="$next_section_img"; }else{ $n_zone =$next_section_img; }*/ //각페이지로 이동 링크 for($page_link = $first_page+1 ; $page_link <= $last_page; $page_link++){ if($orig_page == $page_link){ $this_page .= "
  • $page_link
  • "; }else{ $this_page .="
  • $page_link
  • "; } //if($page_link < $last_page) $this_page .= "I"; } if ($outside_using == "N") { //$f_first_page = ""; //$l_last_page = ""; } else { //$f_first_page = $f_first_page . " ... "; //$l_last_page = " ... " . $l_last_page; } //$page_index = $f_first_page . $p_zone." ".$pre_page." ".$this_page." ".$next_page." ".$n_zone . $l_last_page; $page_index = $pre_page.$this_page.$next_page; return $page_index; } function page_index1($total,$p=1,$link="",$rownum=20,$scale=10,$prev_section_img = "" ,$next_section_img = "" ,$prev_img = "" ,$next_img = "", $first_img = "", $last_img = "", $outside_using="N") { //페이지가 없으면 첫페이지 if(empty($p)) $p = 1; $orig_page = $p; //$total이 없으면 1 if(empty($total) or $total <= 0){ $total = 1; } $link = str_replace("&&","&",$link); if(substr($link,0,1) == "&") $link = substr($link,1); //filename 없으면 자기자신 $filename=$_SERVER['PHP_SELF']; $total_page = @ceil( $total / $rownum ) ; $total_zone = ceil($total_page/$scale); // 총 블럭 수 $zone = ceil($p/$scale); //현재 블럭 $first_page = ($zone -1) * $scale; $last_page = $zone * $scale; if($total_zone <= $zone) { $last_page = $total_page; } # 처음 페이지 링크 if ($orig_page > 1) { $f_first_page = "
    FIRST"; } else { $f_first_page = "
    FIRST"; } # 마지막 페이지 링크 if ($orig_page < $total_page) { $l_last_page = "LAST
    "; } else { $l_last_page = "LAST
    "; } //이전페이지 링크 if($orig_page > 1){ $p = $orig_page - 1 ; $pre_page ="< PREV"; }else{ $pre_page = "< PREV"; } //다음 페이지 링크 if($orig_page < $total_page){ $p = $orig_page + 1 ; $next_page ="
    NEXT >"; }else{ $next_page = "
    NEXT >"; } /* //이전블록에 대한 링크 if($zone > 1){ $p = $first_page; $p_zone = "$prev_section_img"; }else{ $p_zone =$prev_section_img; }; //다음블록에 대한 링크 if($zone < $total_zone){ $p = $last_page + 1; $n_zone ="$next_section_img"; }else{ $n_zone =$next_section_img; } */ //각페이지로 이동 링크 $this_page = "
    "; for($page_link = $first_page+1 ; $page_link <= $last_page; $page_link++){ if($orig_page == $page_link){ $this_page .= "$page_link"; }else{ $this_page .="$page_link"; } //if($page_link < $last_page) $this_page .= "I"; } $this_page .= "
    "; /*if ($outside_using == "N") { $f_first_page = ""; $l_last_page = ""; } else { //$f_first_page = ""; //$l_last_page = ""; $f_first_page = $f_first_page; $l_last_page = $l_last_page; }*/ //$page_index = $f_first_page . $p_zone." ".$pre_page." ".$this_page." ".$next_page." ".$n_zone . $l_last_page; $page_index = $f_first_page.$pre_page.$this_page.$next_page.$l_last_page; return $page_index; } function page_index_c($b_class,$target,$cate,$total,$p=1,$link="",$rownum=20,$scale=10,$prev_section_img = "" ,$next_section_img = "" ,$prev_img = "" ,$next_img = "", $first_img = "", $last_img = "", $outside_using="N") { //페이지가 없으면 첫페이지 if(empty($p)) $p = 1; $orig_page = $p; //$total이 없으면 1 if(empty($total) or $total <= 0){ $total = 1; } $link = str_replace("&&","&",$link); if(substr($link,0,1) == "&") $link = substr($link,1); //filename 없으면 자기자신 $filename=$_SERVER['PHP_SELF']; $total_page = @ceil( $total / $rownum ) ; $total_zone = ceil($total_page/$scale); // 총 블럭 수 $zone = ceil($p/$scale); //현재 블럭 $first_page = ($zone -1) * $scale; $last_page = $zone * $scale; if($total_zone <= $zone) { $last_page = $total_page; } //img 처리 /* if(empty($prev_section_img)) $prev_section_img ="";//"◀"; else $prev_section_img = " 이전블럭 "; if(empty($next_section_img)) $next_section_img ="";//"▶"; else $next_section_img = " 다음블럭 "; */ // if(empty($prev_img)) $prev_img ="◀"; // else $prev_img = " 이전 "; // // if(empty($next_img)) $next_img ="▶"; // else $next_img = " 다음 "; /* if(empty($first_img)) $first_img = "1"; else $first_img = " "; if(empty($last_img)) $last_img = "".$total_page.""; else $last_img = " "; */ # 처음 페이지 링크 //board(bc,bn,md,p) /* if ($orig_page > 1) { //$f_first_page = "{$first_img}"; $f_first_page = "{$first_img}"; } else { $f_first_page = "".$first_img.""; } # 마지막 페이지 링크 if ($orig_page < $total_page) { //$l_last_page = "{$last_img}"; $l_last_page = "{$last_img}"; } else { $l_last_page = "".$last_img.""; } */ //이전페이지 링크 if($orig_page > 1){ $p = $orig_page - 1 ; //$pre_page ="$prev_img"; $pre_page ="
    "; }else{ $pre_page = "
    "; } //다음 페이지 링크 if($orig_page < $total_page){ $p = $orig_page + 1 ; //$next_page ="$next_img"; $next_page ="
    "; }else{ $next_page = "
    "; } /* //이전블록에 대한 링크 if($zone > 1){ $p = $first_page; $p_zone = "$prev_section_img"; }else{ $p_zone =$prev_section_img; }; //다음블록에 대한 링크 if($zone < $total_zone){ $p = $last_page + 1; $n_zone ="$next_section_img"; }else{ $n_zone =$next_section_img; } */ //각페이지로 이동 링크 /* for($page_link = $first_page+1 ; $page_link <= $last_page; $page_link++){ if($orig_page == $page_link){ $this_page .= " $page_link "; }else{ //$this_page .=" $page_link "; $this_page .=" $page_link "; } if($page_link < $last_page) $this_page .= "I"; } if ($outside_using == "N") { $f_first_page = ""; $l_last_page = ""; } else { $f_first_page = $f_first_page . " ... "; $l_last_page = " ... " . $l_last_page; } */ $page_index = $pre_page.$next_page; return $page_index; } function page_index_admin($total,$p=1,$link="",$rownum=20,$scale=10,$prev_section_img = "" ,$next_section_img = "" ,$prev_img = "" ,$next_img = "", $first_img = "", $last_img = "", $outside_using="N") { //페이지가 없으면 첫페이지 if(empty($p)) $p = 1; $orig_page = $p; //$total이 없으면 1 if(empty($total) or $total <= 0){ $total = 1; } $link = str_replace("&&","&",$link); if(substr($link,0,1) == "&") $link = substr($link,1); //filename 없으면 자기자신 $filename=$_SERVER['PHP_SELF']; $total_page = @ceil( $total / $rownum ) ; $total_zone = ceil($total_page/$scale); // 총 블럭 수 $zone = ceil($p/$scale); //현재 블럭 $first_page = ($zone -1) * $scale; $last_page = $zone * $scale; if($total_zone <= $zone) { $last_page = $total_page; } //이전페이지 링크 if($orig_page > 1){ $p = $orig_page - 1 ; $pre_page ="
  • Previous
  • "; }else{ $pre_page = "
  • Previous
  • "; } //다음 페이지 링크 if($orig_page < $total_page){ $p = $orig_page + 1 ; $next_page ="
  • Next
  • "; }else{ $next_page = "
  • Next
  • "; } //각페이지로 이동 링크 for($page_link = $first_page+1 ; $page_link <= $last_page; $page_link++){ if($orig_page == $page_link){ $this_page .= "
  • $page_link
  • "; }else{ $this_page .="
  • $page_link
  • "; } } $page_index = $pre_page.$this_page.$next_page; return $page_index; } if (phpversion () < "5"){ // define PHP5 functions if server uses PHP4 function str_split($text, $split = 1){ if (!is_string($text)) return false; if (!is_numeric($split) && $split < 1) return false; $len = strlen($text); $array = array(); $s = 0; $e=$split; while ($s <$len){ $e=($e <$len)?$e:$len; $array[] = substr($text, $s,$e); $s = $s+$e; } return $array; } } /*------------------------------------------------------ 한글 문자열 자르기 , 유니 코드 포함 $isUni = true 이면 유니코드문자열 처리 -------------------------------------------------------*/ ##TODO : 유니코드를 자동으로 인식할수 없을까? function ksubstr___($str, $limitLen,$suffix="...",$isUni = true) { $strLen = strlen( $str ); //제한 문자길이 보다 작다면 그대로 리턴 if ( $limitLen > $strLen ){ return $str; } $str = substr( $str, 0, $limitLen ); $kChar = 0; for( $i = $limitLen -1 ; $i >= 0 ;$i-- ){ $lastChar = ord($str[$i]); if($lastChar < 127){ break; //정상적인 영문자,숫자라면..stop } else{ $kChar++; //한글이나 특수 문작 } }//for //한문자 길이 ($isUni) ? $divide = 3 : $divide = 2 ; //문자가 깨지지않게 맞추기 if($rest = $kChar % $divide > 0){ $str = substr($str,0,$limitLen - $rest); } return $str.$suffix; } function ksubstr($str, $len, $checkmb=false, $tail='...') { /** * UTF-8 Format * 0xxxxxxx = ASCII, 110xxxxx 10xxxxxx or 1110xxxx 10xxxxxx 10xxxxxx * latin, greek, cyrillic, coptic, armenian, hebrew, arab characters consist of 2bytes * BMP(Basic Mulitilingual Plane) including Hangul, Japanese consist of 3bytes **/ preg_match_all('/[\xE0-\xFF][\x80-\xFF]{2}|./', $str, $match); // target for BMP $m = $match[0]; $slen = strlen($str); // length of source string $tlen = strlen($tail); // length of tail string $mlen = count($m); // length of matched characters if ($slen <= $len) return $str; if (!$checkmb && $mlen <= $len) return $str; $ret = array(); $count = 0; for ($i=0; $i < $len; $i++) { $count += ($checkmb && strlen($m[$i]) > 1)?2:1; if ($count + $tlen > $len) break; $ret[] = $m[$i]; } return join('', $ret).$tail; } function strcut_utf8($str, $len, $checkmb=false, $tail='...') { /** * UTF-8 Format * 0xxxxxxx = ASCII, 110xxxxx 10xxxxxx or 1110xxxx 10xxxxxx 10xxxxxx * latin, greek, cyrillic, coptic, armenian, hebrew, arab characters consist of 2bytes * BMP(Basic Mulitilingual Plane) including Hangul, Japanese consist of 3bytes **/ preg_match_all('/[\xE0-\xFF][\x80-\xFF]{2}|./', $str, $match); // target for BMP $m = $match[0]; $slen = strlen($str); // length of source string $tlen = strlen($tail); // length of tail string $mlen = count($m); // length of matched characters if ($slen <= $len) return $str; if (!$checkmb && $mlen <= $len) return $str; $ret = array(); $count = 0; for ($i=0; $i < $len; $i++) { $count += ($checkmb && strlen($m[$i]) > 1)?2:1; if ($count + $tlen > $len) break; $ret[] = $m[$i]; } return join('', $ret).$tail; } /***** * 파일 다운로드 * $fullpath : 물리적 파일이름까지 포함한 전체 경로 * $filename : 다운로드시 저장될 파일 이름 *****/ function download($fullpath, $filename){ $HTTP_USER_AGENT = $_SERVER["HTTP_USER_AGENT"]; //global $HTTP_USER_AGENT; $filename = urlencode($filename); if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0|MSIE 7.0|MSIE 8.0|MSIE 9.0)", $HTTP_USER_AGENT)){ if(strstr($HTTP_USER_AGENT, "MSIE 5.5")){ header("Content-Type: doesn/matter"); header("Content-disposition: filename=\"$filename\""); header("Content-Transfer-Encoding: binary"); header("Pragma: no-cache"); header("Expires: 0"); } if(strstr($HTTP_USER_AGENT, "MSIE 5.0")){ Header("Content-type: file/unknown"); header("Content-Disposition: attachment; filename=\"$filename\""); Header("Content-Description: PHP3 Generated Data"); header("Pragma: no-cache"); header("Expires: 0"); } if(strstr($HTTP_USER_AGENT, "MSIE 5.1")){ Header("Content-type: file/unknown"); header("Content-Disposition: attachment; filename=\"$filename\""); Header("Content-Description: PHP3 Generated Data"); header("Pragma: no-cache"); header("Expires: 0"); } if(strstr($HTTP_USER_AGENT, "MSIE")){ Header("Content-type: application/x-msdownload"); Header("Content-Length: ".(string)(filesize("$fullpath"))); Header("Content-Disposition: attachment; filename=\"$filename\""); Header("Content-Transfer-Encoding: binary"); Header("Pragma: no-cache"); Header("Expires: 0"); } }else{ $filename = urldecode($filename); Header("Content-type: file/unknown"); Header("Content-Length: ".(string)(filesize("$fullpath"))); Header("Content-Disposition: attachment; filename=\"$filename\""); Header("Content-Description: PHP3 Generated Data"); Header("Pragma: no-cache"); Header("Expires: 0"); } if (is_file("$fullpath")){ $fp = fopen("$fullpath", "rb"); if (!fpassthru($fp)) fclose($fp); }else{ go_url("", "해당 파일이나 경로가 존재하지 않습니다."); } } /***** * 배열의 모든값들에 대해 \문자를 제거한다. * by sqlplus *****/ function StripAllSlashes (&$ArrayGET, $Value){ if (is_array ($ArrayGET)) array_walk ($ArrayGET, "StripAllSlashes"); else $ArrayGET = stripslashes ($ArrayGET); } /***** * 배열의 모든 요소들을 trim 한다 * by sqlplus *****/ function trimvalues (&$ArrayGET, $Value){ if (is_array ($ArrayGET)) array_walk ($ArrayGET, "trimvalues"); else $ArrayGET = trim ($ArrayGET); } /***** * 배열에서 값이 null인것은 제거 시켜준다. *****/ function delete_null_array($var){ return ($var !== null && trim($var) != ""); } /***** * 배열에서 값이 null인것은 제거 시켜준다. *****/ function remove_null_array($var){ $newArray = array(); $nKey=0; if(is_array($var)){ foreach($var as $key => $value){ if($value !== null && trim($value) != ""){ $newArray[$nKey] = $value; $nKey++; } } }else{ $newArray = $var; } return $newArray; } /***** * 배열의 모든 요소의 특수 문자를 HTML 엔터티로 변환합니다. * by sqlplus *****/ function htmlspecialcharsAll (&$Array, $Value){ if (is_array ($Array)) array_walk ($Array, "htmlspecialcharsAll"); else $Array = htmlspecialchars ($Array,ENT_QUOTES); } function go_url($url = "",$msg = "",$target = "") { $str = _DOCTYPE." "._TITLE." "; if(trim($msg)!=""){// message가 있을경우 $str .= " "; } if(trim($url)!=""){// url 이 있을경우 if($target){ // 프레임구조에서 타겟이 정해져 있을경우 $str .= ""; }else{ $str .= ""; //$str .= ""; } }else{ $str .= " "; } $str .= " "; define("_ALERT", "1"); define("_MSG", $str); exit; } function go_confirm($msg = "",$url = "",$cancel_url = ""){ $str = _DOCTYPE." "._TITLE." "; if(trim($cancel_url)!=""){ $cancel_url = "else{location.replace('".$cancel_url."');}"; } if(trim($msg)!=""){// message가 있을경우 $str .= " "; } $str .= " "; define("_ALERT", "1"); define("_MSG", $str); exit; } function close_alert($msg,$url = ""){ $str = _DOCTYPE." "._TITLE." "; define("_ALERT", "1"); define("_MSG", $str); exit; } // by sqlplus function thumbnail($file, $save_filename, $save_path, $max_width, $max_height,$watermark_file = ""){ $x0=10 ; $y0=30 ; list($img_width, $img_height, $type, $attr) = getimagesize($file); /* type 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM */ if($type == 1){ $src_img = ImageCreateFromGif($file); }elseif($type == 2){ $src_img = ImageCreateFromJPEG($file); }elseif($type == 3){ $src_img = ImageCreateFromPNG($file); }else{ return 0; } # 비율 수정 $ratio = ($img_width/$max_width >= $img_height/$max_height)? $img_width/$max_width:$img_height/$max_height; $dst_width = $img_width/$ratio; $dst_height = $img_height/$ratio; if($dst_width < $max_width) $srcx = ceil(($max_width - $dst_width)/2); else $srcx = 0; if($dst_height < $max_height) $srcy = ceil(($max_height - $dst_height)/2); else $srcy = 0; if($type == 1){ $dst_img = imagecreate($max_width, $max_height); }else{ $dst_img = imagecreatetruecolor($max_width, $max_height); } $bgc = ImageColorAllocate($dst_img, 255, 255, 255); ImageFilledRectangle($dst_img, 0, 0, $max_width, $max_height, $bgc); ImageCopyResampled($dst_img, $src_img, $srcx, $srcy, 0, 0, $dst_width, $dst_height, ImageSX($src_img),ImageSY($src_img)); if($type == 1){ ImageInterlace($dst_img); ImageGif($dst_img, $save_path."/".$save_filename); }elseif($type == 2){ ImageInterlace($dst_img); ImageJPEG($dst_img, $save_path."/".$save_filename); }elseif($type == 3){ ImagePNG($dst_img, $save_path."/".$save_filename); } chmod($save_path."/".$save_filename,0644); ImageDestroy($dst_img); ImageDestroy($src_img); } # 처리시간 처리를 위해 추가 function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function calendar($year,$month){ $last_day = 31-((($month-(($month<8)? 1:0))%2)+(($month==2)?((!($year%((!($year%100))? 400 :4)))? 1:2):0)); for($w = 0;$w < 6;$w++){ for($d=0;$d<7;$d++){ $day = ($w==0)? ( (date("w", strtotime($year.'-'.$month.'-1')) <= $d)? $day + 1:0 ):( $day + 1 ); $calendar[$w][chr(65+$d)] = ($day > $last_day)? 0:$day; } if($day >= $last_day) break; } return $calendar; } function check_day($year,$month,$day){ return strtotime(date('Y-m-d')) - strtotime($year.'-'.$month.'-'.$day); } /***** * 첨부파일 업로드 * $tag : U upload, D delete *****/ function upload($path,$OBJ_FILES,$filename,$tag = "U"){ $arr_path = split("/",$path); if($tag == "U"){ // 파일 업로드일 경우 // 확장자 체크 if(preg_match('/\\.(php|htm|html|asp|jsp|js|com|bat)$/i', strtolower($OBJ_FILES['name']))){ // 확장자 금지항목 체크 go_url("","금지된 확장자의 파일 업로드를 시도하셨습니다."); } // 저장할 디렉토리가 존재하지 않으면 생성한다. for($i=1;$i 0 ){// 첨부파일이 있을경우 // 확장자 체크 if(preg_match('/\\.(php|htm|html|asp|jsp|js|com|bat)$/i', strtolower($OBJ_FILES['name']))){ // 확장자 금지항목 체크 go_url("","금지된 확장자의 파일 업로드를 시도하셨습니다."); exit; } // 저장할 디렉토리가 존재하지 않으면 생성한다. for($i=1;$i"; } function get_input_code($type,$code,$name,$value="",$class="text_03",$script=""){ global $_CODE; $items = $_CODE[$code]; $str = ""; switch($type){ case "select": $str .= "\n"; break; case "select2": $str .= "\n"; break; case "radio": foreach( $items as $key => $val ){ $checked = ($key==$value)? " checked":""; $str .= " {$val} \n"; } break; case "radio2": $checked = (!$value)? " checked":""; $str .= " 전체 "; foreach( $items as $key => $val ){ $checked = ($key==$value)? " checked":""; $str .= " {$val} "; } break; case "checkbox": foreach( $items as $key => $val ){ //$checked = ($key==$value)? " checked":""; $checked = strstr((string) $value, (string) $key)? " checked":""; $str .= "{$val} \n"; } break; } return $str; } function get_view_code($type,$code,$name,$value="",$class="text04"){ global $_CODE; $items = $_CODE[$code]; $str = ""; switch($type){ case "select": $str .= "\n"; break; case "radio": foreach( $items as $key => $val ){ if(strstr((string) $value, (string) $key)) $str .= " {$val} \n"; } break; case "checkbox": foreach( $items as $key => $val ){ if(strstr((string) $value, (string) $key)) $str .= "{$val} "; } break; } return $str; } function get_userName($user_id){ global $_DB; if(!$user_id) return; return $_DB->getOne("select user_name from user where user_id = ? ",$user_id); } function get_userTel($user_id){ global $_DB; if(!$user_id) return; return $_DB->getOne("select user_tel from user where user_id = ? ",$user_id); } function get_userHp($user_id){ global $_DB; if(!$user_id) return; return $_DB->getOne("select user_hp from user where user_id = ? ",$user_id); } function get_agencyName($a_id){ global $_DB; if(!$a_id) return "본사"; return $_DB->getOne("select a_company from agency where a_id = ? ",$a_id); } function get_imgsize($file,$max_width,$max_height=0){ if( $file != '' && file_exists($file) ) { list($img_width, $img_height, $type, $attr) = @getimagesize($file); if($type == 1 || $type == 2 || $type == 3){ # 비율 수정 if($max_height>0){ $ratio = ($img_width/$max_width >= $img_height/$max_height) ? $img_width/$max_width:$img_height/$max_height; if( $ratio <= 1) $ratio = 1; $dst_width = round($img_width/$ratio); $dst_height = round($img_height/$ratio); return " width='$dst_width' height='$dst_height' "; }else{ $ratio = $img_width/$max_width; if( $ratio <= 1) $ratio = 1; $dst_width = round($img_width/$ratio); $dst_height = round($img_height/$ratio); return " width='$dst_width' height='$dst_height' "; } }else{ return; } }else{ return; } } class SelectHanCategory { /* ㄱ : ㄱ ㄴ : ㄴ ㄷ : ㄷ ㄹ : ㄹ ㅁ : ㅁ ㅂ : ㅂ ㅅ : ㅅ ㅇ : ㅇ ㅈ : ㅈ ㅊ : ㅊ ㅋ : ㅋ ㅌ : ㅌ ㅍ : ㅍ ㅎ : ㅎ */ // 가..나..다..의 16진수값들 var $hexcode = array("0088" => "A", "b0a1" => "ㄱ", "b3aa" => "ㄴ","b4d9" => "ㄷ", "b6f3" => "ㄹ","b8b6" => "ㅁ", "b9d9" => "ㅂ","bbe7" => "ㅅ", "bec6" => "ㅇ","c0da" => "ㅈ", "c2f7" => "ㅊ", "c4ab" => "ㅋ", "c5b8" => "ㅌ", "c6c4" => "ㅍ","c7cf" => "ㅎ", "c8ff" => ""); var $hexarray, $hexcount; function SelectHanCategory() { $this->hexcount = count($this->hexcode); for($i=0; $i < $this->hexcount ; $i++) { $this->hexarray[] = key($this->hexcode); next($this->hexcode); } } function IsHangul($ch) { $ch = ord($ch); if($ch >= 0xa1 && $ch <= 0xfe) return true; return false; } function Check($str) { if($this->IsHangul(substr($str, 0, 1))) { $current_hexcode = bin2hex(substr($str, 0, 2)); for ($i=0,$j=1;$i<$this->hexcount;$i++,$j++) { if ($current_hexcode>=$this->hexarray[$i] && $current_hexcode<$this->hexarray[$j]) { break; } } return array($j,$this->hexcode[$this->hexarray[$i]]); }else{ return array( strtoupper(substr($str, 0, 1)) , strtoupper(substr($str, 0, 1)) ); } //} return array(-1); } } //$category = new SelectHanCategory(); //$return = $category->Check("a파하하하.. 안녕하세요."); //echo "해당 카테고리 : $return[1] , DB에 저장한 값 : $return[0]"; // 메시지발송 SendMesg(보내는 사람 연락처, 메시지, 전송완료알림창 ( 1:띄움, 0:안띄움 ), 받는 사람 연락처) function SendMesg($hpSender, $hpMesg, $endAlert, $hpReceiver=_SMS_HP) { $userid = _SMS_ID; // 문자나라 아이디 $passwd = _SMS_PW; // 문자나라 비밀번호 $adminPhone = _SMS_HP; // 비상시 메시지를 받으실 관리자 핸드폰번호 /* UTF-8 글자셋 일 경우 */ $hpMesg = iconv("UTF-8", "EUC-KR", $hpMesg); $hpMesg = urlencode($hpMesg); $url = "/MSG/send/web_admin_send.htm?userid=".$userid."&passwd=".$passwd."&sender=".$hpSender."&receiver=".$hpReceiver."&encode=1&end_alert=".$endAlert."&message=".$hpMesg; $fp = fsockopen("211.233.20.184", 80, $errno, $errstr, 10); if(!$fp) echo "$errno : $errstr"; fwrite($fp, "GET $url HTTP/1.0\r\nHost: 211.233.20.184\r\n\r\n"); $flag = 0; while(!feof($fp)){ $row = fgets($fp, 1024); if($flag) $out .= $row; if($row=="\r\n") $flag = 1; } fclose($fp); return iconv("EUC-KR", "UTF-8", $out); } function get_banner($pos,$cat){ global $_DB; if(!$pos) return; if(!$cat) return; $query = " select * from banner where b_pos = ? and b_cat = ? limit 1 "; $_row = $_DB->getRow($query,array($pos,$cat),DB_FETCHMODE_ASSOC); if (DB::isError($_row)) { //print_r($row); die($_row->getMessage()); } if(file_exists(_PDS."banner/{$_row['b_no']}") && $_row['b_file']){ $str = ""; if($_row['b_link']) $str .= ""; $str .= ""; if($_row['b_link']) $str .= ""; return $str; }else{ return; } } function get_nav($c_id){ global $_DB,$_basic,$_PRODUCT_TYPE; $str = ""; $separator = " > "; $len = strlen($c_id); if($len){ $str .= $_PRODUCT_TYPE[$c_id[0]]; for( $i = 1 ; $i <= floor( ( $len - 1 ) / 3 ) ; $i++ ){ $res = $c_name = $_DB->getOne(" select c_name from category where c_id = ? ",substr($c_id,0,1+(3*($i)))); if (DB::isError($res)) { //debug($res); die($res->getMessage()); } $str .= $separator; $str .= $c_name; } } return $str; } function get_goods_swfnum($c_id){ global $_PRODUCT_TYPE; if($_PRODUCT_TYPE[$c_id[0]]){ switch($c_id[0]){ case "A":return 1;break; case "B":return 2;break; case "C":return 3;break; case "D":return 4;break; case "E":return 5;break; case "F":return 6;break; case "G":return 7;break; case "H":return 8;break; case "I":return 9;break; } }else return ""; } function get_category_list($c_type){ global $_DB; $query = " select * from category c where c_num1 > 0 and c_type = '{$c_type}' order by c_id asc "; $res = $_list =& $_DB->getAll($query, array(), DB_FETCHMODE_ASSOC); if (DB::isError($res)) { debug($query); die($res->getMessage()); } return $_list; } function ext_get($value){ return strtolower(array_pop(explode('.',$value))); } function replace_icon($str){ for( $fs = 1 ; $fs <= 19 ; $fs++ ){ $str = str_replace('{'.$fs.'}',"",$str); } return $str; } function removeTags($text){ $text = preg_replace("/(\)/si", "dada", "$text"); $text = strip_tags($text); $text = str_replace("