이 소스로 한번 바꿔보아는데.. > 자유게시판

자유게시판

이 소스로 한번 바꿔보아는데.. 정보

이 소스로 한번 바꿔보아는데..

본문

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("./_common.php");

$sql = " select bo_count_write from $g4[board_table] where bo_table = '05_3' ";
$bbs1 = sql_fetch($sql);

$sql = " select bo_count_write from $g4[board_table] where bo_table = '06_1' ";
$bbs2 = sql_fetch($sql);

//exp_bar
function exp_bar($level) {
  global $g4;
  
  $point = $level;
  $level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함.
  if($level < 1) $level = 1;
  if ($level > 154) $level = 154;
  $no = sprintf("%03d", $level);
  $max = $level * $bbs2['bo_count_write']; 
     $bar = (int)($point / $max * 100);
        $graph = $bar."%";

  echo "<table width='133' border='0' cellspacing='0' cellpadding='0' align='center'><tr height=30><td width='33'><img src='$g4[path]/img/class.gif'></td><td width='20' align='right'><img src='$g4[path]/img/l/{$no}.gif'></td><td align='right'><font color='#B3D4F8'>$point</font>/$max</td></tr><tr><td colspan='2'><img src='$g4[path]/img/exp.gif'></td><td align='right'>$graph</td></tr><tr height='11'><td colspan='3' background='$g4[path]/img/exp_bar.gif'><table width='133' height='11' border='0' cellspacing='0' cellpadding='0'><tr height='1'><td colspan='1'></td></tr><tr height='8'><td width='1'></td><td width='130'><img src='$g4[path]/img/exp_in.gif' width='$graph' height='8'></td><td width='2'></td></tr><tr colspan='3'></table></td></tr></table>";
}

?>


뭐가 문제인지 지적과 수정 좀 부탁 드려도 되련지..ㅠㅠ
아니.. 한수 가르쳐주세여..ㅠㅠ
초보자의 설움..ㅠㅠㅠㅠㅠ

추천
0

댓글 23개

기본으로 게시판 두게를 생성하여서요
그 두개의 게시물 수로 평균값을 뽑으려고 합니다
그러니깐.. 예를들어서 게시판은1은 행복한것만 올리구요
게시판2는 나쁜것만 올리구요
나쁜게 더 많으면 평균값 퍼센트는 낮아지고
좋은것 많으면 평균값 퍼센트는 높아지고..
100%를 기준으로 해서요..ㅠㅠ
$level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함.

일단 $bbs1 , $bbs2 배열이 함수내에서 선언이 안돼어 있네욜,,

global $g4,$bbs1,$bbs2;
오류메시지는 없어요
그냥 흰공백.. 결과값이 안나오네여.ㅠㅠㅠ
그냥. 01happy.php 만들어서 그누디렉토리에 업로드해서 실행했어요
이랬더니.. 결과 무 흰공백만..ㅠㅠㅠ
<?
// if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가  주석 처리
include_once("./_common.php");

$sql = " select bo_count_write from $g4[board_table] where bo_table = '05_3' ";
$bbs1 = sql_fetch($sql);

$sql = " select bo_count_write from $g4[board_table] where bo_table = '06_1' ";
$bbs2 = sql_fetch($sql);
$level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함. 새로 추가
exp_bar($level); // 새로 추가

//exp_bar
function exp_bar($level) {
  global $g4,$bbs2; // $bbs2 추가
 
  $point = $level;
//  $level = ceil($bbs1['bo_count_write'] / $bbs2['bo_count_write']); //반올림을 하여 레벨을 구함. 주석 처리
  if($level < 1) $level = 1;
  if ($level > 154) $level = 154;
  $no = sprintf("%03d", $level);
  $max = $level * $bbs2['bo_count_write'];
    $bar = (int)($point / $max * 100);
        $graph = $bar."%";

  echo "<table width='133' border='0' cellspacing='0' cellpadding='0' align='center'><tr height=30><td width='33'><img src='$g4[path]/img/class.gif'></td><td width='20' align='right'><img src='$g4[path]/img/l/{$no}.gif'></td><td align='right'><font color='#B3D4F8'>$point</font>/$max</td></tr><tr><td colspan='2'><img src='$g4[path]/img/exp.gif'></td><td align='right'>$graph</td></tr><tr height='11'><td colspan='3' background='$g4[path]/img/exp_bar.gif'><table width='133' height='11' border='0' cellspacing='0' cellpadding='0'><tr height='1'><td colspan='1'></td></tr><tr height='8'><td width='1'></td><td width='130'><img src='$g4[path]/img/exp_in.gif' width='$graph' height='8'></td><td width='2'></td></tr><tr colspan='3'></table></td></tr></table>";
}

?>

이 소스로 갈아타보세욜
네..
죄송해요..
덕분에 잘 나와요..ㅠㅠ
진념님 한가지더 질문 좀 할게요
그게 뭐냐면요
100%기준으로 $bbs1 이건 좋은것.. $bbs2 이건 나쁜걸루 해서요
나쁜건 퍼센트가 줄여지게 하려면 어떻게 하나요..ㅠㅠ
http://cutiey.pe.kr/ybnara/01happy.php
퍼센트로 그래픽으로 출력이 되잖아요
거기서 두번째게시판은 불만게시판이라서..
퍼센트에서 제외하고 싶다는 말이였어요..ㅠㅠ
그리고 퍼센트가 딱 100퍼센트까지만 기록하려면 어떻게 하나요
전체 199,644 |RSS
자유게시판 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT