File name: addrbook/addrbook.wel (3,236 bytes) Text file viewer v1.2
    1 : #!/bin/wel
    2 : 
    3 : /* file: addrbook.wel
    4 : 
    5 :    주소록 메인 프로그램 (author: 서광현)
    6 : 
    7 :    Copyright (c) 2001/02/22 by Wesoft
    8 :    All Rights Reserved.
    9 : */
   10 : 
   11 : htmlquery("GET");
   12 : include("common.inc");
   13 : if(mysql_connection()==MYSQL_ERR) return;
   14 : login= admin= 0; // 로긴 상태가 아니며 관리자 메뉴 사용불능
   15 : if(include("chkuser.sub")!=OK) return disconnect();
   16 : 
   17 : if(n==0 && o==0) n= o= 1;
   18 : if(n==1) nchked= " checked"; // n 은 이름으로 찾기 체크박스 변수
   19 : if(o==1) ochked= " checked"; // o 는 직장으로 찾기 체크박스 변수
   20 : 
   21 : if(list=="s") // 검색어를 입력하여 찾기 버튼을 누른 경우
   22 :  {
   23 :    datefield= "";
   24 :    pagevar= "ps";
   25 :    sels= " selected";
   26 :    k= strchange(lrtrim(k), fch, rch);
   27 :    if(k=="") cond= "name=''"; // 검색어가 없는 경우는 없음
   28 :     else                      // (단, URL의 query에서는 제외)
   29 :      {
   30 :         if(n==1) ncond= "name like '%" ~ k ~ "%'";
   31 :         if(o==1) ocond= "office like '%" ~ k ~ "%'";
   32 :         cond= ncond;
   33 :         if(n==1 && o==1) cond~= " or ";
   34 :         cond~= ocond;
   35 :         if(o==1) order=" order by name asc"; else order=" order by office asc";
   36 :      }
   37 :  }
   38 : else if(list=="w") //  등록자료 보기
   39 :  {
   40 :     datefield= "wdtime";
   41 :     pagevar= "pw";
   42 :     selw= " selected";
   43 :     cond= datefield ~ ">'' and delflag<>'d'";
   44 :     order= " order by wdtime desc";
   45 :  }
   46 : else if(list=="m") //  수정자료 보기
   47 :  {
   48 :     datefield= "mdtime";
   49 :     pagevar= "pm";
   50 :     selm= " selected";
   51 :     cond= datefield ~ ">'' and delflag<>'d'";
   52 :     order= " order by mdtime desc";
   53 :  }
   54 : else if(list=="d") //  삭제자료 보기
   55 :  {
   56 :     datefield= "";
   57 :     pagevar= "pd";
   58 :     seld= " selected";
   59 :     cond= "delflag='d'";
   60 :     order= " order by idtime desc";
   61 :  }
   62 : else //  조회자료 보기
   63 :  {
   64 :     datefield= "idtime";
   65 :     pagevar= "pi";
   66 :     seli= " selected";
   67 :     cond= datefield ~ ">'' and delflag<>'d'";
   68 :     order= " order by idtime desc";
   69 :  }
   70 : k= queryencode(keyword=k);
   71 : 
   72 : fm= formopen("form/addrbook.fom");
   73 : if(fm==FORM_OPENERR) return err_form("addrbook.fom");
   74 : 
   75 : tot_recnt= get_recount(mysql, mytable, "");
   76 : now_recnt= get_recount(mysql, mytable, cond);
   77 : if(list=="d") del_recnt= now_recnt;
   78 :   else del_recnt= get_recount(mysql, mytable, "delflag='d'");
   79 : 
   80 : tot_page= now_recnt / pagerec;
   81 : if(now_recnt%pagerec>0) tot_page++;
   82 : view_page= val(pg);
   83 : if(view_page<1) view_page= val(parser(pagevar));
   84 : if(view_page<1) view_page= 1;
   85 :  else if(view_page>tot_page) view_page= tot_page;
   86 : parser(pagevar~"="~view_page);
   87 : start_rec= (view_page-1) * pagerec;
   88 : 
   89 : qstr= "select selno,name,hdphone,hphone,office,ophone,delflag";
   90 : if(datefield!="") qstr~= "," ~ datefield;
   91 : qstr~= " from " ~ mytable;
   92 : if(cond!="") qstr~= " where " ~ cond;
   93 : qstr~= order ~ " limit " ~ start_rec ~ "," ~ pagerec;
   94 : 
   95 : if(mysql_query(mysql, qstr)==MYSQL_ERR) return err_query();
   96 : myresult= mysql_store_result(mysql);
   97 : if(myresult==MYSQL_ERR) return err_store_result();
   98 : row_recnt= mysql_num_rows(myresult);
   99 : dflag= "";
  100 : for(rec=1; rec<=row_recnt; rec++)
  101 :  {
  102 :     row= mysql_fetch_row(myresult);
  103 :     if(row!=MYSQL_ERR)
  104 :      {
  105 :         selno= row[0];
  106 :         name= row[1];
  107 :         hdphone= row[2];
  108 :         hphone= row[3];
  109 :         office= row[4];
  110 :         ophone= row[5];
  111 :         if(list!="d") dflag= row[6];
  112 :         formmerge(0);
  113 :      }
  114 :  }
  115 : mysql_free_result(myresult);
  116 : selno= name= hphone= hdphone= office= ophone= "";
  117 : formdump();
  118 : formclose();
  119 : return disconnect();
File name: addrbook/addrbook.wel (3,236 bytes) Wesoft Corp. ⓒ 2001 All rights reserved.