$lenth){ //만일 자르게 된다면 표시 $ok=1;} $str = trim($str); $backcnt= 0; // 시작첫글자에서 뒤로간 byte 수 (space나 영/숫자가 나올때 까지) $cntcheck =0; if ($start>0 ){ if(ord($str[$start]) >= 128) { // 첫 시작글자가 한글이면 for ($i=$start;$i>0;$i--) { if (ord($str[$i]) >= 128){ $backcnt++; }else{ break; } } $start= ($backcnt%2) ? $start : $start-1; //첫글짜가 깨지면, 시작점 = (시작 byte -1byte) if (($backcnt%2)==1){ $cntcheck = 0; //문장 시작 첫글자 안짤림 }else{ $cntcheck = 1; //문장 시작 첫글자 짤림 } } } $backcnt2= 0; // 마지막글자에서 뒤로간 byte 수 (space나 영/숫자가 나올때 까지) for ($i=($len-1);$i>=0;$i--) { if (ord($str[$i+$start]) >= 128){ $backcnt2++; }else{ break; } } if (($backcnt2%2)==1){ $cntcheck2 = 1; //문장 마지막 글자 짤림 }else{ $cntcheck2 = 0; //문장 마지막 글자 안짤림 } (int)$cnt=$len-abs($backcnt2%2); //자를 문자열 길이 (byte) if(($cntcheck+$cntcheck2)==2) $cnt+=2; //$cntcheck가 짤리고, $cntcheck2가 짤리는 경우 $cutstr = substr($str,$start,$cnt); if ($ok){$cutstr .= "...";} ///잘랐을 경우에만 끝에 ... 붙임 return $cutstr; } // -------------------------- 글자수 자르는 함수 끝 -------------------------------------------// $url = "./best_funzone.html?dst=$dst"; $url1=$url."&mode=1"; $url2=$url."&mode=2"; // ------- 이번달 구함 ------ // //$vars=time(); //$get_time=date("Y-m",$vars); // -------------------------- // //$monday=date("Y-m-d",strtotime("last Monday")); // 이번주 월요일 날짜 //$sunday=date("Y-m-d",strtotime("Sunday")); // 이번주 일요일 날짜 $get_time = date("Y-m", time()); $today = date("Y-m-d"); $day7 = date("Y-m-d", time()-7*24*60*60); if($mode == 2){ $date_string="and left(wr_datetime,7)='$get_time'"; } else{ $date_string="and (left(wr_datetime,10) >= '$day7' and left(wr_datetime,10) <= '$today')"; } $out_re1=@mysql_fetch_array(mysql_query("select * from dg_write_racinggirl1 where wr_is_comment='0' and ca_name ='국내레이싱걸' $date_string order by wr_hit desc limit 0,1")); $out_re2=@mysql_fetch_array(mysql_query("select * from dg_write_racinggirl1 where wr_is_comment='0' and ca_name ='해외레이싱걸' $date_string order by wr_hit desc limit 0,1")); $out_re3=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='Best심리테스트' $date_string order by wr_hit desc limit 0,1")); $out_re4=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='New심리테스트' $date_string order by wr_hit desc limit 0,1")); $out_re5=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='연애/우정' $date_string order by wr_hit desc limit 0,1")); $out_re6=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='행동' $date_string order by wr_hit desc limit 0,1")); $out_re7=@mysql_fetch_array(mysql_query("select * from dg_write_humor where wr_is_comment='0' and ca_name ='웃긴동영상' $date_string order by wr_hit desc limit 0,1")); $out_re8=@mysql_fetch_array(mysql_query("select * from dg_write_humor where wr_is_comment='0' and ca_name ='웃긴사진' $date_string order by wr_hit desc limit 0,1")); $out_re9=@mysql_fetch_array(mysql_query("select * from dg_write_humor where wr_is_comment='0' and ca_name ='유머글' $date_string order by wr_hit desc limit 0,1")); $out_re10=@mysql_fetch_array(mysql_query("select * from dg_write_window where wr_is_comment='0' $date_string order by wr_hit desc limit 0,1")); if($out_re1[wr_id] == ""){ $out_re1=@mysql_fetch_array(mysql_query("select * from dg_write_racinggirl1 where wr_is_comment='0' and ca_name ='국내레이싱걸' order by wr_hit desc limit 0,1")); } if($out_re2[wr_id] == ""){ $out_re2=@mysql_fetch_array(mysql_query("select * from dg_write_racinggirl1 where wr_is_comment='0' and ca_name ='해외레이싱걸' order by wr_hit desc limit 0,1")); } if($out_re3[wr_id] == ""){ $out_re3=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='Best심리테스트' order by wr_hit desc limit 0,1")); } if($out_re4[wr_id] == ""){ $out_re4=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='New심리테스트' order by wr_hit desc limit 0,1")); } if($out_re5[wr_id] == ""){ $out_re5=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='연애/우정' order by wr_hit desc limit 0,1")); } if($out_re6[wr_id] == ""){ $out_re6=@mysql_fetch_array(mysql_query("select * from dg_write_mental where wr_is_comment='0' and ca_name ='행동' order by wr_hit desc limit 0,1")); } if($out_re7[wr_id] == ""){ $out_re7=@mysql_fetch_array(mysql_query("select * from dg_write_humor where wr_is_comment='0' and ca_name ='웃긴동영상' order by wr_hit desc limit 0,1")); } if($out_re8[wr_id] == ""){ $out_re8=@mysql_fetch_array(mysql_query("select * from dg_write_humor where wr_is_comment='0' and ca_name ='웃긴사진' order by wr_hit desc limit 0,1")); } if($out_re9[wr_id] == ""){ $out_re9=@mysql_fetch_array(mysql_query("select * from dg_write_humor where wr_is_comment='0' and ca_name ='유머글' order by wr_hit desc limit 0,1")); } if($out_re10[wr_id] == ""){ $out_re10=@mysql_fetch_array(mysql_query("select * from dg_write_window where wr_is_comment='0' order by wr_hit desc limit 0,1")); } //echo $_GET[wr_id]; if($out_re1[wr_id] == $_GET[wr_id]){ $b_select1_1=""; $b_select1_2=""; } else{ $b_select1_1=""; $b_select1_2=""; } if($out_re2[wr_id] == $_GET[wr_id]){ $b_select2_1=""; $b_select2_2=""; } else{ $b_select2_1=""; $b_select2_2=""; } if($out_re3[wr_id] == $_GET[wr_id]){ $b_select3_1=""; $b_select3_2=""; } else{ $b_select3_1=""; $b_select3_2=""; } if($out_re4[wr_id] == $_GET[wr_id]){ $b_select4_1=""; $b_select4_2=""; } else{ $b_select4_1=""; $b_select4_2=""; } if($out_re5[wr_id] == $_GET[wr_id]){ $b_select5_1=""; $b_select5_2=""; } else{ $b_select5_1=""; $b_select5_2=""; } if($out_re6[wr_id] == $_GET[wr_id]){ $b_select6_1=""; $b_select6_2=""; } else{ $b_select6_1=""; $b_select6_2=""; } if($out_re7[wr_id] == $_GET[wr_id]){ $b_select7_1=""; $b_select7_2=""; } else{ $b_select7_1=""; $b_select7_2=""; } if($out_re8[wr_id] == $_GET[wr_id]){ $b_select8_1=""; $b_select8_2=""; } else{ $b_select8_1=""; $b_select8_2=""; } if($out_re9[wr_id] == $_GET[wr_id]){ $b_select9_1=""; $b_select9_2=""; } else{ $b_select9_1=""; $b_select9_2=""; } if($out_re10[wr_id] == $_GET[wr_id]){ $b_select10_1=""; $b_select10_2=""; } else{ $b_select10_1=""; $b_select10_2=""; } $subject1=substr2($out_re1[wr_subject],0,24); $subject2=substr2($out_re2[wr_subject],0,24); $subject3=substr2($out_re3[wr_subject],0,24); $subject4=substr2($out_re4[wr_subject],0,24); $subject5=substr2($out_re5[wr_subject],0,24); $subject6=substr2($out_re6[wr_subject],0,24); $subject7=substr2($out_re7[wr_subject],0,24); $subject8=substr2($out_re8[wr_subject],0,24); $subject9=substr2($out_re9[wr_subject],0,24); $subject10=substr2($out_re10[wr_subject],0,24); $sca1=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re1[ca_name]' ")); $sca2=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re2[ca_name]' ")); $sca3=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re3[ca_name]' ")); $sca4=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re4[ca_name]' ")); $sca5=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re5[ca_name]' ")); $sca6=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re6[ca_name]' ")); $sca7=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re7[ca_name]' ")); $sca8=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re8[ca_name]' ")); $sca9=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re9[ca_name]' ")); $sca10=@mysql_fetch_array(mysql_query("select * from twi_sca where sca='$out_re10[ca_name]' ")); $link1="../board.php?bo_table=racinggirl1&wr_id=".$out_re1[wr_id]."&sca=".$sca1[sca_id]."&navi=0"; $link2="../board.php?bo_table=racinggirl1&wr_id=".$out_re2[wr_id]."&sca=".$sca2[sca_id]."&navi=0"; $link3="../board.php?bo_table=mental&wr_id=".$out_re3[wr_id]."&sca=".$sca3[sca_id]."&navi=0"; $link4="../board.php?bo_table=mental&wr_id=".$out_re4[wr_id]."&sca=".$sca4[sca_id]."&navi=0"; $link5="../board.php?bo_table=mental&wr_id=".$out_re5[wr_id]."&sca=".$sca5[sca_id]."&navi=0"; $link6="../board.php?bo_table=mental&wr_id=".$out_re6[wr_id]."&sca=".$sca6[sca_id]."&navi=0"; $link7="../board.php?bo_table=humor&wr_id=".$out_re7[wr_id]."&sca=".$sca7[sca_id]."&navi=0"; $link8="../board.php?bo_table=humor&wr_id=".$out_re8[wr_id]."&sca=".$sca8[sca_id]."&navi=0"; $link9="../board.php?bo_table=humor&wr_id=".$out_re9[wr_id]."&sca=".$sca9[sca_id]."&navi=0"; $link10="../board.php?bo_table=window&wr_id=".$out_re10[wr_id]."&sca=".$sca10[sca_id]."&navi=0"; if($mode == 1){ $imgs1="../images/renewimage/fun_tap_10_over.gif"; $imgs2="../images/renewimage/fun_tap_11.gif"; } else{ $imgs1="../images/renewimage/fun_tap_10.gif"; $imgs2="../images/renewimage/fun_tap_11_over.gif"; } ?>
펀존 Best 게시물
주간best월간best