묻고답하기

http://www.lockon.info/formmail/formmail.html안녕하세요.
제 홈페이지에 사용할 폼메일을 15시간 째 조립(?)하고 있습니다.
PHP책 보면서 여기저기서 소스 참고하여 만들고 있죠..
소스자료실을 수없이 뒤져도 쓸만한 폼메일 소스가 하나도 없으니...
쓸만한거 하나 만들어서 나눠줄려구요...

첨부파일이 없으면 잘 가는데, 첨부파일을 넣으면 php에서 애러를 내보냅니다.
첨부파일이라는 것이 제가 코드를 보아하니 서버에 업로드 하는것이 아니고 텍스트로 인코드하는 것 같은데,
따지고 보면 복잡할게 하나도 없을것 같은데 쉽지가 않네요...

아래 제가 작업중인 소스코드와 에러내용을 적습니다.
부디 도움을 주시면 감사하겠습니다.


<?
// 기본 정보 설정
$admin='admin@xxx.xxx'; //운영자 메일 주소
$endURL=''; //메일 송신 후 이동할 페이지
$maxfilesize=2000000; //첨부파일의 최대 용량(byte단위)

// ######## 필터링 및 조건 검사 #########
if(strpos($subject,"광고")||strpos($subject,"광-고")||strpos($subject,"성인")||strpos($subject,"야동")||strpos($body,"추천인")||strpos($body,"수신거부")) $to=$from;
if($userfile_size>$maxfilesize)
{
      echo "<script language='JavaScript'>alert("첨부파일 용량이 허용치를 초과합니다n첨부파일 용량: ".$userfile_size."");history.go(-1);</script>n";
      exit;
}

// ########## 기본 헤더 ############
$mailheaders .= "Return-Path:$fromrn";
$mailheaders .= "From:$who <$from>rn";
$mailheaders .= "Reply-To:$fromrn";
if($text_type == "html") $mailheaders .= "Content-Type: text/html; charset=EUC-KRrn";

// ##### 첨부파일이 있을 때 헤더 처리 #####
if ($userfile && $userfile_size)
{
      $filename=basename($userfile_name);
      $fp_userfile=fopen($userfile,"r");
      $file=fread($fp_userfile,$userfile_size);
      fclose($fp_userfile);

      if ($userfile_type == "") $userfile_type = "application/octet-stream";

      $boundary = uniqid("part");
      $mailheaders .= "MIME-Version: 1.0rn";
      $mailheaders .= "Content-Type: multipart/mixed; boundary="$boundary"r\n";
      $bodytext  = "This is a multi-part message in MIME format.rnrn";
      $bodytext .= "--$boundaryrn";
      $bodytext .= "Content-Type: text/html; charset=euc-krrn";
      $bodytext .= "Content-Transfer-Encoding: 8bitrnrn";
      $bodytext .= addbody();

      $bodytext .= "--$boundaryrn";
      $bodytext .= "Content-Type: $userfile_type; name="$filename"rn";
      $bodytext .= "Content-Transfer-Encoding: base64rnrn";
      $bodytext .= ereg_replace("(.{80})","\1rn",base64_encode($file));
      $bodytext .= "rn--$boundary--" . "rn";

//    언어설정을 위한 탬플릿
//    $bodytext .= "Content-Type: text/plain; charset=euc-krrn";
//    $bodytext .= "Content-Transfer-Encoding: 8bitrnrn";
//    $bodytext .= "Content-Type: text/plain; charset=us-asciirn";
//    $bodytext .= "Content-Transfer-Encoding: 7bitrnrn";
}
// ##### 첨부파일이 없을 때 헤더 처리 #####
else
{
      $bodytext = addbody();
}

// ######## 본문 작성 함수 #########
function addbody()
{
      global $text_type, $body;
      if($text_type=="text")
            $buffer = stripslashes($body)."rnrn";

      else if($text_type=="html") //html 형식일 경우, 정당한 폰트 설정을 본문에 적용하고 nl2br함수로 개행문자를 <br>태그로 변환
            $buffer = "<html><body>rn<div style="font:normal 10pt/14pt 굴림,verdana">rn".nl2br(stripslashes($body))."rn</div>rn</body></html>rnrn";
      return $buffer;
}


// ########## 최종 처리 부분 ##########
// 받는 사람 주소가 비어있으면 자동으로 $admin 에 지정된 주소로 보내짐
// 메일전송 후 $endURL 값이 없으면 두 단계 전으로 돌아감

if($to) mail($to,$subject,$bodytext,$mailheaders);
else mail($admin,$subject,$bodytext,$mailheaders);
if($echo) mail($from,$subject,$bodytext,$mailheaders);

echo "<script language='javaScript'>alert('메일 전송을 완료했습니다');</script>n";
if($endURL)
      echo "<script language='JavaScript'>document.location="".$endURL.""</script>n";
else
      echo "<script language='JavaScript'>history.go(-2);</script>n";
exit;
?>


에러내용:
Warning: open_basedir restriction in effect. File is in wrong directory in /home/01/lockon24/www/formmail/formmail.php on line 25
Warning: fopen("/tmp/phpDaZGvO", "r") - Operation not permitted in /home/01/lockon24/www/formmail/formmail.php on line 25
Warning: Supplied argument is not a valid File-Handle resource in /home/01/lockon24/www/formmail/formmail.php on line 26
Warning: Supplied argument is not a valid File-Handle resource in /home/01/lockon24/www/formmail/formmail.php on line 27


글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
sam95 동영상 팝창 있나요?  
후후후늬 다른 게시판에 글이 등록되는 외부페이지를 만들었는데 [2] file 2014.09.19 by 루찌
블루문운영 현재 홈페이지에 파일첨부버튼이 먹통입니다. [11] 2014.09.19 by HSJI
괴적인격 레벨아이콘이 .. file  
분홍우산 윈도우7이전버전컴퓨터에서 현재xe를 지원못하는 문제점  
마리스2 위젯 수정페이지 두번 뜨는 증상 file  
택군82 이미지 경로에 이미지가 없을경우 if문..  
로프디자인 XE 1.7 로 만든 사이트 크롬으로 들어가니 자꾸 멀웨어 어쩌구 뜨면서 홈페이지 안뜹니다. [3] file 2014.09.19 by 몽실아빠
진지한남자 회원 확장 모듈에서 추천인 포인트 지급 질문  
쫑효다컴 Xe 사용하는데요 -- 메인 메뉴에서 3차메뉴까지 나오게 하려면 어떻게 해야 할까요? [1] 2014.09.19 by DoorWeb
송문열1 제로보드xe로 만든 사이트인데요. 남아프리카공아국 사람이 들어갈려고하면 forbidden entry [1] 2014.09.19 by YJSoft
괴적인격 그룹이미지  
빠른별 홈페이지에 렉이있습니다.. [2] 2014.09.19 by 외인
블루문운영 현재 홈페이지 문제 입니다./ [1] 2014.09.19 by 나만의너
전주넷 회원에게 관리자 권한을 줄려면 어떻게 해야되나요? [1] 2014.09.19 by 나만의너
갱후니 홈페이지 초기화면이 뜨지 않습니다. file  
괴적인격 태그만으로도 제작이 가능할까요? file  
빡현111 메뉴마다 사이드바가 바뀌게 하고싶은데요 [5] 2014.09.19 by 빡현111
김너무씨 이메일 주소 변경 금지 시키는법 file  
SeungXE 포인트가 사라지는 버그를 경험해보신 분들 계신가요?  
LadiesKorea 추천이 됐다가 안 됐다...왜 이러나요? [1] 2014.09.18 by sejin7940
김형진354 혹시 홈페이지 게시판내에 쓴글을 긁어갈경우... [2] 2014.09.18 by 도라에몽x몽에라도
Ash 모바일에서 글/댓글을 쓰려고 하면 화면이 홈페이지 최상단으로 올라갑니다. 해결 방법이 없을까요? [4] 2014.09.18 by Ash
민다 xpresseditor(하얀색 텍스트(HTML 사용))에서 파일첨부가 가능하게 할 방법이 없을까요? [2] 2014.09.18 by 민다
규리봉봉 도메인 관련 몇가지 질문드립니다. [6] 2014.09.18 by 몽실아빠
쫑효다컴 xpressengine 같은 스타이의 레이아웃인데 3차메뉴까지 표시하려면  
김형진354 성인만 특정 게시판을 사용하게하고싶은데요.. [6] 2014.09.18 by 몽실아빠
SeedbitS 게시판 게시글 수정에 관련된 질문입니다. [2] 2014.09.18 by SeedbitS
풍풍00 pc버전 , 모바일 버전에 대한 재질문입니다 답변 부탁드려요. [4] 2014.09.18 by Double'U'
꿀댕이 XE 카페 카테고리 설정(순서 변경 문의) file