File name: welboard2/modify.wel (4,057 bytes) Text file viewer v1.2
    1 : #!/bin/wel
    2 : 
    3 : /* file: modify.wel
    4 : 
    5 :    게시판 수정 프로그램 (author: 서광현)
    6 : 
    7 :    Copyright (c) 2001/03/25 by Wesoft
    8 :    All Rights Reserved.
    9 : */
   10 : 
   11 : if(include("include/fileupload.sub")!=OK) return;
   12 : no= val(no);
   13 : if(no<1)
   14 :  {
   15 :     if(attfile!="") delete_uploadfile();
   16 :     MSG1= "자료번호 오류";
   17 :     MSG2= "자료 번호가 없거나 잘못되었습니다." ~ BACK_BUTTON;
   18 :     formdump(message_form);
   19 :     return disconnect();
   20 :  }
   21 : qstr= "select answer,subject,content,attfile,fileseq,postpass,wname,wemail"
   22 :     ~ " from " ~ mytable ~ " where selno=" ~ no;
   23 : if( (rt=mysql_getrecord(qstr,"DB_")) < 1 )
   24 :  {
   25 :     if(attfile!="") delete_uploadfile();
   26 :     if(rt==0)
   27 :      {
   28 :         MSG1= "자료가 없습니다!";
   29 :         MSG2= no ~ "번의 게시물이 삭제되었거나 없습니다!" ~ BACK_BUTTON;
   30 :         formdump(message_form);
   31 :      }
   32 :     return disconnect();
   33 :  }
   34 : if(read_only==1 && DB_answer=="" || write_answer==0 && DB_answer!="")
   35 :  {
   36 :     if(attfile!="") delete_uploadfile();
   37 :     MSG1= "관리자 전용 " ~ prg_title;
   38 :     if(board_name=="") board_name= "이 " ~ prg_title;
   39 :     MSG2= "<font color=#0000c0>" ~ board_name ~ "</font>에서는 "
   40 :         ~ "관리자만 쓰기/수정/삭제를 할 수 있습니다!" ~ BACK_BUTTON;
   41 :     formdump(message_form);
   42 :     return disconnect();
   43 :  }
   44 : if(writeflag!=1)
   45 :  {
   46 :     if(DB_postpass=="") depass= board_admin_depass;
   47 :       else depass= decode(DB_postpass,"",decode_variable);
   48 :     if(us_class!="A" && pass!=depass && pass!=board_admin_depass)
   49 :      {
   50 :         if(attfile!="") delete_uploadfile();
   51 :         if(authflag==1) MSG= "<font color=#f00000>암호가 틀립니다. 다시 입력하세요!</font>";
   52 :          else
   53 :           {
   54 :              if(DB_postpass!="") MSG= "게시물의 수정 / 삭제 암호 또는";
   55 :               else MSG= "게시물이 암호 없이 작성되었습니다.";
   56 :              MSG~= " 관리자 암호를 입력하세요!";
   57 :           }
   58 :         focus= "pass", action= "modify.wel";
   59 :         back= "goview()", check= "Check2()", btname= "수정하기";
   60 :         idinput= "", title= "게시물 수정 / 삭제 암호 확인";
   61 :         fm= formdump(skin~"auth.fom");
   62 :         if(fm==FORM_OPENERR) return err_form("auth.fom");
   63 :         return disconnect();
   64 :      }
   65 :     if(attfile!="") delete_uploadfile();
   66 :     DB_wemail= strchange(DB_wemail,html_fch,html_rch);
   67 :     DB_subject= strchange(DB_subject,html_fch,html_rch);
   68 :     DB_content= strchange(DB_content,html_fch,html_rch);
   69 :     fm= formdump(skin~"modify.fom");
   70 :     if(fm==FORM_OPENERR) return err_form("modify.fom");
   71 :     return disconnect();
   72 :  }
   73 : 
   74 : if(attfile=="") update_attfile= "";
   75 :  else
   76 :   {
   77 :      clear_downcnt= "downcnt=0,";
   78 :      if(DB_attfile!="")
   79 :       {
   80 :          if(DB_attfile==attfile) clear_downcnt= ""; // 같은 파일을 업로드했음
   81 :          DB_fileseq= val(DB_fileseq);
   82 :          if(DB_fileseq>0) DB_attfile= DB_fileseq ~ "-" ~ DB_attfile;
   83 :          if(new_attfile=="") now_upload= attfile; else now_upload= new_attfile;
   84 :          if(DB_attfile!=now_upload) unlink(upload_dir~"/"~DB_attfile);
   85 :       }
   86 :      update_attfile= "attfile='" ~ attfile ~ "',fileseq=" ~ val(new_attfile)
   87 :                    ~ "," ~ clear_downcnt;
   88 :   }
   89 : 
   90 : subject= strchange(left(lrtrim(subject),60,1), fch, rch);
   91 : content= strchange(content, fch, rch);
   92 : linecnt= strcount(content, "\n");
   93 : if(right(content,1)!="\n") ++linecnt;
   94 : if(postpass!="")
   95 :  {
   96 :     enpass= encode(left(postpass, 12), encodekey(), "", decode_variable);
   97 :     postpass= "postpass='" ~ enpass ~ "',";
   98 :  }
   99 : mdtime= date(1) ~ " " ~ left(time(1),5);
  100 : mip= getenv("REMOTE_ADDR");
  101 : mhost= getenv("REMOTE_HOST");
  102 : mname= strchange(left(lrtrim(wname),20,1), fch, rch);
  103 : memail= strchange(left(lrtrim(wemail),40,1), fch, rch);
  104 : 
  105 : qstr= "update " ~ mytable
  106 :     ~ strform(" set subject='{$subject}',content='{$content}',",
  107 :              "{$update_attfile}linecnt={$linecnt},{$postpass}",
  108 :              "mdtime='{$mdtime}',mip='{$mip}',mhost='{$mhost}',",
  109 :              "mname='{$mname}',memail='{$memail}' where selno={$no}");
  110 : 
  111 : if(mysql_query(mysql, qstr)==MYSQL_ERR)
  112 :  {
  113 :     if(attfile!="") delete_uploadfile();
  114 :     return err_query();
  115 :  }
  116 : url= strform("board.wel?db={$db}&pg={$pg}&bp={$bp}&sk={$sk}&no={$no}&k={$k}&cn={$cn}&cs={$cs}&cc={$cc}");
  117 : replace_location(url);
  118 : return disconnect();
File name: welboard2/modify.wel (4,057 bytes) Wesoft Corp. ⓒ 2001 All rights reserved.