<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 730 |
|
19년 전 | 2733 | |
| 729 |
그레이스웹
|
19년 전 | 3524 | |
| 728 |
|
19년 전 | 2708 | |
| 727 |
|
19년 전 | 2545 | |
| 726 |
|
19년 전 | 2363 | |
| 725 |
|
19년 전 | 2265 | |
| 724 |
|
19년 전 | 2149 | |
| 723 |
|
19년 전 | 4270 | |
| 722 |
|
19년 전 | 2696 | |
| 721 |
|
19년 전 | 2186 | |
| 720 |
|
19년 전 | 2287 | |
| 719 |
|
19년 전 | 2865 | |
| 718 |
|
19년 전 | 1973 | |
| 717 |
|
19년 전 | 3203 | |
| 716 |
|
19년 전 | 2764 | |
| 715 |
|
19년 전 | 2287 | |
| 714 |
|
19년 전 | 1842 | |
| 713 |
|
19년 전 | 2258 | |
| 712 |
|
19년 전 | 2019 | |
| 711 |
|
19년 전 | 1918 | |
| 710 |
|
19년 전 | 2493 | |
| 709 |
|
19년 전 | 2349 | |
| 708 |
|
19년 전 | 3903 | |
| 707 |
|
19년 전 | 3750 | |
| 706 |
|
19년 전 | 2254 | |
| 705 |
|
19년 전 | 3326 | |
| 704 |
|
19년 전 | 1996 | |
| 703 |
|
19년 전 | 2398 | |
| 702 |
|
19년 전 | 2291 | |
| 701 |
홀로남은자
|
19년 전 | 2359 | |
| 700 |
홀로남은자
|
19년 전 | 2189 | |
| 699 | 19년 전 | 2826 | ||
| 698 |
|
19년 전 | 2848 | |
| 697 |
|
19년 전 | 3188 | |
| 696 |
|
19년 전 | 3055 | |
| 695 |
|
19년 전 | 2729 | |
| 694 |
|
19년 전 | 2956 | |
| 693 |
|
19년 전 | 3206 | |
| 692 |
|
19년 전 | 2891 | |
| 691 |
|
19년 전 | 2636 | |
| 690 | 19년 전 | 2943 | ||
| 689 | 19년 전 | 4520 | ||
| 688 | 19년 전 | 2448 | ||
| 687 | 19년 전 | 2469 | ||
| 686 | 19년 전 | 3500 | ||
| 685 | 19년 전 | 3181 | ||
| 684 | 19년 전 | 2850 | ||
| 683 | 19년 전 | 2072 | ||
| 682 | 19년 전 | 1784 | ||
| 681 | 19년 전 | 2883 | ||
| 680 | 19년 전 | 1738 | ||
| 679 | 19년 전 | 2316 | ||
| 678 | 19년 전 | 3970 | ||
| 677 | 19년 전 | 3755 | ||
| 676 | 19년 전 | 3479 | ||
| 675 | 19년 전 | 3418 | ||
| 674 |
|
19년 전 | 1578 | |
| 673 |
|
19년 전 | 1942 | |
| 672 |
|
19년 전 | 1870 | |
| 671 | 19년 전 | 2536 | ||
| 670 | 19년 전 | 4649 | ||
| 669 |
|
19년 전 | 2779 | |
| 668 |
|
19년 전 | 1933 | |
| 667 |
|
19년 전 | 1954 | |
| 666 |
|
19년 전 | 1858 | |
| 665 |
|
19년 전 | 2590 | |
| 664 |
|
19년 전 | 8190 | |
| 663 |
|
19년 전 | 2744 | |
| 662 |
|
19년 전 | 2802 | |
| 661 |
|
19년 전 | 3059 | |
| 660 |
|
19년 전 | 2230 | |
| 659 |
|
19년 전 | 2249 | |
| 658 |
|
19년 전 | 2187 | |
| 657 |
|
19년 전 | 2092 | |
| 656 |
|
19년 전 | 2289 | |
| 655 |
|
19년 전 | 2545 | |
| 654 |
|
19년 전 | 3089 | |
| 653 | 19년 전 | 2340 | ||
| 652 | 19년 전 | 1924 | ||
| 651 |
|
19년 전 | 2866 | |
| 650 | 19년 전 | 5025 | ||
| 649 | 19년 전 | 3519 | ||
| 648 | 19년 전 | 3479 | ||
| 647 | 19년 전 | 2984 | ||
| 646 | 19년 전 | 2421 | ||
| 645 | 19년 전 | 1507 | ||
| 644 | 19년 전 | 3149 | ||
| 643 | 19년 전 | 2027 | ||
| 642 |
|
19년 전 | 5406 | |
| 641 | 19년 전 | 2442 | ||
| 640 | 19년 전 | 3441 | ||
| 639 | 19년 전 | 2879 | ||
| 638 | 19년 전 | 1771 | ||
| 637 | 19년 전 | 3884 | ||
| 636 | 19년 전 | 2436 | ||
| 635 | 19년 전 | 2324 | ||
| 634 |
|
19년 전 | 3029 | |
| 633 |
|
19년 전 | 3312 | |
| 632 | 19년 전 | 2519 | ||
| 631 | 19년 전 | 2277 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기