Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
ltms.eemo.co.kr
/
public_html
/
super
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/ltms.eemo.co.kr/public_html/super/lib.php
<? function getDistanceBetweenPoints($lat1, $lon1, $lat2, $lon2) { $theta = $lon1 - $lon2; $miles = (sin(deg2rad($lat1)) * sin(deg2rad($lat2))) + (cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta))); $miles = acos($miles); $miles = rad2deg($miles); $miles = $miles * 60 * 1.1515; $feet = $miles * 5280; $yards = $feet / 3; $kilometers = $miles * 1.609344; $meters = $kilometers * 1000; //return compact('miles','feet','yards','kilometers','meters'); return $meters; } function add_hyphen($tel) { $tel = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거 if (substr($tel,0,2)=='02') return preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel); else if (strlen($tel)=='8' && (substr($tel,0,2)=='15' || substr($tel,0,2)=='16' || substr($tel,0,2)=='18')) // 지능망 번호이면 return preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel); else return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel); } function nl2space ($text) { return preg_replace("/[\r\n]+/", " ", $text); } $BASIC_DOW = 1; function getWeekInfo($_date) { global $BASIC_DOW; list($yy, $mm, $dd) = explode('-', $_date); $dow = date('N', mktime(0, 0, 0, $mm, 1, $yy)); if ($dow <= $BASIC_DOW) { $diff = $BASIC_DOW - $dow; $srt_day = $diff+1; } else { $diff = 7-$dow; $srt_day = $diff + $BASIC_DOW + 1; } if ($dd < $srt_day) { $new_date = date('Y-m-d', mktime(0, 0, 0, $mm, 0, $yy)); return getWeekInfo($new_date); } else { $wom = ceil(($dd-($srt_day-1))/7); //$new_date = substr($yy, 2, 2). $mm. $wom; $new_date = $yy."/". intval($mm)."/".$wom; return $new_date; } } function get_startday_endday($date) { $t = date('w',strtotime($date)); $tt = (6+$t)%7; $t = strtotime($date)-($tt)*60*60*24; $st_ymd = date('Y-m-d',$t); $ed_ymd = date('Y-m-d',$t+60*60*24*6); return $st_ymd."~".$ed_ymd; } function sub_string($string,$start,$length,$charset=NULL) { if($charset==NULL) { $charset='UTF-8'; } /* 정확한 문자열의 길이를 계산하기 위해, mb_strlen 함수를 이용 */ $str_len=mb_strlen($string,'UTF-8'); if($str_len>$length) { /* mb_substr PHP 4.0 이상, iconv_substr PHP 5.0 이상 */ $string=mb_substr($string,$start,$length,'UTF-8'); $string.=".."; } return $string; } function sub_string2($string,$start,$length,$charset=NULL) { if($charset==NULL) { $charset='euc-kr'; } /* 정확한 문자열의 길이를 계산하기 위해, mb_strlen 함수를 이용 */ $str_len=mb_strlen($string,'euc-kr'); if($str_len>$length) { /* mb_substr PHP 4.0 이상, iconv_substr PHP 5.0 이상 */ $string=mb_substr($string,$start,$length,'euc-kr'); $string.=".."; } return $string; } function isarray($a,$arr) { $rst=false; foreach($arr as $ak => $av) { if($av==$a) {$rst=true;} } return $rst; } function NoExtFile($ext,$fname) { $arr_dot=explode(".",$fname); $arr_ext=explode("|",$fname); $rstOK=true; for($i=0;$i<sizeof($arr_dot);$i++) { for($g=0;$g<sizeof($arr_ext);$g++) { if($arr_ext[$g] && $arr_dot[$i]) { if($arr_ext[$g]==$arr_dot[$i]) { $rstOK=false; } } } } return $rstOK; } function unicodeString($str, $encoding=null) { if (is_null($encoding)) $encoding = ini_get('mbstring.internal_encoding'); return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/u', create_function('$match', 'return mb_convert_encoding(pack("H*", $match[1]), '.var_export($encoding, true).', "UTF-16BE");'), $str); } function number_format2($num) { $num=(string)$num; if(strpos($num,'.') != false) { $exp=explode(".",$num); //return number_format($exp[0]).".".$exp[1]; return number_format($num,2); } else { return number_format($num); } } function texttoimg($str,$sw,$sh) { header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor($sw, $sh); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $sw-1, $sh-1, $white); // The text to draw $text = $str; // Replace path by your own font path $font = 'calibri.ttf'; // Add some shadow to the text // Add the text imagettftext($im, $sh, 0, 0, $sh, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); } function ProjectDel($no) { $result=mysql_query("select * from project where Fno='$no' "); while($rs=mysql_fetch_array($result)) { $rssub=RS("select count(no) as cnt from project where Fno='$rs[no]' "); if($rssub[cnt]>0) { ProjectDel($rs[no]); } else { @mysql_query("delete from project where no='$rs[no]' "); @mysql_query("delete from project_mem where Fno='$rs[no]' "); @mysql_query("delete from project_attfile where Fno='$rs[no]' "); } } @mysql_query("delete from project where no='$no' "); @mysql_query("delete from project_mem where Fno='$no' "); @mysql_query("delete from project_attfile where Fno='$no' "); } function updateProjectPercent($no) { global $arr_mal; if($no != -1) { $rs=RS("select avg(job_progress_perc) as cnt from project where Fno='$no' and is_project='1' "); mysql_query("update project set job_progress_perc='{$rs[cnt]}' where no='$no' "); $rsFno=RS("select Fno from project where no='$no' "); updateProjectPercent($rsFno[Fno]); } } function GetMaldanProject($no,$sno) { global $arr_mal; if($sno) { $result=mysql_query("select no from project where Fno='$sno' and is_project='1' order by no asc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' limit 0,1 "); if(!$rs_issub[no]) { $arr_mal[]=$rs[no]; } else { GetMaldanProject($rs[no],''); } } } else { $result=mysql_query("select no from project where Fno='$no' and is_project='1' order by no asc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' limit 0,1 "); if(!$rs_issub[no]) { $arr_mal[]=$rs[no]; } else { GetMaldanProject($rs[no],''); } } } } function GetMyMaldanProject($no) { global $_SESSION; global $arr_mal; if($no==-1) { $result=mysql_query("select no from project where Fno='-1' and is_project='1' and (status='진행' or status='대기') order by no desc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' and (status='진행' or status='대기') limit 0,1 "); if(!$rs_issub[no]) { $rs_my=RS("select no from project_mem where Fno='{$rs[no]}' and mem_no='{$_SESSION[mem_no]}' "); if($rs_my[no]) { $arr_mal[]=$rs[no]; } } else { GetMyMaldanProject($rs[no]); } } } else { $result=mysql_query("select no from project where Fno='$no' and is_project='1' and (status='진행' or status='대기') order by no desc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' and (status='진행' or status='대기') limit 0,1 "); if(!$rs_issub[no]) { $rs_my=RS("select no from project_mem where Fno='{$rs[no]}' and mem_no='{$_SESSION[mem_no]}' "); if($rs_my[no]) { $arr_mal[]=$rs[no]; } } else { GetMyMaldanProject($rs[no]); } } } } function GetMemMaldanProject_app($no,$memno,$uyear) { global $arr_mal; if($no==-1) { $result=mysql_query("select no from project where Fno='-1' and is_project='1' and (status='진행' or status='대기') order by no desc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' and (status='진행' or status='대기') limit 0,1 "); if(!$rs_issub[no]) { $rs_my=RS("select no from project_mem where Fno='{$rs[no]}' and mem_no='{$memno}' "); if($rs_my[no]) { $arr_mal[]=$rs[no]; } } else { GetMemMaldanProject_app($rs[no],$memno,$uyear); } } } else { $result=mysql_query("select no from project where Fno='$no' and is_project='1' and (status='진행' or status='대기') order by no desc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' and (status='진행' or status='대기') limit 0,1 "); if(!$rs_issub[no]) { $rs_my=RS("select no from project_mem where Fno='{$rs[no]}' and mem_no='{$memno}' "); if($rs_my[no]) { $arr_mal[]=$rs[no]; } } else { GetMemMaldanProject_app($rs[no],$memno,$uyear); } } } } function GetMyMaldanProject_app($no) { global $arr_mal; global $memno; if($no==-1) { $result=mysql_query("select no from project where Fno='-1' and is_project='1' and (status='진행' or status='대기') order by no desc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' and (status='진행' or status='대기') limit 0,1 "); if(!$rs_issub[no]) { $rs_my=RS("select no from project_mem where Fno='{$rs[no]}' and mem_no='{$memno}' "); if($rs_my[no]) { $arr_mal[]=$rs[no]; } } else { GetMyMaldanProject_app($rs[no]); } } } else { $result=mysql_query("select no from project where Fno='$no' and is_project='1' and (status='진행' or status='대기') order by no desc ") or die(); while($rs=mysql_fetch_array($result)) { $rs_issub=RS("select no from project where Fno='{$rs[no]}' and is_project='1' and (status='진행' or status='대기') limit 0,1 "); if(!$rs_issub[no]) { $rs_my=RS("select no from project_mem where Fno='{$rs[no]}' and mem_no='{$memno}' "); if($rs_my[no]) { $arr_mal[]=$rs[no]; } } else { GetMyMaldanProject_app($rs[no]); } } } } function GetNowSusikPosition($no,$dir) { global $NowDir; global $RootDir; $RootDir="Home"; $result=mysql_query("select * from susik_tree where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[name]; if($rs[is_folder]=="1") $str_project=$str_project; else $str_project=$str_project; if($dir) $NowDir="".$str_project."</a> <span class='accentColor'>></span> ".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from susik_tree where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowSusikPosition($rs[Fno],$NowDir); else {$NowDir=$RootDir." <span class='accentColor'>></span> ".$NowDir;} } function BudgetDel($no) { $result=mysql_query("select * from budget_tree where Fno='$no' "); while($rs=mysql_fetch_array($result)) { $rssub=RS("select count(no) as cnt from budget_tree where Fno='$rs[no]' "); if($rssub[cnt]>0) { BudgetDel($rs[no]); } else { @mysql_query("delete from budget_tree where no='$rs[no]' "); } } @mysql_query("delete from budget_tree where no='$no' "); } function GetBudgetNo2Name($search) { global $arr_bgno; $result=mysql_query("select * from budget_tree where name like '%$search%' ") or die(); while($rs=mysql_fetch_array($result)) { $arr_bgno[]=$rs[no]; } } function GetBudgetNo2No($fno) { global $arr_bgno2; $result=mysql_query("select * from budget_inout where 1 ") or die(mysql_error()); while($rs=mysql_fetch_array($result)) { $rtn_pos2=array(); $rs_d3=RS("select * from budget_tree where no='{$rs[Tree_no]}' "); if($rs_d3[no]) { if($fno==$rs_d3[no]) { $arr_bgno2[]=$rs[no]; } $rs_d2=RS("select * from budget_tree where no='{$rs_d3[Fno]}' "); if($rs_d2[no]) { if($fno==$rs_d2[no]) { $arr_bgno2[]=$rs[no]; } $rs_d1=RS("select * from budget_tree where no='{$rs_d2[Fno]}' "); if($fno==$rs_d1[no]) { $arr_bgno2[]=$rs[no]; } } } } } function GetNowBudgetPosition($no,$dir) { global $NowDir; global $RootDir; $RootDir="Home"; $result=mysql_query("select * from budget_tree where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[name]; if($dir) $NowDir="".$str_project." <span class='accentColor'>></span> ".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from budget_tree where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowBudgetPosition($rs[Fno],$NowDir); else {$NowDir=$RootDir." <span class='accentColor'>></span> ".$NowDir;} } function GetNowBudgetPosition2($no,$dir) { global $NowDir; global $RootDir; $RootDir=""; $result=mysql_query("select * from budget_tree where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[name]; if($dir) $NowDir="".$str_project."|@|".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from budget_tree where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowBudgetPosition2($rs[Fno],$NowDir); } function GetNowBudgetPosition3($no,$dir) { global $rtn_pos; $rs=RS("select * from budget_tree where no='$no' "); if($rs[no]) { array_unshift($rtn_pos,$rs[name]); } $rs_f=RS("select * from budget_tree where no='{$rs[Fno]}' "); if($rs_f[no]) { GetNowBudgetPosition3($rs[Fno],''); } else { } } function GetNowBudgetPosition5($no,$dir) { global $rtn_pos2; $rs=RS("select * from budget_tree where no='$no' "); if($rs[no]) { array_unshift($rtn_pos2,$rs[name]); } $rs_f=RS("select * from budget_tree where no='{$rs[Fno]}' "); if($rs_f[no]) { GetNowBudgetPosition5($rs[Fno],''); } else { } } function GetNowPositionXML($no,$dir) { global $NowDir; global $RootDir; $RootDir=""; $result=mysql_query("select Fno,project,is_project from project where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); //$str_project=$rs[project]; if($rs[is_project]=="1") $str_project=$rs[project]; if($dir) $NowDir="".$str_project." / ".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from project where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowPositionXML($rs[Fno],$NowDir); else {$NowDir=$RootDir."".$NowDir;} } function GetNowPosition($no,$dir) { global $NowDir; global $RootDir; $RootDir="<a href='project.php'>Home</a>"; $result=mysql_query("select Fno,project,is_project from project where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[project]; if($rs[is_project]=="1") $str_project=$str_project; else $str_project=$str_project; if($dir) $NowDir="<a href='project.php?Fno={$no}'>".$str_project."</a> <span class='accentColor'>></span> ".$dir; else $NowDir="<a href='project.php?Fno={$no}'>".$str_project."</a>"; $rs_p=RS("select no from project where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowPosition($rs[Fno],$NowDir); else {$NowDir=$RootDir." <span class='accentColor'>></span> ".$NowDir;} } function GetNowPosition2($no,$dir) { global $NowDir; global $RootDir; $RootDir=""; $result=mysql_query("select Fno,project,is_project from project where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[project]; if($rs[is_project]=="1") $str_project=$str_project; else $str_project=$str_project; if($dir) $NowDir="".$str_project." <span class='accentColor'>></span> ".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from project where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowPosition2($rs[Fno],$NowDir); else {$NowDir=$RootDir."".$NowDir;} } function GetNowPosition2_xml($no,$dir) { global $NowDir; global $RootDir; $RootDir=""; $result=mysql_query("select Fno,project,is_project from project where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[project]; if($rs[is_project]=="1") $str_project=$str_project; else $str_project=$str_project; if($dir) $NowDir="".$str_project." / ".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from project where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowPosition2_xml($rs[Fno],$NowDir); else {$NowDir=$RootDir."".$NowDir;} } function GetNowPosition3($no,$dir) { global $NowDir; global $RootDir; $RootDir=""; $result=mysql_query("select Fno,project,is_project from project where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[project]; if($rs[is_project]=="1") $str_project="".$str_project.""; else $str_project="<font color='red'>".$str_project."</font>"; if($dir) $NowDir="<a href='project.php?Fno={$no}'>".$str_project."</a> <span class='accentColor'>></span> ".$dir; else $NowDir="<a href='project.php?Fno={$no}'>".$str_project."</a>"; $rs_p=RS("select no from project where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowPosition3($rs[Fno],$NowDir); else {$NowDir=$RootDir."".$NowDir;} } function GetNowPosition5($no,$dir) { global $NowDir; global $RootDir; $RootDir=""; $result=mysql_query("select Fno,project,is_project from project where no='$no' ") or die(mysql_error()); $rs=mysql_fetch_array($result); $str_project=$rs[project]; if($rs[is_project]=="1") $str_project="".$str_project.""; else $str_project="".$str_project.""; if($dir) $NowDir="".$str_project." <span class='accentColor'>></span> ".$dir; else $NowDir="".$str_project.""; $rs_p=RS("select no from project where no='{$rs[Fno]}' "); if($rs_p[no] && $rs[Fno] != -1) GetNowPosition5($rs[Fno],$NowDir); else {$NowDir=$RootDir."".$NowDir;} } function UseGraph($gW,$gH,$uH,$UseDiskBar,$br,$bg,$bb,$nr,$ng,$nb,$fn) { $x1=1;$y1=1; $x2=$x1+$UseDiskBar-1; $y2=$y1+$uH-1; $UseDiskBar=$UseDiskBar-2; if($UseDiskBar<0) $UseDiskBar=0; $dim=imagecreate($gW,$gH); $im_white=imagecolorallocate($dim,$br,$bg,$bb); $im_blue=imagecolorallocate($dim,$nr,$ng,$nb); $sim=imagecreatefrompng($fn); imagerectangle($dim,0,0,$gW-1,$gH-1,$im_blue); if($UseDiskBar != 0) ImageCopyResized($dim,$sim,$x1,$y1,0,0,$UseDiskBar,$uH,1,14); $uiq=explode(" ",microtime()); $uiq=$uiq[0]."_".$uiq[1]; $img_file="./tmp/".$uiq.".png"; Imagepng($dim,$img_file,9); Imagedestroy($dim); Imagedestroy($sim); return $img_file; } function filename($v) { $filename=explode("/",$v); $file_ext=$filename[sizeof($filename)-1]; return $file_ext; } function basefilename($ff) { $fn_dot_index=strrpos($ff,"."); //마지막 점의 위치값 구하기 $fn_ext=substr($ff,$fn_dot_index+1); //확장자 분리하기 즉, 확장자는 마지막 점의 다음 번지부터 끝까지 $fn_base=substr($ff,0,$fn_dot_index); //확장자 제외한 파일명 구하기 즉,0번지부터 (마지막 점의 위치값 번지)개 까지 return $fn_base; } function NoNoFile($ff) { $noArr=array("lib.php","Header.php","Common.php","dbconn.php","Config.php","Footer.php"); for($i=0;$i<sizeof($noArr);$i++) { if($noArr[$i]==$ff) { return true; } } } function GetByteSize($num,$dan) { if($dan=="MB") return $num*1048576; elseif($dan=="GB") return $num*1073741824; elseif($dan=="KB") return $num*1024; elseif($dan=="TB") return $num*1099511627776; } function RS($query) { $result=mysql_query($query) or die(mysql_error()); $rs=mysql_fetch_array($result); return $rs; } function nBasename($ff) { $tmp=explode("/",$ff); return $tmp[sizeof($tmp)-1]; } function img_limit($file, $max_width, $max_height) { // 전송받은 이미지 정보를 받는다 $img_info = getImageSize($file); // 전송받은 이미지의 포맷값 얻기 (gif, jpg png) if($img_info[2] == 1) { $src_img = ImageCreateFromGif($file); } else if($img_info[2] == 2) { $src_img = ImageCreateFromJPEG($file); } else if($img_info[2] == 3) { $src_img = ImageCreateFromPNG($file); } else { return 0; } // 전송받은 이미지의 실제 사이즈 값얻기 $img_width = ImageSX($src_img); $img_height = ImageSY($src_img); $DimgW; $DimgH; if(($img_width <= $max_width) && ($img_height <= $max_height)) { $DimgW = $img_width; $DimgH = $img_height; } else { //----------- 가로와 세로의 비율을 구한다 -----------------// /*----------------------------------------------------------------------------- 가로가 세로보다 크다면 가로 = 정해준 폭 dw 세로 = 정해준 폭 dw * 원본 이미지 세로 / 원본 이미지 가로 ------------------------------------------------------------------------------*/ if($img_width > $img_height) { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; if($DimgH > $max_height) { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; } } /*----------------------------------------------------------------------------- 세로가 가로보다 크다면 세로 = 정해준 높이 dh 가로 = 정해준 높이 dh * 원본 이미지 가로 / 원본 이미지 세로 ------------------------------------------------------------------------------*/ else if($img_width < $img_height) { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; if($DimgW > $max_width) { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; } } /*----------------------------------------------------------------------------- 세로와 세로가 같다면 세로 = h 가로 = w ------------------------------------------------------------------------------*/ else if($img_width == $img_height) { $DimgW=$max_width; $DimgH=$max_width; if($DimgH > $max_height) { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; } elseif($DimgW > $max_width) { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; } } } $rtn=array(); $rtn[0]=$DimgW; $rtn[1]=$DimgH; $rtn[2]=$img_width; $rtn[3]=$img_height; return $rtn; } function img_limit2($file, $max_width, $max_height,$mode) { // 전송받은 이미지 정보를 받는다 $img_info = getImageSize($file); // 전송받은 이미지의 포맷값 얻기 (gif, jpg png) if($img_info[2] == 1) { $src_img = ImageCreateFromGif($file); } else if($img_info[2] == 2) { $src_img = ImageCreateFromJPEG($file); } else if($img_info[2] == 3) { $src_img = ImageCreateFromPNG($file); } else { return 0; } // 전송받은 이미지의 실제 사이즈 값얻기 $img_width = ImageSX($src_img); $img_height = ImageSY($src_img); $DimgW; $DimgH; //----------- 가로와 세로의 비율을 구한다 -----------------// /*----------------------------------------------------------------------------- 가로가 세로보다 크다면 가로 = 정해준 폭 dw 세로 = 정해준 폭 dw * 원본 이미지 세로 / 원본 이미지 가로 ------------------------------------------------------------------------------*/ if($mode=="w") { if($img_width <= $max_width) { $DimgW=$img_width; $DimgH=$img_height; } else { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; } } /*----------------------------------------------------------------------------- 세로가 가로보다 크다면 세로 = 정해준 높이 dh 가로 = 정해준 높이 dh * 원본 이미지 가로 / 원본 이미지 세로 ------------------------------------------------------------------------------*/ else if($mode=="h") { if($img_height <= $max_height) { $DimgW=$img_width; $DimgH=$img_height; } else { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; } } $rtn=array(); $rtn[0]=$DimgW; $rtn[1]=$DimgH; $rtn[2]=$img_width; $rtn[3]=$img_height; return $rtn; } function GetUpFolder($dir) { $arr=explode("/",$dir); $result=''; for($i=0;$i<sizeof($arr)-1;$i++) { if($i > 0) $result.="/".$arr[$i]; else $result.=$arr[$i]; } return $result; } function SecToTime($aa) { $str=sprintf("%02d",intval($aa/3600)).":".sprintf("%02d",intval(($aa-(intval($aa/3600)*3600))/60)).":".sprintf("%02d",($aa-((intval($aa/3600)*3600)+(intval(($aa-(intval($aa/3600)*3600))/60)*60)))); return $str; } function TimeStrToSec($str) { // 12:01:12 -> 초로 변환 $arr=explode(":",$str); return ($arr[0]*3600)+($arr[1]*60)+$arr[2]; } function deldir($dir) { $handle = opendir($dir); while (false!==($FolderOrFile = readdir($handle))) { if($FolderOrFile != "." && $FolderOrFile != "..") { if(is_dir("$dir/$FolderOrFile")) { deldir("$dir/$FolderOrFile"); } // recursive else { unlink("$dir/$FolderOrFile"); } } } closedir($handle); if(rmdir($dir)) { $success = true; } return $success; } function c8($str) { return iconv("utf-8","UTF-8",$str); } function en8($str) { return urlencode(iconv("utf-8","UTF-8",$str)); } function en82($str) { return iconv("utf-8","UTF-8",$str); } function json_ErrMsg($str) { $result="{ErrMsg : '".toJs($str)."'}"; echo $result; } function toJs($str) { $res=str_replace("\\","\\\\",$str); $res=str_replace("'","\\'",$res); $res=str_replace("\"","\\\"",$res); $res=str_replace("\r\n","\\n",$res); $res=str_replace("\n","\\n",$res); return $res; } function ByteSize($size) { $suffix = " B"; if ($size>=1024) { $size = round($size/1024); $suffix = " KB"; if ($size>=1024) { $size = round($size/1024,2); $suffix=" MB"; if ($size>=1024) { $size = round($size/1024,2); $suffix=" GB"; } } } return number_format($size,1).$suffix; } //------------유일코드번호생성-----------------// function ucode() { $mic=microtime(); $mic=explode(" ",$mic); $mic=$mic[0]; $mic=explode(".",$mic); $mic=$mic[1]; $mic=substr($mic,0,4); return time().$mic; } //----------------------------------------------// //------------암호화----------// function secu($pass) { $key_x=array(3,7,3,5,3,2,2,4,3,2,1,6,3,4,3,2,1,2,4,2,1); $key_b=array(2,4,2,3,4,5,3,6,7,4,6,4,2,3,5,3,2,1,2,3,1); $str=""; for($i=0;$i<strlen($pass);$i++) { $a=substr($pass,$i,1); $b=$key_x[$i]; $c=$key_b[$i]; $str.=sprintf("%03d",($a*$b)+$c); } $str=md5(md5($str)); return $str; } //---------------------------------// //-------------------------- 파일확장자 구하기 ----------------------------// function file_ext($ff) { $filename=explode(".",$ff); $file_ext=$filename[sizeof($filename)-1]; return $file_ext; } //------------------------------------------------------------------------// //-------------------------- 파일이름 변환하기 ----------------------------// function file_rename($ff) { $fn_dot_index=strrpos($ff,"."); //마지막 점의 위치값 구하기 $fn_ext=substr($ff,$fn_dot_index+1); //확장자 분리하기 즉, 확장자는 마지막 점의 다음 번지부터 끝까지 $fn_base=substr($ff,0,$fn_dot_index); //확장자 제외한 파일명 구하기 즉,0번지부터 (마지막 점의 위치값 번지)개 까지 $fn_date=date("ymdhis"); //날짜구하기 $fn=$fn_base."_".$fn_date.".".$fn_ext; //파일명 = 파일명_날짜값.확장자 return $fn; } function file_rename_unixtime($ff) { $fn_dot_index=strpos($ff,"."); //마지막 점의 위치값 구하기 $fn_ext=substr($ff,$fn_dot_index+1); //확장자 분리하기 즉, 확장자는 마지막 점의 다음 번지부터 끝까지 $fn_base=substr($ff,0,$fn_dot_index); //확장자 제외한 파일명 구하기 즉,0번지부터 (마지막 점의 위치값 번지)개 까지 $fn_date=time(); //날짜구하기 $fn=$fn_base."_".$fn_date.".".$fn_ext; //파일명 = 파일명_날짜값.확장자 return $fn; } //------------------------------------------------------------------------// function qdate($datetime) { $date=explode(" ",$datetime); // 날짜만 추출 return $date[0]; } function tsdate($datetime) { $tmp=explode(" ",$datetime); $left_date=$tmp[0]; $right_date=$tmp[1]; $tmp_left=explode("-",$left_date); $YYYY=$tmp_left[0]; $mm=$tmp_left[1]; $dd=$tmp_left[2]; $tmp_right=explode(":",$right_date); $HH=$tmp_right[0]; $ii=$tmp_right[1]; $ss=$tmp_right[2]; return mktime($HH,$ii,$ss,$mm,$dd,$YYYY); } function qnew($datetime) { $diff=time()-strtotime($datetime); if($diff<86400) return "<font color=red>new</font>"; } function qnew2($datetime) { $diff=time()-$datetime; if($diff<86400) return "<font color=#FF99FF>new</font>"; } //-------------------------- 내용글 태그 선택 ----------------------------// function qcont($cont,$mode) { $allowtag="<embed><p><font><h1><b><i><a><ul><li><pre><xmp><hr><blockquote><img><div><br>"; //허용하는 태그 $stripattrib="javascript:|<script>|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup"; //금지하는 이벤트 if($mode=="HTML") { //글 타입이 HTML이라면 $cont=strip_tags($cont,$allowtag); //허용하는 태그를 제외한 태그 벗기기 $cont=eregi_replace($stripattrib," ",$cont); //금지하는 이벤트 벗기기 } else { //글타입이 HTML 이 아니라면 $cont=htmlspecialchars(stripslashes($cont)); if(strstr($cont,"\r\n")) { $cont=str_replace("\r\n","<br>",$cont); } else if(strstr($cont,"\n")) { $cont=str_replace("\n","<br>",$cont); } $cont=str_replace(" "," ",$cont); } return $cont; } function Rcont($cont,$mode) { if($mode=="HTML") { //글 타입이 HTML이라면 $cont=$cont; } else { //글타입이 HTML 이 아니라면 $cont=htmlspecialchars(stripslashes($cont)); $cont=str_replace("\r\n","<br>",$cont); $cont=str_replace(" "," ",$cont); } return $cont; } function Mcont($cont) { //a,img,embed,font,b,div,center,p,br 태그만허용 $cont=strip_tags($cont,'<a><img><embed><font><b><div><center><p><br><table><span><ul><li>'); if(strstr($cont,"\r\n")) { $cont=str_replace("\r\n","<br>",$cont); } else if(strstr($cont,"\n")) { $cont=str_replace("\n","<br>",$cont); } return $cont; } function EDIT_cont($cont) { //a,img,embed,font,b,div,center,p,br 태그만허용 $cont=strip_tags($cont,'<a><img><embed><font><b><div><center><p><br><table><span><ul><li>'); return $cont; } //-----------------------------------------------------------------------// //-------------------------- 문자열 자르기 함수 ----------------------------// function str_cut($str,$len) { if($str=="") return ""; if(strlen($str) <= $len) { return $str; } $realen=0; $realcut=$len; for($i=0;$i<$realcut;$i++) { $char = ord(substr($str,$i,1)); if($char > 127) { $realcut++; $i++; } } for($i=0;$i<strlen($str);$i++) { $char = ord(substr($str,$i,1)); if($char > 127) { $i++; } $realen++; } $rst=substr($str,0,$realcut); if($realen <= $len ) return $rst; else return $rst."..."; } function str_cut2($str,$len) { //한글글자수 기준 if($str=="") return ""; $realhan=0; $realeng=0; if(strlen($str) <= $len) { return $str; } $realen=0; $realcut=$len; for($i=0;$i<$realcut;$i++) { $char = ord(substr($str,$i,1)); if($char > 127) { $realcut++; $i++; $realhan++; } else {$realeng++;} } for($i=0;$i<strlen($str);$i++) { //실제 글자수 세기 $char = ord(substr($str,$i,1)); if(($char > 127)) { $i++; } $realen++; } $plus_eng=floor($realeng*0.8); $rst=substr($str,0,$realcut); if($realen <= $len ) return $rst; //실제글자수가 설정한 글자수 보다 작으면 그냥 리턴 $rst=substr($str,0,$realcut+$plus_eng); if(ord(substr($rst,strlen($rst)-1,1)) >127) { $rst=substr($str,0,strlen($rst)-2); return $rst.".."; } elseif(ord(substr($rst,strlen($rst)-1,1)) ==32) { $rst=substr($str,0,strlen($rst)-1); return $rst.".."; } else {return $rst."..";} } function str_cut3($str,$len,$f) { //한글글자수 기준 if($str=="") return ""; $realhan=0; $realeng=0; if(strlen($str) <= $len) { return $str; } $realen=0; $realcut=$len; for($i=0;$i<$realcut;$i++) { $char = ord(substr($str,$i,1)); if(($char > 127) || ($char == 32)) { $realcut++; $i++; $realhan++; } else {$realeng++;} } for($i=0;$i<strlen($str);$i++) { //실제 글자수 세기 $char = ord(substr($str,$i,1)); if(($char > 127)) { $i++; } $realen++; } $plus_eng=floor($realeng*$f); $rst=substr($str,0,$realcut); if($realen <= $len ) return $rst; //실제글자수가 설정한 글자수 보다 작으면 그냥 리턴 $rst=substr($str,0,$realcut+$plus_eng); if(ord(substr($rst,strlen($rst)-1,1)) >127) { $rst=substr($str,0,strlen($rst)-2); return $rst.".."; } elseif(ord(substr($rst,strlen($rst)-1,1)) ==32) { $rst=substr($str,0,strlen($rst)-1); return $rst.".."; } else {return $rst."..";} } function str_cutmo($str,$len) { //한글글자수 기준 if($str=="") return ""; $realhan=0; $realeng=0; if(strlen($str) <= $len) { return $str; } $realen=0; $realcut=$len; for($i=0;$i<$realcut;$i++) { $char = ord(substr($str,$i,1)); if($char > 127) { $realcut++; $i++; $realhan++; } else {$realeng++;} } for($i=0;$i<strlen($str);$i++) { //실제 글자수 세기 $char = ord(substr($str,$i,1)); if(($char > 127)) { $i++; } $realen++; } $plus_eng=floor($realeng*0.8); $rst=substr($str,0,$realcut); if($realen <= $len ) return $rst; //실제글자수가 설정한 글자수 보다 작으면 그냥 리턴 $rst=substr($str,0,$realcut+$plus_eng); if(ord(substr($rst,strlen($rst)-1,1)) >127) { $rst=substr($str,0,strlen($rst)-2); return $rst; } elseif(ord(substr($rst,strlen($rst)-1,1)) ==32) { $rst=substr($str,0,strlen($rst)-1); return $rst; } else {return $rst;} } //------------------------------------------------------------------------// function thumnail($file, $save_filename, $save_path, $max_width, $max_height) { // 전송받은 이미지 정보를 받는다 $img_info = getImageSize($file); // 전송받은 이미지의 포맷값 얻기 (gif, jpg png) if($img_info[2] == 1) { $src_img = ImageCreateFromGif($file); } else if($img_info[2] == 2) { $src_img = ImageCreateFromJPEG($file); } else if($img_info[2] == 3) { $src_img = ImageCreateFromPNG($file); } else { return 0; } // 전송받은 이미지의 실제 사이즈 값얻기 $img_width = ImageSX($src_img); $img_height = ImageSY($src_img); $DimgW; $DimgH; if(($img_width <= $max_width) && ($img_height <= $max_height)) { $DimgW = $img_width; $DimgH = $img_height; } else { //----------- 가로와 세로의 비율을 구한다 -----------------// /*----------------------------------------------------------------------------- 가로가 세로보다 크다면 가로 = 정해준 폭 dw 세로 = 정해준 폭 dw * 원본 이미지 세로 / 원본 이미지 가로 ------------------------------------------------------------------------------*/ if($img_width > $img_height) { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; if($DimgH > $max_height) { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; } } /*----------------------------------------------------------------------------- 세로가 가로보다 크다면 세로 = 정해준 높이 dh 가로 = 정해준 높이 dh * 원본 이미지 가로 / 원본 이미지 세로 ------------------------------------------------------------------------------*/ else if($img_width < $img_height) { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; if($DimgW > $max_width) { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; } } /*----------------------------------------------------------------------------- 세로와 세로가 같다면 세로 = h 가로 = w ------------------------------------------------------------------------------*/ else if($img_width == $img_height) { $DimgW=$max_width; $DimgH=$max_width; if($DimgH > $max_height) { $DimgH=$max_height; $DimgW=$max_height * $img_width / $img_height; } elseif($DimgW > $max_width) { $DimgW=$max_width; $DimgH=$max_width * $img_height / $img_width; } } } /* if($img_width > $max_width){ $max_height = ceil(($max_width / $img_width) * $img_height); } if($max_height > 60) $max_height=60; */ // 새로운 트루타입 이미지를 생성 $dst_img = imagecreatetruecolor($DimgW, $DimgH); // R255, G255, B255 값의 색상 인덱스를 만든다 ImageColorAllocate($dst_img, 255, 255, 255); // 이미지를 비율별로 만든후 새로운 이미지 생성 ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $DimgW, $DimgH, ImageSX($src_img),ImageSY($src_img)); // 알맞는 포맷으로 저장 if($img_info[2] == 1) { ImageInterlace($dst_img); ImageGif($dst_img, $save_path.$save_filename); } else if($img_info[2] == 2) { ImageInterlace($dst_img); ImageJPEG($dst_img, $save_path.$save_filename); } else if($img_info[2] == 3) { ImagePNG($dst_img, $save_path.$save_filename); } // 임시 이미지 삭제 ImageDestroy($dst_img); ImageDestroy($src_img); } function ShowCalendar($DateStr,$inputform) { if($DateStr=='') { $WDate=date("Y-m"); $tmpWD=explode("-",$WDate); $YYYY=$tmpWD[0]; $MM=$tmpWD[1]; } else { $tmpWD=explode("-",$DateStr); $YYYY=$tmpWD[0]; $MM=$tmpWD[1]; } $LastDay=date("t",mktime(0,0,1,$MM,1,$YYYY)); $StartWeekNum=date("w",mktime(0,0,1,$MM,1,$YYYY)); $PreMM=$MM-1; $PreYYYY=$YYYY; if($PreMM < 1) { $PreMM=12; $PreYYYY=$PreYYYY-1; } $AfterMM=$MM+1; $AfterYYYY=$YYYY; if($AfterMM > 12) { $AfterMM=1; $AfterYYYY=$AfterYYYY+1; } ?> <table cellpadding='5' cellspacing='3'> <tr><td colspan='7' align='center'><a onclick="GoPage('Calendar.php','inputform=<?=$inputform?>&CDate=<?=sprintf("%4d",$PreYYYY)."-".sprintf("%2d",$PreMM)?>','GET','Calendar',Callback_View_Div2,null);" style="cursor:hand">◁</a><?=$YYYY."년 ".sprintf("%02d",$MM)."월"?><a onclick="GoPage('Calendar.php','inputform=<?=$inputform?>&CDate=<?=sprintf("%4d",$AfterYYYY)."-".sprintf("%2d",$AfterMM)?>','GET','Calendar',Callback_View_Div2,null);" style="cursor:hand">▷</a></td></tr> <tr> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">일</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">월</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">화</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">수</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">목</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">금</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">토</td> </tr> <? if($StartWeekNum > 0) { echo "<tr>"; for($Col=1; $Col < $StartWeekNum+1; $Col++) echo "<td></td>\n"; } else {$Col=1;} for($xx=1;$xx <= $LastDay; $xx++) { if($Col==1) echo "<tr>\n"; $FullDate=$YYYY."-".sprintf("%02d",$MM)."-".sprintf("%02d",$xx); echo "<td align=center onmouseover=\"this.style.background='#FFFF46'\" onmouseout=\"this.style.background='#FFFFFF'\" onclick=\"document.".$inputform.".value='$FullDate'\" style='cursor:hand'>\n"; echo $xx; echo "</td>\n"; if($Col>=7) { echo "</tr>\n";$Col=1; } else {$Col++;} } if(($xx > $LastDay) && $Col < 7) { for($zz=$Col;$zz <= 7 ; $zz++) echo "<td></td>\n"; echo "</tr>\n"; } ?> </table> <?} function ShowCalendar_Count($DateStr,$inputform) { global $_SERVER; global $mode; global $d_y; global $d_m; global $d_d; if($DateStr=='') { $WDate=date("Y-m"); $tmpWD=explode("-",$WDate); $YYYY=$tmpWD[0]; $MM=$tmpWD[1]; } else { $tmpWD=explode("-",$DateStr); $YYYY=$tmpWD[0]; $MM=$tmpWD[1]; } $LastDay=date("t",mktime(0,0,1,$MM,1,$YYYY)); $StartWeekNum=date("w",mktime(0,0,1,$MM,1,$YYYY)); $PreMM=$MM-1; $PreYYYY=$YYYY; if($PreMM < 1) { $PreMM=12; $PreYYYY=$PreYYYY-1; } $AfterMM=$MM+1; $AfterYYYY=$YYYY; if($AfterMM > 12) { $AfterMM=1; $AfterYYYY=$AfterYYYY+1; } ?> <table cellpadding='5' cellspacing='3'> <tr><td colspan='7' align='center'><a onclick="GoPage('Calendar_Count.php','inputform=<?=$inputform?>&CDate=<?=sprintf("%4d",$PreYYYY)."-".sprintf("%2d",$PreMM)?>','GET','Calendar',Callback_View_Div2,null);" style="cursor:hand">◁</a><?=$YYYY."년 ".sprintf("%02d",$MM)."월"?><a onclick="GoPage('Calendar_Count.php','inputform=<?=$inputform?>&CDate=<?=sprintf("%4d",$AfterYYYY)."-".sprintf("%2d",$AfterMM)?>','GET','Calendar',Callback_View_Div2,null);" style="cursor:hand">▷</a></td></tr> <tr> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">일</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">월</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">화</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">수</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">목</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">금</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">토</td> </tr> <? if($StartWeekNum > 0) { echo "<tr>"; for($Col=1; $Col < $StartWeekNum+1; $Col++) echo "<td></td>\n"; } else {$Col=1;} for($xx=1;$xx <= $LastDay; $xx++) { if($Col==1) echo "<tr>\n"; $DD=sprintf("%02d",$xx); $FullDate=$YYYY."-".sprintf("%02d",$MM)."-".sprintf("%02d",$xx); echo "<td align=center onmouseover=\"this.style.background='#FFFF46'\" onmouseout=\"this.style.background='#FFFFFF'\" onclick=\"GoPage('Count_list.php','mode=$mode&d_y=$YYYY&d_m=$MM&d_d=$DD','GET','Center',Callback_View_Div2,null)\" style='cursor:hand'>\n"; echo $xx; echo "</td>\n"; if($Col>=7) { echo "</tr>\n";$Col=1; } else {$Col++;} } if(($xx > $LastDay) && $Col < 7) { for($zz=$Col;$zz <= 7 ; $zz++) echo "<td></td>\n"; echo "</tr>\n"; } ?> </table> <?} function ShowCalendar_Count_ip($DateStr,$inputform) { global $_SERVER; global $mode; global $d_y; global $d_m; global $d_d; if($DateStr=='') { $WDate=date("Y-m"); $tmpWD=explode("-",$WDate); $YYYY=$tmpWD[0]; $MM=$tmpWD[1]; } else { $tmpWD=explode("-",$DateStr); $YYYY=$tmpWD[0]; $MM=$tmpWD[1]; } $LastDay=date("t",mktime(0,0,1,$MM,1,$YYYY)); $StartWeekNum=date("w",mktime(0,0,1,$MM,1,$YYYY)); $PreMM=$MM-1; $PreYYYY=$YYYY; if($PreMM < 1) { $PreMM=12; $PreYYYY=$PreYYYY-1; } $AfterMM=$MM+1; $AfterYYYY=$YYYY; if($AfterMM > 12) { $AfterMM=1; $AfterYYYY=$AfterYYYY+1; } ?> <table cellpadding='5' cellspacing='3'> <tr><td colspan='7' align='center'><a onclick="GoPage('Calendar_Count_ip.php','inputform=<?=$inputform?>&CDate=<?=sprintf("%4d",$PreYYYY)."-".sprintf("%2d",$PreMM)?>','GET','Calendar',Callback_View_Div2,null);" style="cursor:hand">◁</a><?=$YYYY."년 ".sprintf("%02d",$MM)."월"?><a onclick="GoPage('Calendar_Count_ip.php','inputform=<?=$inputform?>&CDate=<?=sprintf("%4d",$AfterYYYY)."-".sprintf("%2d",$AfterMM)?>','GET','Calendar',Callback_View_Div2,null);" style="cursor:hand">▷</a></td></tr> <tr> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">일</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">월</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">화</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">수</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">목</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">금</td> <td align='center' style="background:#C0C0C0;border:1px #000000 solid">토</td> </tr> <? if($StartWeekNum > 0) { echo "<tr>"; for($Col=1; $Col < $StartWeekNum+1; $Col++) echo "<td></td>\n"; } else {$Col=1;} for($xx=1;$xx <= $LastDay; $xx++) { if($Col==1) echo "<tr>\n"; $DD=sprintf("%02d",$xx); $FullDate=$YYYY."-".sprintf("%02d",$MM)."-".sprintf("%02d",$xx); echo "<td align=center onmouseover=\"this.style.background='#FFFF46'\" onmouseout=\"this.style.background='#FFFFFF'\" onclick=\"GoPage('Count_ip_list.php','mode=$mode&d_y=$YYYY&d_m=$MM&d_d=$DD','GET','Center',Callback_View_Div2,null)\" style='cursor:hand'>\n"; echo $xx; echo "</td>\n"; if($Col>=7) { echo "</tr>\n";$Col=1; } else {$Col++;} } if(($xx > $LastDay) && $Col < 7) { for($zz=$Col;$zz <= 7 ; $zz++) echo "<td></td>\n"; echo "</tr>\n"; } ?> </table> <?} ?>