/*************************************************************************************
* SQLAdmin v2.0 - An SQL Administration User Interface for the Web *
* " /> 97人妻在线公开视频在线观看,色欲AV色欲AV久久麻豆,帅小伙和警官同性3p

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

一個SQL管理員的web接口

<?   
    /*************************************************************************************  
     *        SQLAdmin  v2.0  -  An  SQL  Administration  User  Interface  for  the  Web *   
     *            Copyright  (C)  1997-98    Alessandro  VerNET  <averNET@scdi.org>      *   
     *************************************************************************************   
     *      This  library  is  free  software;  you  can  redistribute  it  and/or       *   
     *      modify  it  under  the  terms  of  the  GNU  Library  General  Public        *   
     *      License  as  published  by  the  Free  Software  Foundation;  either         *   
     *      version  2  of  the  License,  or  (at  your  option)  any  later  version.  *   
     *                                                                                   *   
     *      This  library  is  distributed  in  the  hope  that  it  will  be  useful,   *   
     *      but  WITHOUT  ANY  WARRANTY;  without  even  the  implied  warranty  of      *   
     *      MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE.    See  the  GNU  *   
     *      Library  General  Public  License  for  more  details.                       *   
     *                                                                                   *   
     *      You  should  have  received  a  copy  of  the  GNU  Library  General  Public *   
     *      License  along  with  this  library;  if  not,  write  to  the               *   
     *      Free  Software  Foundation,  Inc.,  59  Temple  Place  -  Suite  330,        *   
     *      Boston,  MA    02111-1307,  USA.                                             *   
     *************************************************************************************/   


    /*  TODO:   
      *  -  Add  sort  order.   
      *  -  Add  simple  view.   
      *  -  Add  some  documentation.   
      */   

    /*  LIMITATIONS:   
      *  -  Works  only  with  mSQL.   
      */   

    /*  HISTORY:   
      *  -  97-11-05  (averNET)  Corrected  a  bug  with  quote.   
      *  -  98-01-01  (averNET)  Added  a  sortColumn  parameter  to   
      *      administrationTable  function.   
      *  -  98-03-14  (averNET)  Added  function  addTable  to  enable  users  to   
      *      add  (but  not  modify)  en  entry  to  the  database.   
      *  -  98-05-19  (averNET)  Submitted  to  PX.   
      *  -  98-10-11  (averNET)  Now  SQLAdmin  works  with  php3.  The  php2  version   
      *      will  not  be  mainteained  anymore.   
      *  -  98-10-11  (averNET)  SQLAdmin  is  now  distributed  under  the  LGPL   
      *      instead  of  MPL.   
      */   

    function  escapeforhtml  ($string)   
    {   
        $result  =  $string;   
        //$result  =  ereg_replace  ("/"",  """,  $result);   
        $result  =  ereg_replace  ("<",  "<",  $result);   
        $result  =  ereg_replace  (">",  ">",  $result);   
        return  $result;   
    }   

    function  displayTuple  ($fieldsNumber,  $fieldNames,   
                                                  $fieldLengths,  $values,  $mode)   
    {   
        $result  =  "";   
        $result  .=  "<FORM  METHOD=/"post/"><TABLE  BORDER><TR>"  .   
            "<TD  BGCOLOR=/"#CCCCFF/">";   
        $result  .=  "<TABLE  CELLSPACING=/"0/"  CELLPADDING=/"0/">";   
        $fieldIndex  =  0;   
        while  ($fieldIndex  <  $fieldsNumber)   
        {   
            $result  .=  "<TR><TD>"  .  $fieldNames  [$fieldIndex]  .  "</TD><TD>";   
            if  ($fieldLengths  [$fieldIndex]  <=  128)   
            {   
                $result  .=  "<INPUT  TYPE=/"text/"  NAME=/""  .   
                    $fieldNames  [$fieldIndex]  .  "/"  VALUE=/""  .   
                    $values  [$fieldIndex]  .  "/"  SIZE=/"64/">";   
            }   
            else   
            {   
                $result  .=  "<TEXTAREA  NAME=/""  .   
                    $fieldNames  [$fieldIndex]  .  "/""  .   
                    "  COLS=/"64/"  ROWS=/"10/"  WRAP=/"virtual/">"  .   
                    escapeforhtml  ($values  [$fieldIndex])  .  "</TEXTAREA>";   
            }   
            $result  .=    "<INPUT  TYPE=/"hidden/"  NAME=/"old-"  .   
                $fieldNames  [$fieldIndex]  .   
                "/"  VALUE=/""  .  escapeforhtml  ($values  [$fieldIndex])  .  "/">"  .   
                "</TD></TR>";   
            $fieldIndex++;   
        }   
        $result  .=  "<TR><TD  ALIGN=/"center/"  COLSPAN=/"2/">";   
        if  ($mode  ==  "modify")   
        {   
            $result  .=  "<INPUT  TYPE=/"submit/"  NAME=/"remove/"  VALUE=/"Remove/">";   
            $result  .=  "<INPUT  TYPE=/"submit/"  NAME=/"update/"  VALUE=/"Update/">";   
        }   
        else   
            {  $result  .=  "<INPUT  TYPE=/"submit/"  NAME=/"add/"  VALUE=/"Add/">";  }   
        $result  .=  "</TABLE></TD></TR></TABLE></FORM>";   
        return  $result;   
    }   

    function  fieldFromType  ($text,  $type)   
    {   
        if  ($type  ==  "int"  ||  $type  ==  "uint"  ||  $type  == "real")   
            {  $result  =  $text;  }   
        else   
            {  $result  =  "'"  .  AddSlashes  ($text)  .  "'";  }   
        return  $result;   
    }   

    function  executeMsql  ($database,  $command)   
    {   
        /*echo  "<TT>"  .  $command  .  "</TT><HR>";*/   
        msql  ($database,  $command);   
    }   

    function  handleRemove  ($database,  $table,  $fieldsNumber,   
                                                  $fieldNames,  $fieldLengths,  $fieldTypes)   
    {   
        global  $remove;   
        if  ($remove  !=  "")   
        {   
            $command  =  "DELETE  FROM  "  .  $table  .  "  WHERE  ";   
            $fieldIndex  =  0;   
            while  ($fieldIndex  <  $fieldsNumber)   
            {   
                $fieldName  =  "old-"  .  $fieldNames  [$fieldIndex];   
                global  $$fieldName;   
                $command  .=  $fieldNames  [$fieldIndex]  .  "="  .   
                    fieldFromType  ($$fieldName,  $fieldTypes  [$fieldIndex]);   
                if  ($fieldIndex  !=  $fieldsNumber  -  1)   
                    {  $command  .=  "  AND  ";  }   
                $fieldIndex++;   
            }                  
            executeMsql  ($database,  $command);   
        }   
    }   

    function  handleUpdate  ($database,  $table,  $fieldsNumber,   
                                                  $fieldNames,  $fieldLengths,  $fieldTypes)   
    {   
        global  $update;   
        if  ($update  !=  "")   
        {   
            $command  =  "UPDATE  "  .  $table  .  "  SET  ";   
            $fieldIndex  =  0;   
            while  ($fieldIndex  <  $fieldsNumber)   
            {   
                $fieldName  =  $fieldNames  [$fieldIndex];   
                global  $$fieldName;   
                $command  .=  $fieldName  .  "="  .   
                    fieldFromType  ($$fieldName,  $fieldTypes  [$fieldIndex]);   
                if  ($fieldIndex  !=  $fieldsNumber  -  1)   
                    {  $command  .=  ",  ";  }   
                $fieldIndex++;   
            }   
            $command  .=  "  WHERE  ";   
            $fieldIndex  =  0;   
            while  ($fieldIndex  <  $fieldsNumber)   
            {   
                $fieldName  =  "old-"  .  $fieldNames  [$fieldIndex];   
                global  $$fieldName;   
                $command  .=  $fieldNames  [$fieldIndex]  .  "="  .   
                    fieldFromType  ($$fieldName,  $fieldTypes  [$fieldIndex]);   
                if  ($fieldIndex  !=  $fieldsNumber  -  1)   
                    {  $command  .=  "  AND  ";  }   
                $fieldIndex++;   
            }   
            executeMsql  ($database,  $command);   
        }   
    }   

    function  handleAdd  ($database,  $table,  $fieldsNumber,   
                                            $fieldNames,  $fieldLengths,  $fieldTypes)   
    {   
        global  $add;   
        if  ($add  !=  "")   
        {   
            $command  =  "INSERT  INTO  "  .  $table  .  "  (";   
            $fieldIndex  =  0;   
            while  ($fieldIndex  <  $fieldsNumber)   
            {   
                $command  .=  $fieldNames  [$fieldIndex];   
                if  ($fieldIndex  !=  $fieldsNumber  -  1)   
                    {  $command  .=  ",  ";  }   
                $fieldIndex++;   
            }   
            $command  .=  ")  VALUES  (";   
            $fieldIndex  =  0;   
            while  ($fieldIndex  <  $fieldsNumber)   
            {   
                $fieldName  =  $fieldNames  [$fieldIndex];   
                global  $$fieldName;   
                $command  .=  fieldFromType  ($$fieldName,  $fieldTypes  [$fieldIndex]);   
                if  ($fieldIndex  !=  $fieldsNumber  -  1)   
                    {  $command  .=  ",  ";  }   
                $fieldIndex++;   
            }   
            $command  .=  ")";   
            executeMsql  ($database,  $command);   
        }   
    }   

    function  displayRemoveUpdate  ($database,  $table,  $sortColumn,   
                                                                $fieldsNumber,  $fieldNames,  $fieldLengths)   
    {   
        $result  =  "";   
        if  ($sortColumn  !=  "")   
            {  $sortColumn  =  "  ORDER  BY  "  .  $sortColumn;  }   
        $msqlresult  =  msql  ($database,  "SELECT  *  FROM  "  .  $table  .  $sortColumn);   
        $tuplesNumber  =  msql_numrows  ($msqlresult);   
        $tupleIndex  =  0;   
        while  ($tupleIndex  <  $tuplesNumber)   
        {   
            $fieldIndex  =  0;   
            while  ($fieldIndex  <  $fieldsNumber)   
            {   
                $values  [$fieldIndex]  =  msql_result  ($msqlresult,  $tupleIndex,   
                    $fieldNames  [$fieldIndex]);   
                $fieldIndex++;   
            }   
            $result  .=  displayTuple  ($fieldsNumber,  $fieldNames,   
                $fieldLengths,  $values,  "modify");   
            $tupleIndex++;   
        }   
        return  $result;   
    }   

    function  displayAdd  ($fieldsNumber,  $fieldNames,  $fieldLengths)   
    {   
        $result  =  "";   
        $fieldIndex  =  0;   
        while  ($fieldIndex  <  $fieldsNumber)   
        {   
            $values  [$fieldIndex]  =  "";   
            $fieldIndex++;   
        }   
        $result  .=  displayTuple  ($fieldsNumber,  $fieldNames,   
            $fieldLengths,  $values,  "add");   
        msql_close  ();   
        return  $result;   
    }   

    function  administrationTable  ($database,  $table,  $sortColumn)   
    {   
        $result  =  "";   
        msql_connect  ( "localhost");   
        $msqlresult  =  msql  ($database,  "SELECT  *  FROM  "  .  $table);   
        $fieldsNumber  =  msql_numfields  ($msqlresult);    
        $msqlresult  =  msql_listfields  ($database,  $table);   
        $fieldIndex  =  0;   
        while  ($fieldIndex  <  $fieldsNumber)   
        {   
            $fieldNames  [$fieldIndex]  =  msql_fieldname  ($msqlresult,  $fieldIndex);   
            $fieldLengths  [$fieldIndex]  =  msql_fieldlen  ($msqlresult,  $fieldIndex);   
            $fieldTypes  [$fieldIndex]  =  msql_fieldtype  ($msqlresult,  $fieldIndex);   
            $fieldIndex++;   
        }   
        handleRemove  ($database,  $table,  $fieldsNumber,  $fieldNames,  $fieldLengths,  $fieldTypes);   
        handleUpdate  ($database,  $table,  $fieldsNumber,  $fieldNames,  $fieldLengths,  $fieldTypes);   
        handleAdd  ($database,  $table,  $fieldsNumber,  $fieldNames,  $fieldLengths,  $fieldTypes);   
        $result  .=  displayRemoveUpdate  ($database,  $table,  $sortColumn,  $fieldsNumber,  $fieldNames,    
$fieldLengths);   
        $result  .=  displayAdd  ($fieldsNumber,  $fieldNames,  $fieldLengths);   
        return  $result;   
    }   

    function  addTable  ($database,  $table)   
    {   
        $result  =  "";   
        msql_connect  ( "localhost");   
        $msqlresult  =  msql  ($database,  "SELECT  *  FROM  "  .  $table);   
        $fieldsNumber  =  msql_numfields  ($msqlresult);    
        $msqlresult  =  msql_listfields  ($database,  $table);   
        $fieldIndex  =  0;   
        while  ($fieldIndex  <  $fieldsNumber)   
        {   
            $fieldNames  [$fieldIndex]  =  msql_fieldname  ($msqlresult,  $fieldIndex);   
            $fieldLengths  [$fieldIndex]  =  msql_fieldlen  ($msqlresult,  $fieldIndex);   
            $fieldTypes  [$fieldIndex]  =  msql_fieldtype  ($msqlresult,  $fieldIndex);   
            $fieldIndex++;   
        }   
        handleAdd  ($database,  $table,  $fieldsNumber,  $fieldNames,  $fieldLengths,  $fieldTypes);   
        $result  .=  displayAdd  ($fieldsNumber,  $fieldNames,  $fieldLengths);   
        return  $result;   
    }   
?>   

php技術一個SQL管理員的web接口,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 欧美精品做人一级爱免费 | 白人大战34厘米黑人BD | 国产精品久久久久久人妻精品流 | 亚洲AV国产国产久青草 | 国产精品免费一区二区三区四区 | 在线视频网站www色 在线视频免费国产成人 | 青青国产在线观看视频 | 十八禁肉动漫无修在线播放 | 色欲久久精品AV无码 | jyzzjyzzz视频国产在线观看 | 日产亚洲一区二区三区 | 香蕉久久夜色精品国产小优 | 久草精品视频 | 亚洲精品色婷婷在线蜜芽 | 在线精彩视频在线观看免费 | 国产午夜视频在永久在线观看 | 久久视热频国产这里只有精品23 | 色欲国产麻豆精品AV免费 | 超碰97超碰在线视频哦 | 青草视频久久 | 精品视频一区二区三三区四区 | 国语对白刺激真实精品 | 久久久久久88色偷偷 | 少妇精品无码一区二区三区 | 亚洲理论片在线中文字幕 | 久久亚洲精品成人综合 | 日韩a视频在线观看 | 青娱乐极品视觉盛宴av | 干了快生了的孕妇 | 天海翼精品久久中文字幕 | 亚洲精品久久一区二区三区四区 | 嘟嘟嘟在线视频免费观看高清中文 | 亚洲色欲色欲WWW在线丝 | 2020最新无码国产在线视频 | 麻婆豆腐传媒视频免费 | 爽死你个放荡粗暴小淫货漫画 | 国产亚洲精品V在线观看一 国产亚洲精品a在线观看app | 国产午夜精品久久理论片小说 | 大香伊人中文字幕精品 | 亚洲国产精品无码AV久久久 | 亚洲免费无码中文在线 |