글쓴사람 궁금이
글쓴시간2003년 10월 2일 오전 9시 27분 58초
    제목에러창 표시후 뒤로 가면 입력했던 글들이 다 없어지네요...???
<첫번째 화일>
        case 'write':

            if ($download_name) {

                // 업로드 폴더 지정
                $data_dir = $rootpath.$this->up_dir;

                echo "data_dir = $data_dir<br>";

                // 화일 업로드
                $file = $this->upload_file($download, $download_name, $download_size, $data_dir."/data");
               
                if (!@copy($file_tmp, "$file")) { $this->error(17); return; }       .....................(1)
            }

            $this->db->query('lock tables '.$this->db->master_table.' write');
            $this->db->query('select max(sort) from '.$this->db->master_table.' where parent=0');
            $this->db->query('insert into '.$this->db->master_table.' set
                sort ='.($this->db->getOne()+$this->replyLimit).',
                name ="'.$_POST['name'].'",
                pass ="'.$_POST['pass'].'",
                email="'.$_POST['email'].'",
                homepage="'.$_POST['homepage'].'",
                ip   ="'.$_SERVER['REMOTE_ADDR'].'",
                title="'.$_POST['title'].'",
                rtime=now(),
                html ="'.$_POST['html'].'",
                text="'.$_POST['text'].'",
                download="'.$download_name.'"'
            );
            $this->db->query('update '.$this->db->master_table.' set top='.$this->db->getLastIndex().' where idx='.$this->db->lastIndex);
            $this->db->query('unlock tables');

            setCookie('hit:'.$this->db->master_table, $_COOKIE['hit:'.$this->db->master_table].'-'.$this->db->lastIndex);

            $this->toss('?id='.$_GET['id'].'&prc=read&idx='.$this->db->lastIndex);
            break;


<두번째 화일>
{:?no == 17}
<script language="javascript">
    alert("업로드 중 오류가 발생했습니다.\n\n다시 시도해 주시기 바랍니다.");
    history.go(-1);
</script>


게시판에 글입력시 화일 업로드시 에러가 나면 오류메세지 표시를 하여준 후에 history.go(-1)을 하면 글입력했던 내용들이 다 없지네요...
원래는 패스워드 부분만 없어져야 하는거 아닌가요???
어느 부분을 어떻게 수정해야 할지..부탁드립니다.
관리자 템플릿문제는 아니구요.. 세션때문에 그렇습니다.

세션을 사용한다는 건 일반적으로 접속한 사용자에게

고유한 정보를 처리한다는 것이고

보안상 PHP가 디폴트로 nocache 헤더를 보내기 때문에..

브라우저는 접속했던 페이지이더라도 매번 서버에서 새로 읽어오게 됩니다.

$_GET['prc'] 값이 'write' 일 때는 굳이 세션을 사용하지 않아도 되니까

if ($_GET['prc']!='write') session_start();

하시면 되고..

세션을 써야만 한다면..

if ($_GET['prc']=='write') session_cache_limiter('private');
session_start();

이렇게 하시면 됩니다.
03-10-02 10:03
궁금이 관리자님 정말 친절하게 빠르게 답변 주셔서 정말 감사합니다.
03-10-02 10:17
    이름
비밀번호
 
Since 2003-03-03 hosted on vultr.com