php 글쓰기 버튼 오류 문의 좀 드립니다.

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
php 글쓰기 버튼 오류 문의 좀 드립니다.

QA

php 글쓰기 버튼 오류 문의 좀 드립니다.

본문

그누보드의 문제가 아니라 죄송합니다만 염치불구하고

질문좀 올리겠습니다. 제가 php도움 받을만한 곳이 sir뿐이라 ^^;;....

 

옛날(2000년대 중반)에 제작된 일반 php 게시판인데 글쓰기 버튼이 작동을 안합니다.

글을 입력 한 후 글 올리기 버튼을 클릭해도 아무 반응이 없습니다.(수정 페이지에서 글 수정하려 해도 아무 반응이 없네요...)

리스트로 돌아가는 버튼은 작동에 이상이 없구요... 

제가 php를 잘 모르는 디자이너라 어디를 어떻게 수정해야 되는지 가르침 좀 부탁드립니다.

 

아래는 php 게시판 소스 입니다.


<?
    include "../lib/root.inc.php";
    if ($cmd == "write")
    {
        //if(!$_SESSION[$admin_session_name]) movepage("./");
        // id 값이 없으면 되돌려.
        if (!$id) error("잘못된 접근입니다.");
        
        if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 작성하여 주시기 바랍니다.");
        if(getenv("REQUEST_METHOD") == 'GET' ) Error("정상적으로 글을 쓰시기 바랍니다","");
    
        // 현제보드의 설정값 쿼리
        $setup = board_info($id);
        $board_name = $setup[name];
        $use_pds    = $setup[use_pds];
        $use_html    = $setup[use_html];
        $auth_write = $setup[auth_write];
        $use_file    = $setup[use_file];
        $use_img    = $setup[use_img];
        $use_date    = $setup[use_date];
        
        $ip=$REMOTE_ADDR; // 아이피값 구함;;
        $reg_date=time(); // 현재의 시간구함;;
        if ($no == "")
        {
            // 답글이 아니면 최근 메세지 번호 쿼리
            $strSQL = "SELECT main FROM ".$board_table."_$id where idx=254 limit 1";
            $result = mysql_fetch_array(mysql_query($strSQL));
            
            if($result[main])
            {
                $main = $result[main];
                if ($main == 0)
                {
                    $idx = $idx - 1;
                    $main = "65535";
                }
                else
                    $main = $main - 1; 
                
            }
            else
                $main = "65535";
                
            $sub = 0;
            $depth = 0;
        }
        // 답글인 경우 SubNo 값을 찾는다.
        else
        {
            $strSQL = "select * from ".$board_table."_$id where idx=254 and no = $no";
            $result = mysql_fetch_array(mysql_query($strSQL));
            
            // depth 증가하고 현글의 sub보다 큰 글의 sub를 1씩 증가.
            $depth = $result[depth] + 1;
            $sub   = $result[sub];
            
            if ($sub > 0)
            {
                $strSQL = "UPDATE ".$board_table."_$id SET sub = sub + 1 " .
                        "where idx=254 and main=$main AND sub > $sub";
                mysql_query($strSQL);
                
                $sub = $sub + 1;
            }
            else
            {
                $strSQL = "SELECT MAX(sub) FROM ".$board_table."_$id " .
                        "where idx=254 and main=$main ";
                $result = mysql_fetch_array(mysql_query($strSQL));
                $maxSub = $result[0];
                
                $sub = $maxSub + 1;
            }
        }
// 파일 업로드
if($HTTP_POST_FILES[addfile1]) {
    $file = $HTTP_POST_FILES[addfile1][tmp_name];
    $file_name = $HTTP_POST_FILES[addfile1][name];
    $file_size = $HTTP_POST_FILES[addfile1][size];
    $file_type = $HTTP_POST_FILES[addfile1][type];
}
if($file_size>0&&$file) {
    if(!is_uploaded_file($file)) Error("정상적인 방법으로 업로드 해주세요");
    $file_size=filesize($file);
    // 업로드 금지
    if($file_size>0) {
        $dir = "../data/";
        $s_file_name=$file_name;
            if(eregi("\.inc",$s_file_name)||eregi("\.phtm",$s_file_name)||eregi("\.htm",$s_file_name)||eregi("\.shtm",$s_file_name)||eregi("\.ztx",$s_file_name)||eregi("\.php",$s_file_name)||eregi("\.dot",$s_file_name)||eregi("\.asp",$s_file_name)||eregi("\.cgi",$s_file_name)||eregi("\.pl",$s_file_name)) Error("Html, PHP 관련파일은 업로드할수 없습니다");
        
        $file=eregi_replace("\\\\","\\",$file);
        $s_file_name=str_replace(" ","_",$s_file_name);
        $s_file_name=str_replace("-","_",$s_file_name);
        
        // 디렉토리를 검사함
        if(!is_dir($dir.$id)) { 
            @mkdir($dir.$id,0777);
            @chmod($dir.$id,0706);
        }
        // 중복파일이 있을때;; 
        if(file_exists($dir."$id/".$s_file_name)) {
            @mkdir($dir."$id/".$reg_date,0777);
            if(!move_uploaded_file($file,$dir."$id/".$reg_date."/".$s_file_name)) Error("파일업로드가 제대로 되지 않았습니다");
            $file_name=$dir."$id/".$reg_date."/".$s_file_name;
            @chmod($file_name,0706);
            @chmod($dir."$id/".$reg_date,0707);
        } else {
            if(!move_uploaded_file($file,$dir."$id/".$s_file_name)) Error("파일업로드가 제대로 되지 않았습니다");
            $file_name=$dir."$id/".$s_file_name;
            @chmod($file_name,0706);
        }
    }
    $addfile1 = $file_name;
    $s_addfile1 = $s_file_name;
    $addfile_size1 = $file_size;
}
if ($use_img)
{
    if($HTTP_POST_FILES[addfile2]) {
        $file = $HTTP_POST_FILES[addfile2][tmp_name];
        $file_name = $HTTP_POST_FILES[addfile2][name];
        $file_size = $HTTP_POST_FILES[addfile2][size];
        $file_type = $HTTP_POST_FILES[addfile2][type];
    }
    if($file_size>0&&$file) {
        if(!is_uploaded_file($file)) Error("정상적인 방법으로 업로드 해주세요");
        $file_size=filesize($file);
        // 업로드 금지
        if($file_size>0) {
            $dir = "../data/";
            $s_file_name=$file_name;
            if(!preg_match("/\.(gif|jpg|jpeg|GIF|JPG|JPEG)$/i", $file_name)) Error("이미지 파일은 jpg, gif 만 업로드 하실 수 있습니다.");
            
            $file=eregi_replace("\\\\","\\",$file);
            $s_file_name=str_replace(" ","_",$s_file_name);
            $s_file_name=str_replace("-","_",$s_file_name);
            
            // 디렉토리를 검사함
            if(!is_dir($dir.$id)) { 
                @mkdir($dir.$id,0777);
                @chmod($dir.$id,0706);
            }
            // 중복파일이 있을때;; 
            if(file_exists($dir."$id/".$s_file_name)) {
                @mkdir($dir."$id/".$reg_date,0777);
                if(!move_uploaded_file($file,$dir."$id/".$reg_date."/".$s_file_name)) Error("파일업로드가 제대로 되지 않았습니다");
                $file_name=$dir."$id/".$reg_date."/".$s_file_name;
                @chmod($file_name,0706);
                @chmod($dir."$id/".$reg_date,0707);
            } else {
                if(!move_uploaded_file($file,$dir."$id/".$s_file_name)) Error("파일업로드가 제대로 되지 않았습니다");
                $file_name=$dir."$id/".$s_file_name;
                @chmod($file_name,0706);
            }
        }
        $addfile2 = $file_name;
        $s_addfile2 = $s_file_name;
        $addfile_size2 = $file_size;
    }
}
        if (!$name) $name = "대경유압";
        // 각종 변수의 addslashes 시킴;;
        $name=addslashes(del_html($name));
        $subject=addslashes(del_html($subject));
        $content=addslashes($content);
        //if ($id == "parliamentarism") { $cat_field = ", category"; $cat_value=", '$cat'"; };
        
        //if (($id!="free")&&($id!="qna")) $reg_date = timestamp($year."-".$month."-".$day." 00:00:00");
        if ($use_date) $reg_date = timestamp($year."-".$month."-".$day." 00:00:00");
        if ($id == "movie")
        {
            $field = ", mov_link";
            $value = ", '$mov_link'";
        }
        
        $strSQL = "INSERT INTO ".$board_table."_$id (no, idx, main, sub, depth, name, subject, content, use_html, password, addfile1, s_addfile1, addfile_size1, addfile2, s_addfile2, addfile_size2 $field , read_count, ip_addr, write_time $cat_field) VALUES ('', '254', $main, $sub, $depth, '$name', '$subject', '$content', '$html', password('$password'), '$addfile1', '$s_addfile1', '$addfile_size1', '$addfile2', '$s_addfile2', '$addfile_size2' $value , 0, '$ip', '$reg_date' $cat_value)";
        //echo $strSQL;exit;
        mysql_query($strSQL) or error(mysql_errno());
        // 게시판 관리자테이블에 전체글수 업데이트
        mysql_query("update $board_admin_table set total_msg = total_msg + 1 where id = '$id'") or error(mysql_errno());
        movepage("board_list.php?id=$id");
    }
    else
    {
        // id 값이 없으면 되돌려.
        if (!$id) error("잘못된 접근입니다.");
        
        // 현제보드의 설정값 쿼리
        $setup = board_info($id);
        $board_name = $setup[name];
        $use_pds    = $setup[use_pds];
        $use_html    = $setup[use_html];
        $auth_write = $setup[auth_write];
        $use_file    = $setup[use_file];
        $use_img    = $setup[use_img];
        $use_date    = $setup[use_date];
?>
<div id=1>
<html>
<head>
<title>관리자 페이지</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel='stylesheet' href='./admin.css'>
<script src='./admin.js'></script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('image/topbu1-1.gif','image/topbu2-2.gif','image/topbu3-3.gif')">
<!-----------top 시작-------------->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td background="image/topbg.gif">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="489"><img src="/img/logo1.gif"></td>
                    <td><a href="/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','image/topbu1-1.gif',1)" target=_blank><img name="Image2" border="0" src="image/topbu1.gif" width="107" height="73"></a></td>
                    <td><a href="./" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','image/topbu2-2.gif',1)"><img name="Image3" border="0" src="image/topbu2.gif" width="107" height="73"></a></td>
                <td><a href="./logout.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','image/topbu3-3.gif',1)"><img name="Image4" border="0" src="image/topbu3.gif" width="105" height="73"></a></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td background="image/topbg1.gif" height="39" align="center">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center">
                   <table width="800" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="center">
                                                <!--a href="./?page=member"><font color="#FFFFFF"><b>회원정보수정</b></font></a>
                                                <b><font color="#FFFFFF">|</font></b>
                                                <a href="./?page=customer"><font color="#FFFFFF"><b>고객관리</b></font></a>
                                                <b><font color="#FFFFFF">|</font></b>
                                                <a href="./?page=estimate"><font color="#FFFFFF"><b>온라인 견적관리</b></font></a>
                                                <b><font color="#FFFFFF">|</font></b-->
                                                <a href="./?page=qna"><font color="#FFFFFF"><b>Q&A 관리</b></font></a>
                                                <b><font color="#FFFFFF">|</font></b>
                                                <a href="./board_list.php?id=tech"><font color="#FFFFFF"><b>이럴땐 이렇게</b></font></a>
                                                <b><font color="#FFFFFF">|</font></b>
                                                <a href="./board_list.php?id=tech_vo"><font color="#FFFFFF"><b>자료실</b></font></a>
                                                <!--b><font color="#FFFFFF">|</font></b>
                                                <a href="./board_list.php?id=faq1"><font color="#FFFFFF"><b>FAQ</b></font></a-->
                                                <b><font color="#FFFFFF">|</font></b>
                                                <a href="./?page=setup"><font color="#FFFFFF"><b>암호변경</b></font></a>
                                            </td>
                                </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<!-----------top 끝-------------->
</div>
<!----------------main시작----------------------------->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
        <td width="175" bgcolor="F7F7F7" valign="top"> 
        <!--------------left시작--------------------->
        <div id=2>
<table  width="175" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td>
            <table width='100%' border='0' cellspacing='0' cellpadding='0'>
                <tr>
                    <td height='5'></td>
                </tr>
                <tr>
                    <td height='25' align='center' bgcolor='D6D7D6'><font color='395194'><b>게시판/자료실 관리메뉴</b></font></td>
                </tr>
                <tr>
                    <td height='5'></td>
                </tr>
            </table>
        </td>
    </tr>
            <tr>
                <td bgcolor='#FFFFFF' height='30' style=padding-left:10px;><img src='image/leftdot.gif'><a href='./board_list.php?id=tech'><b><font color='525552'>이럴땐 이렇게</font></b></a></td>
            </tr>
            <tr>
                <td background='image/leftbg.gif' height='1' bgcolor='#FFFFFF'></td>
            </tr>
            <tr>
                <td bgcolor='#FFFFFF' height='30' style=padding-left:10px;><img src='image/leftdot.gif'><a href='./board_list.php?id=tech_vo'><b><font color='525552'>자료실</font></b></a></td>
            </tr>
            <!--tr>
                <td background='image/leftbg.gif' height='1' bgcolor='#FFFFFF'></td>
            </tr>
            <tr>
                <td bgcolor='#FFFFFF' height='30' style=padding-left:10px;><img src='image/leftdot.gif'><a href='./board_list.php?id=faq1'><b><font color='525552'>FAQ</font></b></a></td>
            </tr-->
            <tr>
                <td background='image/leftbg.gif' height='1' bgcolor='#FFFFFF'></td>
            </tr>
</table>
        </div>
        <!--------------left끝--------------------->
        </td>
        <td valign="top"> 
         <!-----------내용시작------------------->
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td style=padding-left:20px;> 
                        <table border="0" cellspacing="0" cellpadding="0" width="610" >
                            <tr><td height="12" colspan="2"></td></tr>
                            <tr><td colspan="2">&nbsp<font color="107D9C" size="1">■</font><font color="107D9C"> <?=$board_name?> 관리</font></td></tr>
                            <tr>
                                <td bgcolor="107D9C" height="3" width="120"></td>
                                <td bgcolor="8CC3CE" height="3"></td>
                            </tr>
                            <tr>
                                <td colspan="2">
<script language=javascript>
function check_form(theform)
{
    if(!theform.subject.value)
    {
        alert("제목을 입력해주세요");
        theform.subject.focus();
        return false;
    }
    if(!theform.content.value)
    {
        alert("내용을 입력해주세요");
        theform.content.focus();
        return false;
    }
    <? if ($id=="movie") {?>
    if(!theform.mov_link.value)
    {
        alert("동영상파일을 입력해주세요");
        theform.mov_link.focus();
        return false;
    }
    <? } ?>
    theform.submit();
}
</script>
<br>
<form method='post' name='write' enctype='multipart/form-data' action='board_write.php'> 
<input type="hidden" name="id" value="<?=$id?>">
<input type="hidden" name="cmd" value="write">
<table width="800" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
        <td height="9" background="imgs/bg_search01.gif" align="center"></td>
    </tr>
    <tr>
        <td height="13" background="imgs/bg_search02.gif" align="center"><b><font color="#427EBB" size=2><?=$board_name?>의 새글쓰기</b></td>
    </tr>    
    <tr>
        <td height="9" background="imgs/bg_search03.gif" align="center"></td>
    </tr>
</table>
<br><br>
<table width="600" border="0" cellspacing="1"  bgcolor="bbbbbb" cellpadding="5" align="center">
    <tr height=28>
        <td bgcolor="F5F5F5" width=100 align=center><b>제목</b></td>
        <td bgcolor='FFFFFF'> <input type="text" name="subject" size="60" class=textbox></td>
    </tr>
    <tr>
        <td bgcolor="F5F5F5" width=100 align=center><b>내용</b></td>
        <td bgcolor='FFFFFF'>  <textarea name='content' rows=15 cols=60 style="background-color:White; border:1 solid #969696; font-size:9pt;"></textarea> </td>
    </tr>
    <? if ($use_file) {?>
    <tr height=28>
        <td bgcolor="F5F5F5" width=100 align=center><b>첨부파일</b></td>
        <td bgcolor='FFFFFF'> <input type=file name=addfile1 size=40 class=textbox></td>
    </tr>
    <?}?>
    <? if ($use_img) {?>
    <tr height=28>
        <td bgcolor="F5F5F5" width=100 align=center><b>이미지첨부</b></td>
        <td bgcolor='FFFFFF'> <input type=file name=addfile2 size=40 class=textbox></td>
    </tr>
    <?}?>
    <? if ($use_html) {?>
    <tr height=28>
        <td bgcolor="F5F5F5" width=100 align=center><b>HTML 사용</b></td>
        <td bgcolor='FFFFFF'> <input type=radio style=border:none name=html value=0 checked> HTML + BR <input type=radio name=html style=border:none value=1> HTML</td>
    </tr>
    <?}?>
</table>
<br>
<table width="600" border="0" cellspacing="0"  cellpadding="5" align="center">
    <tr>
        <td align=center><img src='imgs/write.gif' style=border:none width=80 height=20 style="cursor:hand" onClick="return check_form(document.write)"> <img src='imgs/list.gif' width=80 height=20 style"=cursor:hand" onClick="window.location='board_list.php?id=<?=$id?>'"></td>
    </tr>
</table>
</form>
<br>
<br>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        <!-----------내용끝------------------->
        </td>
    </tr>
</table>
<!----------------main끝----------------------------->
<!--------------bottom시작---------------->
<div id=3>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td background="image/bottombg.gif" align="center" height=5></td>
    </tr>
    <tr><td align=center>Copyright BY GENAD</td></tr>
</table>
<br><br>
</body>
</html>
</div>
<? } ?> 
 

 

 

 

 

이 질문에 댓글 쓰기 :

답변 3

 <td align=center><img src='imgs/write.gif' style=border:none width=80 height=20 style="cursor:hand" onClick="return check_form(document.write)"> <img src='imgs/list.gif' width=80 height=20 style"=cursor:hand" onClick="window.location='board_list.php?id=<?=$id?>'"></td> 


아래 버튼쪽 소스인데

style=border 이렇게 해노으셧는데 "" 안붙혀주어서 먹통이된듯??

그쪽부분에 style을 2개나 하셧네요..

글쓰기 버튼을 누르면 아무런 동작이없나요?

예를들어 글 제목을 넣지않고 버튼을 누르면

제목을 입력하세요하는 alert창이 뜨지도 않나요?

<form method='post' name='write' enctype='multipart/form-data' action='board_write.php'> 

여기폼 이름 바꾸신적잇으신지??

name='write'를 name='theform'으로 바꿔보세요한번

답변을 작성하시기 전에 로그인 해주세요.
전체 24
QA 내용 검색

회원로그인

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