관리자페이지에 글쓰기를 만들고 싶습니다.

관리자페이지에 글쓰기를 만들고 싶습니다.

QA

관리자페이지에 글쓰기를 만들고 싶습니다.

본문

일반적인 쓰기 페이지인 
/bbs/write.php?bo_table=tablename

페이지가 아니고

 

관리자페이지 안에

/adm/board_write.php?bo_table=tablename

이런 페이지를 만들어 입력을 하려 합니다.

 

페이지도 잘 만들고 폼도 만들었는데

저장이 안되네요

"올바른 방법으로 이용해 주십시오" 가 뜹니다.

check_write_token 함수에서 걸리는데요

관리자 페이지에서 그냥 만들어서 위쪽에 쓰기 스킨처럼

    <form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?php echo $width; ?>">
    <input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
    <input type="hidden" name="w" value="<?php echo $w ?>">
    <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
    <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
    <input type="hidden" name="sca" value="<?php echo $sca ?>">
    <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
    <input type="hidden" name="stx" value="<?php echo $stx ?>">
    <input type="hidden" name="spt" value="<?php echo $spt ?>">
    <input type="hidden" name="sst" value="<?php echo $sst ?>">
    <input type="hidden" name="sod" value="<?php echo $sod ?>">
    <input type="hidden" name="page" value="<?php echo $page ?>">

을 넣어서 진행을 시켰는데

안되네요

 

혹시 관리자 페이지에서 게시판을 입력해보신 분 

어떻게 하면 정상적으로 입력할 수 있을까요?

이 질문에 댓글 쓰기 :

답변 3


// 불법접근을 막도록 토큰을 생성하면서 토큰값을 리턴
function get_write_token($bo_table)
{
    $token = md5(uniqid(rand(), true));
    set_session('ss_write_'.$bo_table.'_token', $token);
    return $token;
}

// POST로 넘어온 토큰과 세션에 저장된 토큰 비교
function check_write_token($bo_table)
{
    if(!$bo_table)
        alert('올바른 방법으로 이용해 주십시오.', G5_URL);
    $token = get_session('ss_write_'.$bo_table.'_token');
    set_session('ss_write_'.$bo_table.'_token', '');
    if(!$token || !$_REQUEST['token'] || $token != $_REQUEST['token'])
        alert('올바른 방법으로 이용해 주십시오.', G5_URL);
    return true;
}
 

함수 참고하세요.

get_write_token 로 생성한 토큰을 

form 의 submit 시 같이 보내면 됩니다.
답변을 작성하시기 전에 로그인 해주세요.
전체 66
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT