File name: addrbook/admin.wel (3,711 bytes) Text file viewer v1.2
    1 : #!/bin/wel
    2 : 
    3 : /* file: admin.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= 0, admin= 1; // 로긴 상태가 아니며 관리자 메뉴 사용가능
   15 : if(include("chkuser.sub")!=OK) return disconnect();
   16 : 
   17 : if(list=="s") // 검색어를 입력하여 찾기 버튼을 누른 경우
   18 :  {
   19 :    pagevar= "ps";
   20 :    sels= " selected";
   21 :    k= strchange(lrtrim(k), fch, rch);
   22 :    cond= "id like '%" ~ k ~ "%' or name like '%" ~ k
   23 :        ~ "%' or title like '%" ~ k ~ "%'";
   24 :    order= " order by id asc";
   25 :  }
   26 : else if(list=="w") // 등록순으로 보기
   27 :  {
   28 :     pagevar= "pw";
   29 :     selw= " selected";
   30 :     cond= "";
   31 :     order= " order by wdtime desc,selno desc";
   32 :  }
   33 : else if(list=="S") // 사용신청
   34 :  {
   35 :     pagevar= "pS";
   36 :     selS= " selected";
   37 :     cond= "useflag='S'";
   38 :     order= " order by wdtime asc,selno desc";
   39 :  }
   40 : else if(list=="N") // 사용정지
   41 :  {
   42 :     pagevar= "pN";
   43 :     selN= " selected";
   44 :     cond= "useflag='N'";
   45 :     order= " order by sdtime asc,id asc";
   46 :  }
   47 : else if(list=="l") // 로그인순으로 보기
   48 :  {
   49 :     pagevar= "pl";
   50 :     sell= " selected";
   51 :     cond= "";
   52 :     order= " order by ldtime desc,id asc";
   53 :  }
   54 : else // 로그인의 역순으로 보기
   55 :  {
   56 :     datefield= "ldtime";
   57 :     pagevar= "pr";
   58 :     selr= " selected";
   59 :     cond= "";
   60 :     order= " order by ldtime asc,wdtime asc";
   61 :  }
   62 : k= queryencode(keyword=k);
   63 : 
   64 : fm= formopen("form/admin.fom");
   65 : if(fm==FORM_OPENERR) return err_form("admin.fom");
   66 : 
   67 : tot_recnt= get_recount(mysql, myustable, "");
   68 : now_recnt= get_recount(mysql, myustable, cond);
   69 : tot_page= now_recnt / pagerec;
   70 : if(now_recnt%pagerec>0) tot_page++;
   71 : view_page= val(pg);
   72 : if(view_page<1) view_page= val(parser(pagevar));
   73 : if(view_page<1) view_page= 1;
   74 :  else if(view_page>tot_page) view_page= tot_page;
   75 : parser(pagevar~"="~view_page);
   76 : start_rec= (view_page-1) * pagerec;
   77 : 
   78 : qstr= "select selno,wdtime,ldtime,lldtime,id,title,usecnt,class,kind,"
   79 :     ~ "useflag,name from " ~ myustable;
   80 : if(cond!="") qstr~= " where " ~ cond;
   81 : qstr~= order ~ " limit " ~ start_rec ~ "," ~ pagerec;
   82 : 
   83 : if(mysql_query(mysql, qstr)==MYSQL_ERR) return err_query();
   84 : myresult= mysql_store_result(mysql);
   85 : if(myresult==MYSQL_ERR) return err_store_result();
   86 : 
   87 : row_recnt= mysql_num_rows(myresult);
   88 : for(rec=1; rec<=row_recnt; rec++)
   89 :  {
   90 :     row= mysql_fetch_row(myresult);
   91 :     if(row!=MYSQL_ERR)
   92 :      {
   93 :         selno= row[0];
   94 :         wdtime= mid(row[1],3);
   95 :         logtime= mid(row[2],3);
   96 :         if(row[3]!="") logtime~= " [" ~ mid(row[3],3) ~ "]";
   97 :         if(logtime=="") logtime= "<font color=#f00000>Never logged in.</font>";
   98 :         id= row[4];
   99 :         title= row[5];
  100 :         if(len(title)>15)
  101 :           title= left(title,15,1) ~ "<font color=#f00000>...</font>";
  102 :         usecnt= row[6];
  103 :         class= row[7];
  104 :         kind= row[8];
  105 :         useflag= row[9];
  106 :         if(kind=="C") cku= "폐쇄";
  107 :           else if(kind=="O") cku= "<font color=#f00000>공개</font>";
  108 :           else cku= "모름";
  109 :         if(useflag=="S") cku~= "/<font color=#009000>신청</font>";
  110 :           else if(useflag=="Y") cku~= "/<font color=#000090>가동</font>";
  111 :           else if(useflag=="N") cku~= "/<font color=#f00000>정지</font>";
  112 :           else cku~= "/모름";
  113 :         if(class=="U") cku= "User/" ~ cku;
  114 :           else if(class!="A") cku= "모름/" ~ cku;
  115 :           else cku= "<font color=#f00000>관리자</font>";
  116 :         name= row[10];
  117 :         addr_recnt= get_recount(mysql, preTBname~id, "");
  118 :         if(addr_recnt==-1) addr_recnt= "<font color=#f00000>NoTB</font>";
  119 :          else if(addr_recnt==-2) addr_recnt= "???";
  120 :         formmerge(0);
  121 :      }
  122 :  }
  123 : mysql_free_result(myresult);
  124 : selno=wdtime=logtime=id=addr_recnt=title=usecnt=cku=name= "";
  125 : formdump();
  126 : formclose();
  127 : return disconnect();
File name: addrbook/admin.wel (3,711 bytes) Wesoft Corp. ⓒ 2001 All rights reserved.