一个SQL管理员的web接口
/*************************************************************************************
* SQLAdmin v2.0 - An SQL Administration User Interface for the Web *
* Copyright (C) 1997-98 Alessandro Vernet
*************************************************************************************
* 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 = ereg_replace (">", ">", $result);
return $result;
}
function displayTuple ($fieldsNumber, $fieldNames,
$fieldLengths, $values, $mode)
{
$result = "";
$result .= "";
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 "" . $command . "
";*/
msql ($database, $command);
}
function handleRemove ($database, $table, $fieldsNumber,
$fieldNames, $fieldLengths, $fieldTypes)
{
global $remove;
if ($remove != "")
{
$command = "DELETE FROM " . $table . " WHERE ";
$fieldIndex = 0;
while ($fieldIndex {
$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 {
$fieldName = $fieldNames [$fieldIndex];
global $$fieldName;
$command .= $fieldName . "=" .
fieldFromType ($$fieldName, $fieldTypes [$fieldIndex]);
if ($fieldIndex != $fieldsNumber - 1)
{ $command .= ", "; }
$fieldIndex++;
}
$command .= " WHERE ";
$fieldIndex = 0;
while ($fieldIndex {
$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 {
$command .= $fieldNames [$fieldIndex];
if ($fieldIndex != $fieldsNumber - 1)
{ $command .= ", "; }
$fieldIndex++;
}
$command .= ") VALUES (";
$fieldIndex = 0;
while ($fieldIndex {
$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 {
$fieldIndex = 0;
while ($fieldIndex {
$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 {
$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 {
$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 {
$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;
}
?>

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Win11 시스템을 사용할 때 관리자 사용자 이름과 비밀번호를 입력하라는 메시지가 표시되는 경우가 있습니다. 이 문서에서는 이 상황을 처리하는 방법에 대해 설명합니다. 방법 1: 1. [Windows 로고]를 클릭한 다음 [Shift+다시 시작]을 눌러 안전 모드로 들어가거나 이 방법으로 안전 모드로 들어갑니다. 시작 메뉴를 클릭하고 설정을 선택합니다. "업데이트 및 보안"을 선택하고 "복구"에서 "지금 다시 시작"을 선택한 후 옵션을 입력하고 - 문제 해결 - 고급 옵션 - 시작 설정 -&mdash를 선택하세요.

HQL과 SQL은 Hibernate 프레임워크에서 비교됩니다. HQL(1. 객체 지향 구문, 2. 데이터베이스 독립적 쿼리, 3. 유형 안전성), SQL은 데이터베이스를 직접 운영합니다(1. 데이터베이스 독립적 표준, 2. 복잡한 실행 파일) 쿼리 및 데이터 조작).

컴퓨터를 조립할 때 설치 과정은 간단하지만 배선에 문제가 발생하는 경우가 종종 있습니다. 컴퓨터가 켜지면 F1 오류 "CPUFanError"가 발생하며 이로 인해 CPU 쿨러가 지능적으로 속도를 조정할 수 없게 됩니다. 컴퓨터 마더보드의 CPU_FAN, SYS_FAN, CHA_FAN, CPU_OPT 인터페이스에 대한 상식을 공유해 보겠습니다. 컴퓨터 마더보드의 CPU_FAN, SYS_FAN, CHA_FAN 및 CPU_OPT 인터페이스에 대한 대중적인 과학 1. CPU_FANCPU_FAN은 CPU 라디에이터 전용 인터페이스이며 12V에서 작동합니다.

PHP 인터페이스 소개 및 정의 방법 PHP는 웹 개발에 널리 사용되는 오픈 소스 스크립팅 언어입니다. 유연하고 간단하며 강력합니다. PHP에서 인터페이스는 여러 클래스 간의 공통 메서드를 정의하여 다형성을 달성하고 코드를 보다 유연하고 재사용 가능하게 만드는 도구입니다. 이 기사에서는 PHP 인터페이스의 개념과 이를 정의하는 방법을 소개하고 사용법을 보여주는 특정 코드 예제를 제공합니다. 1. PHP 인터페이스 개념 인터페이스는 클래스 애플리케이션을 정의하는 객체 지향 프로그래밍에서 중요한 역할을 합니다.

Cockpit은 Linux 서버용 웹 기반 그래픽 인터페이스입니다. 이는 주로 신규/전문가 사용자가 Linux 서버를 보다 쉽게 관리할 수 있도록 하기 위한 것입니다. 이 문서에서는 Cockpit 액세스 모드와 CockpitWebUI에서 Cockpit으로 관리 액세스를 전환하는 방법에 대해 설명합니다. 콘텐츠 항목: Cockpit 입장 모드 현재 Cockpit 액세스 모드 찾기 CockpitWebUI에서 Cockpit에 대한 관리 액세스 활성화 CockpitWebUI에서 Cockpit에 대한 관리 액세스 비활성화 결론 조종석 입장 모드 조종석에는 두 가지 액세스 모드가 있습니다. 제한된 액세스: 이는 조종석 액세스 모드의 기본값입니다. 이 액세스 모드에서는 조종석에서 웹 사용자에 액세스할 수 없습니다.

MySQL 연결 수가 데이터베이스 성능에 미치는 영향 분석 인터넷 애플리케이션의 지속적인 개발로 인해 데이터베이스는 애플리케이션 시스템을 지원하는 중요한 데이터 저장 및 관리 도구가 되었습니다. 데이터베이스 시스템에서 연결 수는 데이터베이스 시스템의 성능 및 안정성과 직결되는 중요한 개념이다. 이 기사에서는 MySQL 데이터베이스의 관점에서 시작하여 연결 수가 데이터베이스 성능에 미치는 영향을 살펴보고 특정 코드 예제를 통해 분석합니다. 1. 연결 수는 얼마나 됩니까? 연결 수는 데이터베이스 시스템이 동시에 지원하는 클라이언트 연결 수를 의미하며 관리할 수도 있습니다.

PHP는 웹 개발의 백엔드에 속합니다. PHP는 주로 서버 측 로직을 처리하고 동적 웹 콘텐츠를 생성하는 데 사용되는 서버 측 스크립팅 언어입니다. 프런트엔드 기술과 비교하여 PHP는 데이터베이스와의 상호 작용, 사용자 요청 처리, 페이지 콘텐츠 생성과 같은 백엔드 작업에 더 많이 사용됩니다. 다음으로, 백엔드 개발에서 PHP 적용을 설명하기 위해 특정 코드 예제가 사용됩니다. 먼저 데이터베이스에 연결하고 데이터를 쿼리하기 위한 간단한 PHP 코드 예제를 살펴보겠습니다.

인터페이스와 추상 클래스는 분리 및 확장성을 위해 디자인 패턴에 사용됩니다. 인터페이스는 메서드 시그니처를 정의하고 추상 클래스는 부분 구현을 제공하며 하위 클래스는 구현되지 않은 메서드를 구현해야 합니다. 전략 패턴에서는 인터페이스를 사용하여 알고리즘을 정의하고 추상 클래스 또는 구상 클래스를 통해 구현을 제공하므로 알고리즘을 동적으로 전환할 수 있습니다. 관찰자 패턴에서 인터페이스는 관찰자 동작을 정의하는 데 사용되며 추상 또는 구체적인 클래스는 알림을 구독하고 게시하는 데 사용됩니다. 어댑터 패턴에서 인터페이스는 기존 클래스를 조정하는 데 사용됩니다. 추상 클래스 또는 구체적인 클래스는 호환되는 인터페이스를 구현하여 원본 코드와 상호 작용할 수 있습니다.
