<?
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>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1530 |
1111111
|
18년 전 | 1953 | |
| 1529 |
행복속네잎크로버
|
18년 전 | 3448 | |
| 1528 |
행복속네잎크로버
|
18년 전 | 1829 | |
| 1527 |
1111111
|
18년 전 | 7639 | |
| 1526 |
1111111
|
18년 전 | 3285 | |
| 1525 |
행복속네잎크로버
|
18년 전 | 1269 | |
| 1524 |
행복속네잎크로버
|
18년 전 | 2300 | |
| 1523 |
행복속네잎크로버
|
18년 전 | 3502 | |
| 1522 |
행복속네잎크로버
|
18년 전 | 2359 | |
| 1521 |
행복속네잎크로버
|
18년 전 | 2126 | |
| 1520 |
행복속네잎크로버
|
18년 전 | 2758 | |
| 1519 |
행복속네잎크로버
|
18년 전 | 3717 | |
| 1518 |
행복속네잎크로버
|
18년 전 | 3481 | |
| 1517 |
행복속네잎크로버
|
18년 전 | 2559 | |
| 1516 |
행복속네잎크로버
|
18년 전 | 1910 | |
| 1515 |
행복속네잎크로버
|
18년 전 | 1929 | |
| 1514 |
행복속네잎크로버
|
18년 전 | 2503 | |
| 1513 |
행복속네잎크로버
|
18년 전 | 1981 | |
| 1512 | 18년 전 | 2868 | ||
| 1511 | 18년 전 | 1659 | ||
| 1510 | 18년 전 | 2206 | ||
| 1509 | 18년 전 | 1679 | ||
| 1508 | 18년 전 | 2137 | ||
| 1507 | 18년 전 | 2356 | ||
| 1506 | 18년 전 | 2292 | ||
| 1505 | 18년 전 | 2245 | ||
| 1504 | 18년 전 | 2174 | ||
| 1503 | 18년 전 | 3483 | ||
| 1502 | 18년 전 | 1664 | ||
| 1501 | 18년 전 | 3440 | ||
| 1500 | 18년 전 | 2020 | ||
| 1499 | 18년 전 | 5291 | ||
| 1498 | 18년 전 | 2150 | ||
| 1497 |
hsp1980
|
18년 전 | 2330 | |
| 1496 |
hsp1980
|
18년 전 | 1723 | |
| 1495 |
hsp1980
|
18년 전 | 2132 | |
| 1494 |
hsp1980
|
18년 전 | 3644 | |
| 1493 | 18년 전 | 1498 | ||
| 1492 | 18년 전 | 1737 | ||
| 1491 | 18년 전 | 4317 | ||
| 1490 | 18년 전 | 3703 | ||
| 1489 | 18년 전 | 3263 | ||
| 1488 | 18년 전 | 3363 | ||
| 1487 |
mixdesign
|
18년 전 | 3863 | |
| 1486 |
mixdesign
|
18년 전 | 4323 | |
| 1485 | 18년 전 | 4246 | ||
| 1484 | 18년 전 | 2700 | ||
| 1483 |
hsp1980
|
18년 전 | 2309 | |
| 1482 |
hsp1980
|
18년 전 | 3245 | |
| 1481 |
hsp1980
|
18년 전 | 3162 | |
| 1480 |
hsp1980
|
18년 전 | 3317 | |
| 1479 | 18년 전 | 3255 | ||
| 1478 |
|
18년 전 | 4921 | |
| 1477 |
|
18년 전 | 5205 | |
| 1476 | 18년 전 | 3405 | ||
| 1475 |
mixdesign
|
18년 전 | 2716 | |
| 1474 |
mixdesign
|
18년 전 | 2939 | |
| 1473 |
mixdesign
|
18년 전 | 2266 | |
| 1472 |
mixdesign
|
18년 전 | 2084 | |
| 1471 |
mixdesign
|
18년 전 | 2034 | |
| 1470 |
|
18년 전 | 3072 | |
| 1469 |
mixdesign
|
18년 전 | 2352 | |
| 1468 |
mixdesign
|
18년 전 | 2369 | |
| 1467 |
mixdesign
|
18년 전 | 2049 | |
| 1466 |
mixdesign
|
18년 전 | 2419 | |
| 1465 |
mixdesign
|
18년 전 | 3151 | |
| 1464 | 18년 전 | 4081 | ||
| 1463 | 18년 전 | 3369 | ||
| 1462 |
|
18년 전 | 1998 | |
| 1461 |
|
18년 전 | 1939 | |
| 1460 | 18년 전 | 2856 | ||
| 1459 | 18년 전 | 1649 | ||
| 1458 |
|
18년 전 | 2000 | |
| 1457 |
mixdesign
|
18년 전 | 2292 | |
| 1456 |
mixdesign
|
18년 전 | 2156 | |
| 1455 | 18년 전 | 2263 | ||
| 1454 | 18년 전 | 4033 | ||
| 1453 | 18년 전 | 1773 | ||
| 1452 | 18년 전 | 4387 | ||
| 1451 | 18년 전 | 2917 | ||
| 1450 | 18년 전 | 2216 | ||
| 1449 | 18년 전 | 3267 | ||
| 1448 | 18년 전 | 2894 | ||
| 1447 | 18년 전 | 2823 | ||
| 1446 | 18년 전 | 5625 | ||
| 1445 | 18년 전 | 2291 | ||
| 1444 | 18년 전 | 3408 | ||
| 1443 |
|
18년 전 | 3321 | |
| 1442 | 18년 전 | 3707 | ||
| 1441 | 18년 전 | 3262 | ||
| 1440 | 18년 전 | 2437 | ||
| 1439 | 18년 전 | 2086 | ||
| 1438 | 18년 전 | 2538 | ||
| 1437 | 18년 전 | 6107 | ||
| 1436 | 18년 전 | 2732 | ||
| 1435 | 18년 전 | 4544 | ||
| 1434 | 18년 전 | 2041 | ||
| 1433 | 18년 전 | 10028 | ||
| 1432 | 18년 전 | 2475 | ||
| 1431 |
Psychedelico
|
18년 전 | 1538 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기