From 7bd4caddd91a3feeadf41c992b0d9fb127b42b75 Mon Sep 17 00:00:00 2001 From: Medicean Date: Wed, 31 Mar 2021 22:20:48 +0800 Subject: [PATCH] =?UTF-8?q?Fix(Core/PHP)=20=E4=BF=AE=E5=A4=8D=20PHP=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=9C=A8PHP7=E4=B8=8B=E5=87=BD=E6=95=B0=E5=BA=9F=E9=99=A4?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++ source/core/php/template/database/mssql.js | 10 +-- source/core/php/template/database/mysql.js | 65 +++++++++++++++++-- source/core/php/template/database/mysqli.js | 10 +-- source/core/php/template/database/oracle.js | 4 +- .../core/php/template/database/oracle_oci8.js | 36 +++++----- .../core/php/template/database/postgresql.js | 24 +++---- .../php/template/database/postgresql_pdo.js | 28 ++++---- source/core/php/template/database/sqlsrv.js | 18 ++--- 9 files changed, 132 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffeed5d8..a361fcf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ > 有空会补补BUG、添添新功能。 > 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT. +## 2021/03/27 `v(2.1.11.1)` + +### 核心 + +* 修复 PHP 类型数据库连接在PHP7下函数废除引起的问题 + ## 2021/03/26 `v(2.1.11)` ### 后端模块 diff --git a/source/core/php/template/database/mssql.js b/source/core/php/template/database/mssql.js index 04daa973..b699a3b6 100644 --- a/source/core/php/template/database/mssql.js +++ b/source/core/php/template/database/mssql.js @@ -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); } diff --git a/source/core/php/template/database/mysql.js b/source/core/php/template/database/mysql.js index a8b5fdb7..2622809f 100644 --- a/source/core/php/template/database/mysql.js +++ b/source/core/php/template/database/mysql.js @@ -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}', diff --git a/source/core/php/template/database/mysqli.js b/source/core/php/template/database/mysqli.js index 3637592f..c284dcf8 100644 --- a/source/core/php/template/database/mysqli.js +++ b/source/core/php/template/database/mysqli.js @@ -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"); diff --git a/source/core/php/template/database/oracle.js b/source/core/php/template/database/oracle.js index 202574cc..fc8dc29a 100644 --- a/source/core/php/template/database/oracle.js +++ b/source/core/php/template/database/oracle.js @@ -1,6 +1,6 @@ /** * 数据库管理模板::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}', diff --git a/source/core/php/template/database/oracle_oci8.js b/source/core/php/template/database/oracle_oci8.js index 1921fdec..66fbb549 100644 --- a/source/core/php/template/database/oracle_oci8.js +++ b/source/core/php/template/database/oracle_oci8.js @@ -1,6 +1,6 @@ /** * 数据库管理模板::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); diff --git a/source/core/php/template/database/postgresql.js b/source/core/php/template/database/postgresql.js index 71ad6885..350c960f 100644 --- a/source/core/php/template/database/postgresql.js +++ b/source/core/php/template/database/postgresql.js @@ -1,6 +1,6 @@ /** * 数据库管理模板::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); diff --git a/source/core/php/template/database/postgresql_pdo.js b/source/core/php/template/database/postgresql_pdo.js index 5ac175e5..7baedd98 100644 --- a/source/core/php/template/database/postgresql_pdo.js +++ b/source/core/php/template/database/postgresql_pdo.js @@ -1,6 +1,6 @@ /** * 数据库管理模板::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"); } } } diff --git a/source/core/php/template/database/sqlsrv.js b/source/core/php/template/database/sqlsrv.js index 88899708..53d248ce 100644 --- a/source/core/php/template/database/sqlsrv.js +++ b/source/core/php/template/database/sqlsrv.js @@ -1,7 +1,7 @@ /** * 数据库管理模板::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, ''),