<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7630 | 10년 전 | 653 | ||
| 7629 |
|
10년 전 | 2394 | |
| 7628 | 10년 전 | 793 | ||
| 7627 |
|
10년 전 | 1034 | |
| 7626 |
|
10년 전 | 1789 | |
| 7625 | 10년 전 | 713 | ||
| 7624 | 10년 전 | 729 | ||
| 7623 |
|
10년 전 | 3097 | |
| 7622 | 10년 전 | 729 | ||
| 7621 |
leeleeleelee
|
10년 전 | 588 | |
| 7620 | 10년 전 | 540 | ||
| 7619 | 10년 전 | 494 | ||
| 7618 | 10년 전 | 1029 | ||
| 7617 | 10년 전 | 729 | ||
| 7616 | 10년 전 | 651 | ||
| 7615 | 10년 전 | 727 | ||
| 7614 | 10년 전 | 1267 | ||
| 7613 |
|
10년 전 | 2086 | |
| 7612 | 10년 전 | 1149 | ||
| 7611 | 10년 전 | 1419 | ||
| 7610 |
|
10년 전 | 1906 | |
| 7609 |
|
10년 전 | 1355 | |
| 7608 |
mwdkim
|
10년 전 | 1134 | |
| 7607 |
|
10년 전 | 1057 | |
| 7606 |
mwdkim
|
10년 전 | 3931 | |
| 7605 | 10년 전 | 695 | ||
| 7604 | 10년 전 | 1031 | ||
| 7603 | 10년 전 | 1654 | ||
| 7602 |
|
10년 전 | 1080 | |
| 7601 |
AniNest
|
10년 전 | 2795 | |
| 7600 |
port443
|
10년 전 | 1035 | |
| 7599 | 10년 전 | 947 | ||
| 7598 | 10년 전 | 1022 | ||
| 7597 | 10년 전 | 4577 | ||
| 7596 |
SeungYeon
|
10년 전 | 894 | |
| 7595 |
untitled
|
10년 전 | 2430 | |
| 7594 |
프로그래머7
|
10년 전 | 1734 | |
| 7593 |
untitled
|
10년 전 | 2372 | |
| 7592 |
untitled
|
10년 전 | 1946 | |
| 7591 |
untitled
|
10년 전 | 2679 | |
| 7590 |
아리마2001
|
10년 전 | 855 | |
| 7589 | 10년 전 | 1115 | ||
| 7588 |
|
10년 전 | 2923 | |
| 7587 | 10년 전 | 1307 | ||
| 7586 | 10년 전 | 673 | ||
| 7585 | 10년 전 | 1697 | ||
| 7584 | 10년 전 | 1414 | ||
| 7583 |
leeleeleelee
|
10년 전 | 1164 | |
| 7582 |
|
10년 전 | 1119 | |
| 7581 | 10년 전 | 1352 | ||
| 7580 | 10년 전 | 1001 | ||
| 7579 |
|
10년 전 | 610 | |
| 7578 | 10년 전 | 1432 | ||
| 7577 |
|
10년 전 | 1874 | |
| 7576 | 10년 전 | 1390 | ||
| 7575 |
멋진남자임
|
10년 전 | 1466 | |
| 7574 | 10년 전 | 2124 | ||
| 7573 | 10년 전 | 3260 | ||
| 7572 | 10년 전 | 761 | ||
| 7571 |
|
10년 전 | 784 | |
| 7570 |
|
10년 전 | 1318 | |
| 7569 | 10년 전 | 1554 | ||
| 7568 |
this1mg
|
10년 전 | 1054 | |
| 7567 |
|
10년 전 | 766 | |
| 7566 | 10년 전 | 920 | ||
| 7565 |
Angel하늘
|
10년 전 | 1013 | |
| 7564 |
seoldi
|
10년 전 | 1246 | |
| 7563 |
|
10년 전 | 1390 | |
| 7562 |
멋진남자임
|
10년 전 | 2090 | |
| 7561 | 10년 전 | 714 | ||
| 7560 |
leeleeleelee
|
10년 전 | 911 | |
| 7559 | 10년 전 | 5050 | ||
| 7558 |
RinaP
|
10년 전 | 787 | |
| 7557 |
|
10년 전 | 1250 | |
| 7556 | 10년 전 | 1197 | ||
| 7555 |
hyohyojj1234
|
10년 전 | 1666 | |
| 7554 | 10년 전 | 1096 | ||
| 7553 |
senseme
|
10년 전 | 1341 | |
| 7552 |
ehdltdoit
|
10년 전 | 1437 | |
| 7551 |
|
10년 전 | 1827 | |
| 7550 |
leeleeleelee
|
10년 전 | 1593 | |
| 7549 | 10년 전 | 2426 | ||
| 7548 | 10년 전 | 1847 | ||
| 7547 |
멋진남자임
|
10년 전 | 1963 | |
| 7546 | 10년 전 | 1007 | ||
| 7545 |
ILMare1003
|
10년 전 | 1293 | |
| 7544 |
|
10년 전 | 1256 | |
| 7543 | 10년 전 | 891 | ||
| 7542 | 10년 전 | 660 | ||
| 7541 |
울라라라우
|
10년 전 | 867 | |
| 7540 | 10년 전 | 1600 | ||
| 7539 | 10년 전 | 937 | ||
| 7538 |
|
10년 전 | 1834 | |
| 7537 | 10년 전 | 3615 | ||
| 7536 |
Gaumi
|
10년 전 | 1417 | |
| 7535 |
프로그램은어려워
|
10년 전 | 1277 | |
| 7534 |
senseme
|
10년 전 | 1208 | |
| 7533 | 10년 전 | 1205 | ||
| 7532 | 10년 전 | 860 | ||
| 7531 | 10년 전 | 2059 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기