Example #1
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork(true);
$errMsg = "";
try {
    //$_POST : ['post_id'], ['tbl_kind'], ['user_id'], ['comment_id']
    $brdWork->createWork($_POST, true);
    //댓글 추가
    $res = $brdWork->requestCommentDelete();
    $brdWork->destoryWork();
    if ($res) {
        $res = 'y';
    } else {
        $res = 'n';
        $errMsg = '댓글 삭제 실패!';
    }
} catch (Exception $e) {
    $brdWork->destoryWork();
    $res = 'n';
    $errMsg = $e->getMessage();
    Util::serverLog($e);
}
echo "<result><code>{$res}</code><data>{$errMsg}</data></result>";
Example #2
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdPost = null;
$contents = $_GET['contents'];
try {
    $brdWork->createWork($_GET, $chk);
    $brdPost = $brdWork->requestPost();
    $infoPost_prev = $brdWork->fetchArrayRow();
    $infoPost_next = $brdWork->fetchArrayRow();
    if ($brdPost == null) {
        throw new Exception('Board view error.');
    }
    $brdWork->destoryWork();
    $tblKind = $_GET['tbl_kind'];
    $pg_inx = $_GET['pg_inx'];
} catch (Exception $e) {
    $brdWork->destoryWork();
    echo $e->getMessage();
    exit;
}
?>


	<?php 
require '../common/content_iframe_header.html';
?>
	<script>
Example #3
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork(true);
try {
    //$_POST : [brd_title], [brd_message], [post_id], [tbl_kind], [poster_uid]
    $brdWork->createWork($_POST, true);
    $wtype = $_POST['wtype'];
    if ($wtype == 3) {
        //게시글 수정인 경우 작성자의 user_id 가 넘어온다.
        $res = $brdWork->requestEdit2();
    } else {
        //새글이나 답글 추가
        $res = $brdWork->requestInsert2();
    }
    $brdWork->destoryWork();
    if ($res) {
        if ($wtype == 3) {
            header("Location:../../view/board/board_list_faq.php?tbl_kind=" . $_POST['tbl_kind'] . "&pg_inx=" . $_POST['pg_inx'] . "&t_idx=" . $_POST['t_idx']);
        } else {
            header("Location:../../view/board/board_list_faq.php?tbl_kind=" . $_POST['tbl_kind'] . "&pg_inx=1&t_idx=" . $_POST['t_idx']);
        }
    } else {
        echo "board write fail!";
    }
} catch (Exception $e) {
    $brdWork->destoryWork();
    Util::serverLog($e);
    echo $e->getMessage();
Example #4
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork(true);
try {
    //$_POST : ['post_id'], ['tbl_kind'], ['cmt_message']
    $brdWork->createWork($_POST, true);
    //댓글 추가
    $cmtid = $brdWork->requestCommentInsert();
    $brdWork->destoryWork();
    echo "<result><code>y</code><data>{$cmtid}</data></result>";
} catch (Exception $e) {
    $brdWork->destoryWork();
    $errmsg = $e->getMessage();
    Util::serverLog($e);
    echo "<result><code>n</code><data>{$errmsg}</data></result>";
    exit;
}
Example #5
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdPost = null;
$title = '';
$message = '';
try {
    //wtype 이 수정하기 이면 puid 값이 셋팅된다.
    //$_GET : wtype, tbl_kind, pid, [puid]
    //wtype : 1(새글쓰기), 2(답글쓰기), 3(수정하기)
    //$brdWork->createWork($_GET, true);
    $brdWork->createWork($_GET, false);
    $wType = (int) $_GET['wtype'];
    $tblKind = $_GET['tbl_kind'];
    //수정인 경우는 수정하려는 게시글의 아이디
    //답글인 경우는 원본의 게시글 아이디(새글인 경우는 0)
    $postid = (int) $_GET['post_id'];
    $puid = (int) $_GET['poster_uid'];
    $pg_inx = (int) $_GET['pg_inx'];
    $t_idx = $_GET['t_idx'];
    //게시글 작성자 아이디(수정인 경우만 넘어옴)
    //수정인 경우는 자신의 글인지 체크
    if ($wType == 3) {
        $uid = (int) $_SESSION['uid'];
        //if ($uid == 0) throw new Exception('Invalid Session.');
        //if ($uid != $puid && $_SESSION[DBWork::adminKey] == 9001) throw new Exception('Invalid request');
    }
    //답글이나 수정인 경우는 원본의 내용을 얻어온다.
Example #6
0
<?php

require_once "./class/Utils.php";
require_once "./class/DBWork.php";
require_once "./class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdPost = null;
$title = '';
$message = '';
try {
    //wtype 이 수정하기 이면 puid 값이 셋팅된다.
    //$_GET : wtype, tbl_kind, pid, [puid]
    //wtype : 1(새글쓰기), 2(답글쓰기), 3(수정하기)
    $brdWork->createWork($_GET, true);
    $wType = (int) $_GET['wtype'];
    $tblKind = $_GET['tbl_kind'];
    //수정인 경우는 수정하려는 게시글의 아이디
    //답글인 경우는 원본의 게시글 아이디(새글인 경우는 0)
    $postid = (int) $_GET['post_id'];
    $puid = (int) $_GET['poster_uid'];
    //게시글 작성자 아이디(수정인 경우만 넘어옴)
    //수정인 경우는 자신의 글인지 체크
    if ($wType == 3) {
        $uid = (int) $_SESSION['uid'];
        if ($uid == 0) {
            throw new Exception('Invalid Session.');
        }
        if ($uid != $puid && $_SESSION[DBWork::adminKey] == 9001) {
            throw new Exception('Invalid request');
        }
    }
Example #7
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdPost = null;
$contents = $_GET['contents'];
try {
    $brdWork->createWork($_GET, $chk);
    $brdPost = $brdWork->requestPost3();
    if ($brdPost == null) {
        throw new Exception('Board view error.');
    }
    $brdWork->destoryWork();
    $tblKind = $_GET['tbl_kind'];
    $pg_inx = $_GET['pg_inx'];
} catch (Exception $e) {
    $brdWork->destoryWork();
    echo $e->getMessage();
    exit;
}
?>


	<?php 
require '../common/content_iframe_header.html';
?>
	<script>
		function iResizeManage()
		{
Example #8
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdWork->setPageInfo(10, 10, 100);
try {
    $brdWork->createWork($_POST, FALSE);
    //$res = $brdWork->requestPostByPid();
    $brdWork->requestPostByPid();
    $item = $brdWork->fetchArrayRow();
    //echo '{ "CODE": "y" , "DATA": "'.$item[0].'" }';
    //echo '<DATA>'.$item[0].'</DATA>';
    //echo '<DATA><MSG>'.$item[0].'</MSG><T_IDX>'.$res.'</T_IDX></DATA>';
    echo $item[0];
    $brdWork->destoryWork();
} catch (Exception $e) {
    $brdWork->destoryWork();
    $err = $e->getMessage();
    Util::serverLog($e);
    echo '{ "CODE": "99" , "DATA" : "' . $err . '" }';
    exit;
}
Example #9
0
<?php

require_once "./class/Utils.php";
// Utils PHP 파일(글자형식 및 제한, 로그인 등)을 한번만 Require 한다.
require_once "./class/DBWork.php";
// DBWork PHP 파일(DB관련 정보)을 한번만 Require 한다.
require_once "./class/DBBoardWork.php";
// DBBoardWork PHP 파일(게시판 관련 정보)을 한번만 Require 한다.
require_once "./class/Display.php";
// Display PHP 파일(Display 정보 게시판 관련)을 한번만 Require 한다.
$brdWork = new DBBoardWork();
// brdWork에 새로운 DDBoardWork 함수를 선언한다(클래스를 생성하는 문법)
//pageSize, pageGroupSize, maxPageIndex
$brdWork->setPageInfo(12, 10, 100);
// setPageInfo함수에 파라미터로 (pageSize:20,pageGroupSize:10,maxPageIndex:100)을 지정한다
$total_count = 0;
// 토탈 카운트는 0부터 시작하는 것으로 한다.
$contents = $_GET['contents'];
// 컨텐츠는 '컨텐츠'에서 받는다
//$_POST
//www.naver.com?contents=2423&...
try {
    //$_GET : ['tbl_kind'], ['pg_inx'], (['stype'], ['svalue']) 검색 옵션, 생략하면 전체 게시글
    $brdWork->createWork($_GET, FALSE);
    // brdWork는 createWork 함수에서 파라미터로 ($_GET, FALSE(거짓))을 지정한다.
    $total_count = $brdWork->requestList();
    // 토탈카운트는 brdwor에서 requestList함수의 결과를 받는다.
} catch (Exception $e) {
    $brdWork->destoryWork();
    // 예외일 경우 brdWork는 destoryWork함수를 받는다.
    echo $e->getMessage();
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdWork->setPageInfo(3, 10, 30);
try {
    $brdWork->createWork($_POST, FALSE);
    $brdWork->requestList_Tax();
    $result = array();
    while ($item = $brdWork->fetchMapRow()) {
        array_push($result, $item);
    }
    //$encode = iconv('ASCII', 'UTF-8//IGNORE', $result);
    echo json_encode($result);
    $brdWork->destoryWork();
} catch (Exception $e) {
    $brdWork->destoryWork();
    $err = $e->getMessage();
    Util::serverLog($e);
    echo '{ "CODE": "99" , "DATA" : "' . $err . '" }';
    exit;
}
Example #11
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork(true);
try {
    //$_GET : ['post_id'], ['tbl_kind'], ['poster_uid']
    $brdWork->createWork($_GET, true);
    $res = $brdWork->requestDelete();
    $brdWork->destoryWork();
    if ($res) {
        header("Location:../../view/board/board_list.php?tbl_kind=" . $_GET['tbl_kind'] . "&pg_inx=" . $_GET['pg_inx']);
    } else {
        echo "board delete fail!";
    }
} catch (Exception $e) {
    $brdWork->destoryWork();
    Util::serverLog($e);
    echo $e->getMessage();
    exit;
}
Example #12
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork(true);
//pageSize, pageGroupSize, maxPageIndex
$brdWork->setPageInfo(30, 10, 100);
$total_count = 0;
try {
    //$_POST : ['post_id'], ['tbl_kind'], ['pg_inx']
    $chk = $brdWork->getTableName($_POST['tbl_kind']) != 'noti';
    $brdWork->createWork($_POST, $chk);
    $total_count = $brdWork->requestCommentList();
    $data = array();
    //첫번째 원소로 댓글 전체 개수를 셋팅함
    array_push($data, $total_count);
    //실제 댓글 정보 셋팅
    while ($cmt = $brdWork->fetchMapRow()) {
        //htmlspecialchars 는 클라이언트 js 에서 처리한다.
        $cmt['message'] = stripslashes($cmt['message']);
        array_push($data, $cmt);
    }
    //json 객체를 json 문자열로 변환
    $data = json_encode($data);
    echo "<result><code>y</code><data><![CDATA[{$data}]]></data></result>";
} catch (Exception $e) {
    $brdWork->destoryWork();
    $errmsg = $e->getMessage();
    Util::serverLog($e);
    echo "<result><code>n</code><data>{$errmsg}</data></result>";
Example #13
0
<?php

require_once "../../class/Utils.php";
require_once "../../class/DBWork.php";
require_once "../../class/DBBoardWork.php";
$brdWork = new DBBoardWork();
$brdPost = null;
try {
    //$_GET : ['post_id'], ['tbl_kind']
    /*
    if(!((int)$_GET['tbl_kind']!=11&&(int)$_GET['tbl_kind']!=12&&(int)$_GET['tbl_kind']!=13))
    //if((int)$_GET['tbl_kind']>10&&(int)$_GET['tbl_kind']<14)
    	$brdWork->createWork($_GET, false);
    else
    	$brdWork->createWork($_GET, true);
    */
    $brdWork->createWork($_GET, false);
    $brdPost = $brdWork->requestPost();
    //다음 결과를 가져온다
    $avatar_wear = $brdWork->fetchArrayRow();
    $brdWork->nextQueryResult();
    $infoPost_prev = $brdWork->fetchArrayRow();
    $infoPost_next = $brdWork->fetchArrayRow();
    //테이블명
    $brdPost->tname = $brdWork->getTableName($_GET['tbl_kind']);
    if ($brdPost == null) {
        throw new Exception('Board view error.');
    }
    $brdWork->destoryWork();
    $tblKind = $_GET['tbl_kind'];
    $pg_inx = $_GET['pg_inx'];