Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
99d70d49
Commit
99d70d49
authored
Mar 08, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:Database) php sqlsrv 连接编码调整
parent
640caf91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
sqlsrv.js
source/core/php/template/database/sqlsrv.js
+4
-3
index.js
source/modules/database/php/index.js
+18
-4
No files found.
source/core/php/template/database/sqlsrv.js
View file @
99d70d49
...
...
@@ -77,7 +77,8 @@ 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
}
"]);
$chs='utf-8';
$chs=strtolower($m?stripslashes($_POST["
${
arg6
}
"]):$_POST["
${
arg6
}
"]);
$chs=($chs=='utf-8'||$chs=='char')?$chs:'utf-8';
$T=@sqlsrv_connect($hst,array("UID"=> $usr,"PWD"=>$pwd,"Database"=>$dbn,"CharacterSet"=>$chs));
$q=@sqlsrv_query($T,$sql,null);
if($q!==false){
...
...
@@ -108,7 +109,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
echo(base64_encode($e['message'])."\t|\t\r\n");
}
}else{
echo("RmFsc2U=");
echo("RmFsc2U="
."\t|\t\r\n"
);
}
}
@sqlsrv_close($T);`
.
replace
(
/
\n\s
+/g
,
''
),
...
...
@@ -117,6 +118,6 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[
arg3
]:
'#{passwd}'
,
[
arg4
]:
'#{db}'
,
[
arg5
]:
'#{base64::sql}'
,
//
[arg6]: '#{encode}'
[
arg6
]:
'#{encode}'
}
})
source/modules/database/php/index.js
View file @
99d70d49
...
...
@@ -378,9 +378,9 @@ class PHP {
{
type
:
'label'
,
label
:
LANG
[
'form'
][
'encode'
]
},
{
type
:
'combo'
,
label
:
''
,
name
:
'encode'
,
options
:
(()
=>
{
let
ret
=
[];
[
'utf
8'
,
'big5'
,
'dec8'
,
'cp850'
,
'hp8'
,
'koi8r'
,
'latin1'
,
'latin2'
,
'ascii'
,
'euckr'
,
'gb2312'
,
'gbk
'
].
map
((
_
)
=>
{
[
'utf
-8'
,
'char
'
].
map
((
_
)
=>
{
ret
.
push
({
text
:
_
,
text
:
_
.
toUpperCase
()
,
value
:
_
,
});
})
...
...
@@ -607,9 +607,9 @@ class PHP {
{
type
:
'label'
,
label
:
LANG
[
'form'
][
'encode'
]
},
{
type
:
'combo'
,
label
:
''
,
name
:
'encode'
,
options
:
(()
=>
{
let
ret
=
[];
[
'utf
8'
,
'big5'
,
'dec8'
,
'cp850'
,
'hp8'
,
'koi8r'
,
'latin1'
,
'latin2'
,
'ascii'
,
'euckr'
,
'gb2312'
,
'gbk
'
].
map
((
_
)
=>
{
[
'utf
-8'
,
'char
'
].
map
((
_
)
=>
{
ret
.
push
({
text
:
_
,
text
:
_
.
toUpperCase
()
,
value
:
_
,
selected
:
conf
[
'encode'
]
===
_
});
...
...
@@ -1650,6 +1650,13 @@ class PHP {
let
encoding
=
Decodes
.
detectEncoding
(
buff
,
{
defaultEncoding
:
"unknown"
});
if
(
encoding
==
"unknown"
)
{
switch
(
this
.
dbconf
[
'type'
]){
case
'sqlsrv'
:
var
sqlsrv_conncs_mapping
=
{
'UTF-8'
:
'utf8'
,
'CHAR'
:
''
,
}
encoding
=
sqlsrv_conncs_mapping
[
this
.
dbconf
[
'encode'
]]
||
''
;
break
;
case
'oracle_oci8'
:
var
oci8_characterset_mapping
=
{
'UTF8'
:
'utf8'
,
...
...
@@ -1705,6 +1712,13 @@ class PHP {
let
encoding
=
Decodes
.
detectEncoding
(
buff
,
{
defaultEncoding
:
"unknown"
});
if
(
encoding
==
"unknown"
)
{
switch
(
this
.
dbconf
[
'type'
]){
case
'sqlsrv'
:
var
sqlsrv_conncs_mapping
=
{
'utf-8'
:
'utf8'
,
'char'
:
''
,
}
encoding
=
sqlsrv_conncs_mapping
[
this
.
dbconf
[
'encode'
]]
||
''
;
break
;
case
'oracle_oci8'
:
var
oci8_characterset_mapping
=
{
'UTF8'
:
'utf8'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment