session_cache_limiter('nocache, must-revalidate');
session_register("dbInfo");
$ufObj=new UF;
if ($mode=="set")
{
$dbInfo[hostName] = trim(stripslashes($hostName));
$dbInfo[userName] = trim(stripslashes($userName));
$dbInfo[userPW] = trim(stripslashes($userPW));
$dbInfo[dbName] = trim(stripslashes($dbName));
$dbInfo[flag] = true;
$dbObj = new MysqlClass($dbInfo[hostName],$dbInfo[userName],$dbInfo[userPW],$dbInfo[dbName]);
$query = 'show tables';
$dbObj->setQuery($query);
$result = $dbObj->exQuery();
if ($result == 1 || $result <= 0)
{
$dbInfo[flag] = false;
} # if
$urlV=$ufObj->newURL($PHP_SELF,"xndb.html");
echo "";
exit;
}
if ($mode=="reset")
{
$dbInfo[flag] = false;
$urlV=$ufObj->newURL($PHP_SELF,"xndb.html");
echo "";
exit;
}
?>
XNDB 2.0
">
| XNDB 2.0 written by Lee,Young-Hwa who is JAVA, C++, PHP Developer. |
if ($dbInfo[flag] != true)
{
echo
'';
}
if ($dbInfo[flag] == true)
{
echo
'
';
if (!$query) $query="show tables";
if (trim(stripslashes($query)) == 'exit') { echo ''; exit; }
$dbObj = new MysqlClass($dbInfo[hostName],$dbInfo[userName],$dbInfo[userPW],$dbInfo[dbName]);
$dbObj->setQuery(trim(stripslashes($query)));
$result = $dbObj->exQuery();
if ($result==1 || $result<=0)
{
$urlV=$ufObj->newURL($PHP_SELF,"xndb.html");
echo "";
exit;
} # if
$nFields=mysql_num_fields($result);
$nRows=mysql_num_rows($result);
$buffer=0;
echo
'';
if ($result)
{
echo
'
| # | ';
for ($i=0; $i<$nFields; $i++)
{
echo
'';
echo mysql_field_name($result,$i);
echo' | ';
} # for
echo'
';
} # if
echo
'
| # | ';
for ($i=0; $i<$nFields; $i++)
{
echo
''.$i.' | ';
} # for
echo
'
';
while($row=mysql_fetch_row($result))
{
echo
'
| '.$buffer++.' | ';
for($i=0; $i<$nFields; $i++)
{
echo
''.$row[$i].' | ';
} # for
echo
'
';
} # while
echo
'
';
mysql_free_result($result);
} # if
?>
/*
CopyLeft (C) 2000
Edited & Distributed under the terms of the GNU Library General Public License
mySQL Class 0.7.1 for PHP
Final modification date : 2001/04/08
File name : mysqlClass.zclass
Developer : Lee,Young-Hwa who is a PHP Developer & SCJP
*/
class MysqlClass
{
// Declartion of Member Variables;
var $hostName;
var $usrName;
var $passWd;
var $dbName;
var $tableName;
var $query;
// Constructor
function MysqlClass($hostName,$usrName,$passWd,$dbName)
{
$this->hostName=$hostName;
$this->usrName=$usrName;
$this->passWd=$passWd;
$this->dbName=$dbName;
}
// Implementation of Useful Functions
function setQuery($query)
{
if($query=="") return False;
$this->query=$query;
}
function exQuery()
{
$linkIdentifier=@mysql_connect($this->hostName,$this->usrName,$this->passWd);
$returnValue=@mysql_db_query($this->dbName,$this->query,$linkIdentifier);
@mysql_close($linkIdentifier);
return $returnValue;
}
} // End of MysqlClass
?>
/*
CopyLeft (C) 2000~2001
Edited & Distributed under the terms of the GNU Library General Public License
Useful function PHP Class Version 0.1.3 for PHP
Final modification date : 2001-05-29
FileName : uf.zclass
Developer : Lee,Young-Hwa who is a PHP Developer & SCJP
*/
class UF // Useful Functions Class
{
// Converting DateFormat from the default to the Korean
function getKoreanDate()
{
$date=date('y-m-d');
list($year,$month,$day)=split('-',$date);
return '20'.$year.'³â '.$month.'¿ù '.$day.'ÀÏ';
}
function getCommaKoreanDate()
{
$date=date('y-m-d');
list($year,$month,$day)=split('-',$date);
return '20'.$year.'. '.$month.'. '.$day;
}
function convertKoreanDate($date)
{
list($year,$month,$day)=split('-',$date);
return $year.'³â '.$month.'¿ù '.$day.'ÀÏ';
}
function convertCommaKoreanDate($date)
{
list($year,$month,$day)=split('-',$date);
return $year.'.'.$month.'.'.$day;
}
// Converting \n to HTML
tag
function nTobr($string)
{
return ereg_replace("\n","
",stripslashes($string));
}
function nToRE($string)
{
return ereg_replace("\n","\n>",stripslashes($string));
}
// Return Next Family ID
function fmlID($result)
{
if ($result=="null")
{
return 1;
}else
{
return $result+1;
}
}
// Return new string after a array's last value is updated to a next character
function parseString($string,$parent)
{
if($string=="")
{
return $parent.'A';
}
$chars = preg_split('//',$string, -1, PREG_SPLIT_NO_EMPTY);
$lastIndex=sizeof($chars)-1;
$lastValue=$chars[$lastIndex];
$newChar=ord($lastValue)+1; // ASCII Value
$chars[$lastIndex]=chr($newChar);
return join("",$chars);
}
// indent
function indent($str)
{
$indentValue=10;
return strlen($str)*$indentValue;
}
//
function answerIMG($str,$imgPath)
{
if(strlen($str)>1)
{
return $buffer="
";
}
}
// ±è½Â¸¸´Ô FROM PHPSCHOOL
function han_substr($string, $limit_length)
{
$string_length = strlen( $string );
if ( $limit_length <= $string_length )
{
$string = substr( $string, 0, $limit_length );
$han_char = 0;
for ( $i = $limit_length-1; $i>=0; $i-- )
{
$lastword = ord( substr( $string, $i, 1 ) ); //µÚ¿¡¼ ÇѱÛÀÚ¾¿ ¶¼¾î¼
if ( 127 > $lastword )
{
break; //Á¤»óÀûÀÎ ¿µ¹®ÀÚ,¼ýÀÚ¶ó¸é..stop
}else
{
$han_char++; //ÇÑ±Û or Ư¼ö¹®ÀÚ¶ó¸é..
} // if
} // for
if ( $han_char%2 == 1 )
{
//¦ÀÌ ¾È¸ÂÀ¸¹Ç·Î ÇѱÛÀÚ ´õ ÀÛ°Ô ÀÚ¸¥´Ù.
$string = substr( $string, 0, $limit_length-1 );
}//if
}//if
return $string;
}//end of han_substr
function newURL($PHP_SELF_,$string)
{
$list=split('/',$PHP_SELF_);
$list[sizeof($list)-1]=$string;
for($i=1;$i<=sizeof($list)-1;$i++)
{
$result.='/'.$list[$i];
}
return $result;
} // end of newURL
function filePath($string,$fullPath)
{
$dir="/".$string;
$list=split('/',$fullPath);
$result[fileName]=$list[sizeof($list)-1];
$result[filePath]=strstr($fullPath,$dir);
return $result;
} // End "filePath"
} // End of UF Class
?>