提交 7bd4cadd 编写于 作者: M Medicean

Fix(Core/PHP) 修复 PHP 类型数据库连接在PHP7下函数废除引起的问题

上级 5cc6c699
......@@ -2,6 +2,12 @@
> 有空会补补BUG、添添新功能。
> 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT.
## 2021/03/27 `v(2.1.11.1)`
### 核心
* 修复 PHP 类型数据库连接在PHP7下函数废除引起的问题
## 2021/03/26 `v(2.1.11)`
### 后端模块
......
......@@ -75,20 +75,20 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
@mssql_select_db($dbn,$T);
$q=@mssql_query($sql,$T);
if(is_bool($q)){
echo("Status\t|\tAffect Rows\t|\t\r\n".($q?"VHJ1ZQ==":"RmFsc2U=")."\t|\t".base64_encode(@mssql_rows_affected($T)." row(s)")."\t|\t\r\n");
echo("Status\\t|\\tAffect Rows\\t|\\t\\r\\n".($q?"VHJ1ZQ==":"RmFsc2U=")."\\t|\\t".base64_encode(@mssql_rows_affected($T)." row(s)")."\\t|\\t\\r\\n");
}else{
$i=0;
while($rs=@mssql_fetch_field($q)){
echo($rs->name."\t|\t");
echo($rs->name."\\t|\\t");
$i++;
}
echo("\r\n");
echo("\\r\\n");
while($rs=@mssql_fetch_row($q)){
for($c=0;$c<$i;$c++){
echo(base64_encode(trim($rs[$c])));
echo("\t|\t");
echo("\\t|\\t");
}
echo("\r\n");
echo("\\r\\n");
}
@mssql_free_result($q);
}
......
......@@ -6,14 +6,33 @@
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
// 显示所有数据库
show_databases: {
_: `$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];$T=@mysql_connect($hst,$usr,$pwd);$q=@mysql_query("SHOW DATABASES");while($rs=@mysql_fetch_row($q)){echo(trim($rs[0]).chr(9));}@mysql_close($T);`,
_: `$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$T=@mysql_connect($hst,$usr,$pwd);
$q=@mysql_query("SHOW DATABASES");
while($rs=@mysql_fetch_row($q)){
echo(trim($rs[0]).chr(9));
}
@mysql_close($T);`.replace(/\n\s+/g, ''),
[arg1]: '#{host}',
[arg2]: '#{user}',
[arg3]: '#{passwd}'
},
// 显示数据库所有表
show_tables: {
_: `$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];$T=@mysql_connect($hst,$usr,$pwd);$q=@mysql_query("SHOW TABLES FROM \`{$dbn}\`");while($rs=@mysql_fetch_row($q)){echo(trim($rs[0]).chr(9));}@mysql_close($T);`,
_: `$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$T=@mysql_connect($hst,$usr,$pwd);
$q=@mysql_query("SHOW TABLES FROM \`{$dbn}\`");
while($rs=@mysql_fetch_row($q)){
echo(trim($rs[0]).chr(9));
}
@mysql_close($T);`.replace(/\n\s+/g, ''),
[arg1]: '#{host}',
[arg2]: '#{user}',
[arg3]: '#{passwd}',
......@@ -21,7 +40,19 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 显示表字段
show_columns: {
_: `$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];$tab=$m?stripslashes($_POST["${arg5}"]):$_POST["${arg5}"];$T=@mysql_connect($hst,$usr,$pwd);@mysql_select_db( $dbn, $T);$q=@mysql_query("SHOW COLUMNS FROM \`{$tab}\`");while($rs=@mysql_fetch_row($q)){echo(trim($rs[0])." (".$rs[1].")".chr(9));}@mysql_close($T);`,
_: `$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$tab=$m?stripslashes($_POST["${arg5}"]):$_POST["${arg5}"];
$T=@mysql_connect($hst,$usr,$pwd);
@mysql_select_db( $dbn, $T);
$q=@mysql_query("SHOW COLUMNS FROM \`{$tab}\`");
while($rs=@mysql_fetch_row($q)){
echo(trim($rs[0])." (".$rs[1].")".chr(9));
}
@mysql_close($T);`.replace(/\n\s+/g, ''),
[arg1]: '#{host}',
[arg2]: '#{user}',
[arg3]: '#{passwd}',
......@@ -30,7 +61,33 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 执行SQL语句
query: {
_: `$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];$sql=base64_decode($_POST["${arg5}"]);$T=@mysql_connect($hst,$usr,$pwd);@mysql_query("SET NAMES $_POST[${arg6}]");@mysql_select_db($dbn, $T);$q=@mysql_query($sql);if(is_bool($q)){echo("Status\t|\t\r\n".($q?"VHJ1ZQ==":"RmFsc2U=")."\t|\t\r\n");}else{$i=0;while($col=@mysql_fetch_field($q)){echo($col->name."\t|\t");$i++;}echo("\r\n");while($rs=@mysql_fetch_row($q)){for($c=0;$c<$i;$c++){echo(base64_encode(trim($rs[$c])));echo("\t|\t");}echo("\r\n");}}@mysql_close($T);`,
_: `$m=get_magic_quotes_gpc();
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$sql=base64_decode($_POST["${arg5}"]);
$T=@mysql_connect($hst,$usr,$pwd);
@mysql_query("SET NAMES $_POST[${arg6}]");
@mysql_select_db($dbn, $T);
$q=@mysql_query($sql);
if(is_bool($q)){echo("Status\t|\t\r\n".($q?"VHJ1ZQ==":"RmFsc2U=")."\\t|\\t\\r\\n");
}else{
$i=0;
while($col=@mysql_fetch_field($q)){
echo($col->name."\\t|\\t");
$i++;
}
echo("\\r\\n");
while($rs=@mysql_fetch_row($q)){
for($c=0;$c<$i;$c++){
echo(base64_encode(trim($rs[$c])));
echo("\\t|\\t");
}
echo("\\r\\n");
}
}
@mysql_close($T);`.replace(/\n\s+/g, ''),
[arg1]: '#{host}',
[arg2]: '#{user}',
[arg3]: '#{passwd}',
......
......@@ -10,7 +10,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
list($hst, $port) = split(":", $hst);
list($hst, $port) = explode(":", $hst);
$port == "" ? $port = "3306" : $port;
$T=@mysqli_connect($hst,$usr,$pwd,"",$port);
$q=@mysqli_query($T,"SHOW DATABASES");
......@@ -29,7 +29,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
list($hst, $port) = split(":", $hst);
list($hst, $port) = explode(":", $hst);
$port == "" ? $port = "3306" : $port;
$T=@mysqli_connect($hst,$usr,$pwd,"",$port);
$q=@mysqli_query($T, "SHOW TABLES FROM \`{$dbn}\`");
......@@ -50,7 +50,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$tab=$m?stripslashes($_POST["${arg5}"]):$_POST["${arg5}"];
list($hst, $port) = split(":", $hst);
list($hst, $port) = explode(":", $hst);
$port == "" ? $port = "3306" : $port;
$T=@mysqli_connect($hst,$usr,$pwd,"",$port);
@mysqli_select_db($T, $dbn);
......@@ -73,14 +73,14 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$sql=base64_decode($_POST["${arg5}"]);
list($hst, $port) = split(":", $hst);
list($hst, $port) = explode(":", $hst);
$port == "" ? $port = "3306" : $port;
$T=@mysqli_connect($hst,$usr,$pwd,"",$port);
@mysqli_query($T,"SET NAMES $_POST[${arg6}]");
@mysqli_select_db($T,$dbn);
$q=@mysqli_query($T,$sql);
if(is_bool($q)){
echo("Status\t|\t\r\n".($q?"VHJ1ZQ==":"RmFsc2U=")."\t|\t\r\n");
echo("Status\\t|\\t\\r\\n".($q?"VHJ1ZQ==":"RmFsc2U=")."\\t|\\t\\r\\n");
}else{
$i=0;
while($col=@mysqli_fetch_field($q)){echo($col->name."\t|\t");
......
/**
* 数据库管理模板::oracle
* i 数据分隔符号 => \t|\t
* i 数据分隔符号 => \\t|\\t
*/
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
......@@ -29,7 +29,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 执行SQL语句
query: {
_: `$m=get_magic_quotes_gpc();$sid=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];$sql=base64_decode($_POST["${arg5}"]);$H=@ora_plogon("{$usr}@{$sid}","{$pwd}");if(!$H){echo("ERROR:// Login Failed!");}else{$T=@ora_open($H);@ora_commitoff($H);$q=@ora_parse($T,"{$sql}");$R=ora_exec($T);if($R){$n=ora_numcols($T);for($i=0;$i<$n;$i++){echo(Ora_ColumnName($T,$i)."\t|\t");}echo("\r\n");while(ora_fetch($T)){for($i=0;$i<$n;$i++){echo(base64_encode(trim(ora_getcolumn($T,$i))));echo("\t|\t");}echo("\r\n");}}else{echo("ErrMsg\t|\t\r\n");}@ora_close($T);};`,
_: `$m=get_magic_quotes_gpc();$sid=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];$sql=base64_decode($_POST["${arg5}"]);$H=@ora_plogon("{$usr}@{$sid}","{$pwd}");if(!$H){echo("ERROR:// Login Failed!");}else{$T=@ora_open($H);@ora_commitoff($H);$q=@ora_parse($T,"{$sql}");$R=ora_exec($T);if($R){$n=ora_numcols($T);for($i=0;$i<$n;$i++){echo(Ora_ColumnName($T,$i)."\\t|\\t");}echo("\\r\\n");while(ora_fetch($T)){for($i=0;$i<$n;$i++){echo(base64_encode(trim(ora_getcolumn($T,$i))));echo("\\t|\\t");}echo("\\r\\n");}}else{echo("ErrMsg\\t|\\t\\r\\n");}@ora_close($T);};`,
[arg1]: '#{host}',
[arg2]: '#{user}',
[arg3]: '#{passwd}',
......
/**
* 数据库管理模板::oracle oci8 驱动
* i 数据分隔符号 => \t|\t
* i 数据分隔符号 => \\t|\\t
*
* session_mode: OCI_DEFAULT 0 OCI_SYSOPER 4 OCI_SYSDBA 2
*
......@@ -25,12 +25,12 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
echo(trim(@oci_result($q,1)).chr(9));
}
}else{
echo("Status\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
$e=@oci_error($q);
if($e){
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\t|\t\r\n");
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\\t|\\t\\r\\n");
}else{
echo("RmFsc2U="."\t|\t\r\n");
echo("RmFsc2U="."\\t|\\t\\r\\n");
}
}
@oci_close($H);
......@@ -65,12 +65,12 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
}
}
}else{
echo("Status\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
$e=@oci_error($q);
if($e){
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\t|\t\r\n");
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\\t|\\t\\r\\n");
}else{
echo("RmFsc2U="."\t|\t\r\n");
echo("RmFsc2U="."\\t|\\t\\r\\n");
}
}
@oci_close($H);
......@@ -107,12 +107,12 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
}
}
}else{
echo("Status\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
$e=@oci_error($q);
if($e){
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\t|\t\r\n");
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\\t|\\t\\r\\n");
}else{
echo("RmFsc2U="."\t|\t\r\n");
echo("RmFsc2U="."\\t|\\t\\r\\n");
}
}
@oci_close($H);
......@@ -142,27 +142,27 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
if(@oci_execute($q)) {
$n=oci_num_fields($q);
if($n==0){
echo("Affect Rows\t|\t\r\n".base64_encode(@oci_num_rows($q))."\t|\t\r\n");
echo("Affect Rows\\t|\\t\\r\\n".base64_encode(@oci_num_rows($q))."\\t|\\t\\r\\n");
}else{
for($i=1;$i<=$n;$i++){
echo(oci_field_name($q,$i)."\t|\t");
echo(oci_field_name($q,$i)."\\t|\\t");
}
echo "\r\n";
echo "\\r\\n";
while ($row = @oci_fetch_array($q, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
echo($item !== null ? base64_encode($item):"")."\t|\t";
echo($item !== null ? base64_encode($item):"")."\\t|\\t";
}
echo "\r\n";
echo "\\r\\n";
}
@oci_free_statement($q);
}
}else{
echo("Status\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
$e=@oci_error($q);
if($e){
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\t|\t\r\n");
echo(base64_encode("ERROR://{$e['message']} in [{$e['sqltext']}] col:{$e['offset']}")."\\t|\\t\\r\\n");
}else{
echo("RmFsc2U="."\t|\t\r\n");
echo("RmFsc2U="."\\t|\\t\\r\\n");
}
}
@oci_close($H);
......
/**
* 数据库管理模板::postgresql
* i 数据分隔符号 => \t|\t
* i 数据分隔符号 => \\t|\\t
*/
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
......@@ -10,7 +10,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
list($host,$port,$dbn) = split(":", $hst);
list($host,$port,$dbn) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$dbn == "" ? $dbn = "postgres" : $dbn;
......@@ -55,7 +55,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
list($host, $port) = split(":", $hst);
list($host, $port) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$arr=array(
'host'=>$host,
......@@ -99,7 +99,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$tab=$m?stripslashes($_POST["${arg5}"]):$_POST["${arg5}"];
list($host, $port) = split(":", $hst);
list($host, $port) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$arr=array(
......@@ -147,7 +147,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$sql=base64_decode($_POST["${arg5}"]);
$encode=$m?stripslashes($_POST["${arg6}"]):$_POST["${arg6}"];
list($host, $port) = split(":", $hst);
list($host, $port) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$arr=array(
'host'=>$host,
......@@ -173,20 +173,20 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
}else{
$n=@pg_num_fields($q);
if($n===NULL){
echo("Status\t|\t\r\n");
echo(base64_encode("ERROR://".@pg_last_error())."\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
echo(base64_encode("ERROR://".@pg_last_error())."\\t|\\t\\r\\n");
}elseif($n===0){
echo("Affect Rows\t|\t\r\n".base64_encode(@pg_affected_rows($q))."\t|\t\r\n");
echo("Affect Rows\\t|\\t\\r\\n".base64_encode(@pg_affected_rows($q))."\\t|\\t\\r\\n");
}else{
for($i=0;$i<$n;$i++){
echo(@pg_field_name($q,$i)."\t|\t");
echo(@pg_field_name($q,$i)."\\t|\\t");
}
echo "\r\n";
echo "\\r\\n";
while($row=@pg_fetch_row($q)){
for($i=0;$i<$n;$i++){
echo(base64_encode($row[$i]!==NULL?$row[$i]:"NULL")."\t|\t");
echo(base64_encode($row[$i]!==NULL?$row[$i]:"NULL")."\\t|\\t");
}
echo "\r\n";
echo "\\r\\n";
}
}
@pg_free_result($q);
......
/**
* 数据库管理模板::postgresql_pdo
* i 数据分隔符号 => \t|\t
* i 数据分隔符号 => \\t|\\t
*/
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
......@@ -10,7 +10,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$hst=$m?stripslashes($_POST["${arg1}"]):$_POST["${arg1}"];
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
list($host, $port,$dbn) = split(":", $hst);
list($host, $port,$dbn) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$dbn == "" ? $dbn = "postgres" : $dbn;
......@@ -49,7 +49,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$usr=$m?stripslashes($_POST["${arg2}"]):$_POST["${arg2}"];
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
list($host, $port) = split(":", $hst);
list($host, $port) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$arr=array(
'host'=>$host,
......@@ -88,7 +88,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$pwd=$m?stripslashes($_POST["${arg3}"]):$_POST["${arg3}"];
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$tab=$m?stripslashes($_POST["${arg5}"]):$_POST["${arg5}"];
list($host, $port) = split(":", $hst);
list($host, $port) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$arr=array(
'host'=>$host,
......@@ -130,7 +130,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$dbn=$m?stripslashes($_POST["${arg4}"]):$_POST["${arg4}"];
$sql=base64_decode($_POST["${arg5}"]);
$encode=$m?stripslashes($_POST["${arg6}"]):$_POST["${arg6}"];
list($host, $port) = split(":", $hst);
list($host, $port) = explode(":", $hst);
$port == "" ? $port = "5432" : $port;
$arr=array(
'host'=>$host,
......@@ -150,33 +150,33 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
}else{
$result=$dbh->prepare($sql);
if(!$result->execute()){
echo("Status\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
$err="";
foreach(@$result->errorInfo() as $v){
$err.=$v." ";
}
echo(base64_encode("ERROR://".$err)."\t|\t\r\n");
echo(base64_encode("ERROR://".$err)."\\t|\\t\\r\\n");
}else{
$bool=True;
while($res=$result->fetch(PDO::FETCH_ASSOC)){
if($bool){
foreach($res as $key=>$value){
echo($key."\t|\t");
echo($key."\\t|\\t");
}
echo "\r\n";
echo "\\r\\n";
$bool=False;
}
foreach($res as $key=>$value){
echo(base64_encode($value!==NULL?$value:"NULL")."\t|\t");
echo(base64_encode($value!==NULL?$value:"NULL")."\\t|\\t");
}
echo "\r\n";
echo "\\r\\n";
}
if($bool){
if(!$result->columnCount()){
echo("Affect Rows\t|\t\r\n".base64_encode($result->rowCount())."\t|\t\r\n");
echo("Affect Rows\\t|\\t\\r\\n".base64_encode($result->rowCount())."\\t|\\t\\r\\n");
}else{
echo("Status\t|\t\r\n");
echo(base64_encode("ERROR://Table is empty.")."\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
echo(base64_encode("ERROR://Table is empty.")."\\t|\\t\\r\\n");
}
}
}
......
/**
* 数据库管理模板::sqlsrv
* php >= 5.3 原生不支持 mssql, 可采用 sqlsrv 连接 sqlserver
* i 数据分隔符号 => \t|\t
* i 数据分隔符号 => \\t|\\t
*/
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
......@@ -82,30 +82,30 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
$fm=@sqlsrv_field_metadata($q);
if(empty($fm)){
$ar=@sqlsrv_rows_affected($q);
echo("Affect Rows\t|\t\r\n".base64_encode($ar)."\t|\t\r\n");
echo("Affect Rows\\t|\\t\\r\\n".base64_encode($ar)."\\t|\\t\\r\\n");
}else{
foreach($fm as $rs){
echo($rs['Name']."\t|\t");
echo($rs['Name']."\\t|\\t");
$i++;
}
echo("\r\n");
echo("\\r\\n");
while($rs=@sqlsrv_fetch_array($q,SQLSRV_FETCH_NUMERIC)){
for($c=0;$c<$i;$c++){
echo(base64_encode(trim($rs[$c])));
echo("\t|\t");
echo("\\t|\\t");
}
echo("\r\n");
echo("\\r\\n");
}
}
@sqlsrv_free_stmt($q);
}else{
echo("Status\t|\t\r\n");
echo("Status\\t|\\t\\r\\n");
if(($e = sqlsrv_errors()) != null){
foreach($e as $v){
echo(base64_encode($e['message'])."\t|\t\r\n");
echo(base64_encode($e['message'])."\\t|\\t\\r\\n");
}
}else{
echo("RmFsc2U="."\t|\t\r\n");
echo("RmFsc2U="."\\t|\\t\\r\\n");
}
}
@sqlsrv_close($T);`.replace(/\n\s+/g, ''),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册