묻고답하기

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