File name: welboard2/BDdel (2,279 bytes) Text file viewer v1.2
    1 : #!/bin/wel
    2 : 
    3 : /* file: BDdel
    4 : 
    5 :    게시판 삭제 프로그램 (author: 서광현)
    6 : 
    7 :    Copyright (c) 2001/03/25 by Wesoft
    8 :    All Rights Reserved.
    9 : */
   10 : 
   11 : timeout(0);
   12 : path= argv[0];
   13 : if(right(path,5)=="BDdel") path= left(path, len(path) - 5);
   14 : if(path!="" && path!="./") chdir(path);
   15 : 
   16 : function cancel_message(string msg)
   17 :  {
   18 :     if(msg!="") print(" ERROR: ", msg, "\n");
   19 :     print(" Board deletion is cancelled.\n\n");
   20 :     return;
   21 :  }
   22 : 
   23 : print("<<--- WelBoard V2.0.4 board deletion --->>\n\n");
   24 : if(argc>1) db= argv[1];
   25 :  else
   26 :  {
   27 :    while(1)
   28 :     {
   29 :        print("1. Board DB(table) name: "); db= lrtrim(input()); print();
   30 :        if(db=="") { cancel_message(""); return; }
   31 :        len= len(tolower(db));
   32 :        if(len>0 && (strkind(db)&0xFFF1)==0) break;
   33 :        print("Bad new board name! (Usable charater: 0~9, A~Z, a~z)\n");
   34 :     }
   35 :  }
   36 : 
   37 : conf= "conf/" ~ db ~ ".conf";
   38 : if(!fexist(conf))
   39 :  {
   40 :     cancel_message("Not exist!, board name: " ~ db);
   41 :     return;
   42 :  }
   43 : 
   44 : print("WARNING: all data in board(", db, "), WILL BE LOST! ");
   45 : sel= choice("Are you sure (y/N)? ", "Yy\nNn");
   46 : if(sel==3) print("N");
   47 : print("\n\n");
   48 : if(sel>2) { cancel_message(""); return; }
   49 : 
   50 : break_on= -1;
   51 : include("include/board.inc");
   52 : message_form= "";
   53 : 
   54 : include(conf, -1);
   55 : print("Administrator user id: "); id= input(); print();
   56 : if(id=="") { cancel_message(""); return; }
   57 : if(id!=board_admin_id)
   58 :  {
   59 :     cancel_message("Incorrect administrator user id!");
   60 :     return;
   61 :  }
   62 : print("Administrator password: "); pass= input(); print();
   63 : depass= decode(board_admin_pass, "", decode_variable);
   64 : if(pass!=depass)
   65 :  {
   66 :     cancel_message("Incorrect administrator password!");
   67 :     return;
   68 :  }
   69 : 
   70 : print("\n\n1. Drop board table: ", db, "\n");
   71 : rt= mysql_connection("");
   72 : if(rt==MYSQL_ERR)
   73 :  {
   74 :     if(mysql==MYSQL_ERR) msg= "MySQL connection error!";
   75 :       else msg= "MySQL select db error! (DB=" ~ mydb ~ ")";
   76 :     cancel_message(msg);
   77 :     return disconnect();
   78 :  }
   79 : rt= mysql_query(mysql, "drop table " ~ db);
   80 : if(rt==MYSQL_ERR)
   81 :  {
   82 :     msg= "MySQL drop table error! (DB=" ~ mydb ~ ", TABLE=" ~ db ~ ")";
   83 :     cancel_message(msg);
   84 :     return disconnect();
   85 :  }
   86 : print("2. Deleting board configuration file: ", conf, "\n");
   87 : unlink(conf);
   88 : upload_dir= "upload/" ~ db;
   89 : if(fexist(upload_dir)) system("rm -Rf upload/" ~ db);
   90 : print("\n>>> deleted board db=" ~ db, "\n");
   91 : return disconnect();
File name: welboard2/BDdel (2,279 bytes) Wesoft Corp. ⓒ 2001 All rights reserved.