一个SQL管理员的web接口

2008-02-23 06:23:45来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

<?
/*************************************************************************************
* 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]) . "\">" .

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:二十行语句实现从Excel到mysql的转化

下一篇:屏蔽浏览器缓存另类方法