<?
include 'Main.asp';
$objMain = new Main($dbconn); //dbconn커넥션을 인자로 전달합니다.
$arrData = $objMain->listBoard($board_name, $bid, $num, $str_length); //게시판 이름, 멀티보드일경우 인자값, 리스트에 출력될 게시물 수, 타이틀이 보여질 글자수
//에러 검출용 함수 사용시
$objMain->printErr();
for($i=0; i<count($arrData); i++){
echo $arrData[i][title]; //해당 필드를 나열해 주시면 됩니다.
}
/////////////////////////////
// - class.Main.php
/////////////////////////////
class Main
{
var $dbconn;
var $sql;
var $error_msg;
function Main($dbconn){
$this->dbconn = $dbconn;
}
function listBoard($board_name, $bid, $num=3, $str_length=50){
$this->sql = "select uid, title, doc, left(content,100) as content, (date_sub(curdate(), interval 5 DAY)<=wdate) as is_new
from $board_name
where bid=$bid
order by wdate desc limit $num";
$result = mysql_query($this->sql, $this->dbconn);
if($result){
$i=0;
while($row = mysql_fetch_object($result)){
$info[$i][uid] = $row->uid;
$info[$i][title] = stripslashes($row->title);
$info[$i][content] = stripslashes($row->content);
$info[$i][is_new] = $row->is_new;
$info[$i][doc] = $row->doc;
if(strlen($info[$i][title]) > $str_length)
$info[$i][title] = $this->ksubstr($info[$i][title],0,$str_length);
if($info[$i][is_new])
$info[$i][title] .= ' <img src="images/btn_new.gif" border="0">';
$i++;
}
return $info;
}
else {
$this->error_msg = mysql_error();
return false;
}
}
function printErr(){
echo "<br>SQL : ".$this->sql;
echo "<br>ERR : ".$this->error_msg;
}
// 한글용 ksubstr //
function ksubstr($string,$start,$length){
if($length>=strlen($string)) return $string;
$klen=$length-1;
while(ord($string[$klen]) & 0x80) $klen--;
return $add.substr($string,$start,$length-(($length+$klen+1)%2));
}
}
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
include 'Main.asp';
$objMain = new Main($dbconn); //dbconn커넥션을 인자로 전달합니다.
$arrData = $objMain->listBoard($board_name, $bid, $num, $str_length); //게시판 이름, 멀티보드일경우 인자값, 리스트에 출력될 게시물 수, 타이틀이 보여질 글자수
//에러 검출용 함수 사용시
$objMain->printErr();
for($i=0; i<count($arrData); i++){
echo $arrData[i][title]; //해당 필드를 나열해 주시면 됩니다.
}
/////////////////////////////
// - class.Main.php
/////////////////////////////
class Main
{
var $dbconn;
var $sql;
var $error_msg;
function Main($dbconn){
$this->dbconn = $dbconn;
}
function listBoard($board_name, $bid, $num=3, $str_length=50){
$this->sql = "select uid, title, doc, left(content,100) as content, (date_sub(curdate(), interval 5 DAY)<=wdate) as is_new
from $board_name
where bid=$bid
order by wdate desc limit $num";
$result = mysql_query($this->sql, $this->dbconn);
if($result){
$i=0;
while($row = mysql_fetch_object($result)){
$info[$i][uid] = $row->uid;
$info[$i][title] = stripslashes($row->title);
$info[$i][content] = stripslashes($row->content);
$info[$i][is_new] = $row->is_new;
$info[$i][doc] = $row->doc;
if(strlen($info[$i][title]) > $str_length)
$info[$i][title] = $this->ksubstr($info[$i][title],0,$str_length);
if($info[$i][is_new])
$info[$i][title] .= ' <img src="images/btn_new.gif" border="0">';
$i++;
}
return $info;
}
else {
$this->error_msg = mysql_error();
return false;
}
}
function printErr(){
echo "<br>SQL : ".$this->sql;
echo "<br>ERR : ".$this->error_msg;
}
// 한글용 ksubstr //
function ksubstr($string,$start,$length){
if($length>=strlen($string)) return $string;
$klen=$length-1;
while(ord($string[$klen]) & 0x80) $klen--;
return $add.substr($string,$start,$length-(($length+$klen+1)%2));
}
}
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 130 | ||
| 8229 | 9년 전 | 121 | ||
| 8228 |
커네드커네드
|
9년 전 | 161 | |
| 8227 | 9년 전 | 207 | ||
| 8226 | 9년 전 | 223 | ||
| 8225 | 9년 전 | 199 | ||
| 8224 | 9년 전 | 197 | ||
| 8223 | 9년 전 | 174 | ||
| 8222 |
|
9년 전 | 248 | |
| 8221 | 9년 전 | 156 | ||
| 8220 | 9년 전 | 187 | ||
| 8219 | 9년 전 | 154 | ||
| 8218 | 9년 전 | 195 | ||
| 8217 |
star3840
|
9년 전 | 161 | |
| 8216 | 9년 전 | 234 | ||
| 8215 | 9년 전 | 182 | ||
| 8214 | 9년 전 | 290 | ||
| 8213 | 9년 전 | 242 | ||
| 8212 | 9년 전 | 152 | ||
| 8211 | 9년 전 | 328 | ||
| 8210 | 9년 전 | 330 | ||
| 8209 | 9년 전 | 400 | ||
| 8208 | 9년 전 | 298 | ||
| 8207 | 9년 전 | 296 | ||
| 8206 |
|
9년 전 | 251 | |
| 8205 | 9년 전 | 231 | ||
| 8204 | 9년 전 | 209 | ||
| 8203 | 9년 전 | 284 | ||
| 8202 | 9년 전 | 200 | ||
| 8201 | 9년 전 | 248 | ||
| 8200 | 9년 전 | 246 | ||
| 8199 | 9년 전 | 262 | ||
| 8198 | 9년 전 | 233 | ||
| 8197 | 9년 전 | 224 | ||
| 8196 | 9년 전 | 628 | ||
| 8195 | 9년 전 | 227 | ||
| 8194 | 9년 전 | 340 | ||
| 8193 | 9년 전 | 242 | ||
| 8192 | 9년 전 | 264 | ||
| 8191 | 9년 전 | 210 | ||
| 8190 | 9년 전 | 209 | ||
| 8189 | 9년 전 | 268 | ||
| 8188 | 9년 전 | 202 | ||
| 8187 | 9년 전 | 202 | ||
| 8186 | 9년 전 | 205 | ||
| 8185 | 9년 전 | 372 | ||
| 8184 | 9년 전 | 162 | ||
| 8183 | 9년 전 | 387 | ||
| 8182 | 9년 전 | 244 | ||
| 8181 | 9년 전 | 193 | ||
| 8180 | 9년 전 | 774 | ||
| 8179 | 9년 전 | 544 | ||
| 8178 | 9년 전 | 398 | ||
| 8177 |
kiplayer
|
9년 전 | 398 | |
| 8176 | 9년 전 | 430 | ||
| 8175 | 9년 전 | 312 | ||
| 8174 | 9년 전 | 313 | ||
| 8173 | 9년 전 | 400 | ||
| 8172 | 9년 전 | 276 | ||
| 8171 | 9년 전 | 241 | ||
| 8170 | 9년 전 | 366 | ||
| 8169 |
커네드커네드
|
9년 전 | 314 | |
| 8168 | 9년 전 | 394 | ||
| 8167 | 9년 전 | 385 | ||
| 8166 | 9년 전 | 288 | ||
| 8165 | 9년 전 | 236 | ||
| 8164 | 9년 전 | 367 | ||
| 8163 | 9년 전 | 358 | ||
| 8162 | 9년 전 | 364 | ||
| 8161 | 9년 전 | 380 | ||
| 8160 |
|
9년 전 | 576 | |
| 8159 | 9년 전 | 517 | ||
| 8158 | 9년 전 | 325 | ||
| 8157 | 9년 전 | 433 | ||
| 8156 | 9년 전 | 320 | ||
| 8155 | 9년 전 | 312 | ||
| 8154 |
00년생용띠
|
9년 전 | 654 | |
| 8153 | 9년 전 | 297 | ||
| 8152 |
|
9년 전 | 479 | |
| 8151 | 9년 전 | 472 | ||
| 8150 | 9년 전 | 581 | ||
| 8149 |
Jangfolk
|
9년 전 | 430 | |
| 8148 | 9년 전 | 248 | ||
| 8147 | 9년 전 | 445 | ||
| 8146 | 9년 전 | 526 | ||
| 8145 | 9년 전 | 471 | ||
| 8144 | 9년 전 | 436 | ||
| 8143 | 9년 전 | 270 | ||
| 8142 | 9년 전 | 488 | ||
| 8141 | 9년 전 | 434 | ||
| 8140 | 9년 전 | 990 | ||
| 8139 | 9년 전 | 341 | ||
| 8138 |
전갈자리남자
|
9년 전 | 449 | |
| 8137 | 9년 전 | 483 | ||
| 8136 | 9년 전 | 812 | ||
| 8135 |
|
9년 전 | 848 | |
| 8134 |
PlayPixel
|
9년 전 | 589 | |
| 8133 |
|
9년 전 | 505 | |
| 8132 | 9년 전 | 538 | ||
| 8131 | 9년 전 | 889 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기