Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
phpdts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nemo Ma
phpdts
Commits
62a76ef8
Commit
62a76ef8
authored
Oct 03, 2020
by
nahakyuu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix version compare
``` '10.5.5-MariaDB-1:10.5.5+maria~focal' < '5.3.0' == true' ``` and more
parent
fa038d00
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
14 deletions
+14
-14
clear.php
clear.php
+1
-1
dbup.php
dbup.php
+1
-1
include/common.inc.php
include/common.inc.php
+1
-1
include/db_mysql.class.php
include/db_mysql.class.php
+2
-2
include/global.func.php
include/global.func.php
+1
-1
install.php
install.php
+7
-7
login_old.php
login_old.php
+1
-1
No files found.
clear.php
View file @
62a76ef8
...
@@ -6,7 +6,7 @@ define('IN_GAME', TRUE);
...
@@ -6,7 +6,7 @@ define('IN_GAME', TRUE);
define
(
'GAME_ROOT'
,
dirname
(
__FILE__
));
define
(
'GAME_ROOT'
,
dirname
(
__FILE__
));
define
(
'GAMENAME'
,
'bra'
);
define
(
'GAMENAME'
,
'bra'
);
if
(
PHP_VERSION
<
'4.3.0'
)
{
if
(
version_compare
(
PHP_VERSION
,
'4.3.0'
,
'<'
)
)
{
exit
(
'PHP version must >= 4.3.0!'
);
exit
(
'PHP version must >= 4.3.0!'
);
}
}
require
GAME_ROOT
.
'/include/global.func.php'
;
require
GAME_ROOT
.
'/include/global.func.php'
;
...
...
dbup.php
View file @
62a76ef8
...
@@ -6,7 +6,7 @@ define('IN_GAME', TRUE);
...
@@ -6,7 +6,7 @@ define('IN_GAME', TRUE);
define
(
'GAME_ROOT'
,
dirname
(
__FILE__
));
define
(
'GAME_ROOT'
,
dirname
(
__FILE__
));
define
(
'GAMENAME'
,
'bra'
);
define
(
'GAMENAME'
,
'bra'
);
if
(
PHP_VERSION
<
'4.3.0'
)
{
if
(
version_compare
(
PHP_VERSION
,
'4.3.0'
,
'<'
)
)
{
exit
(
'PHP version must >= 4.3.0!'
);
exit
(
'PHP version must >= 4.3.0!'
);
}
}
require
GAME_ROOT
.
'./include/global.func.php'
;
require
GAME_ROOT
.
'./include/global.func.php'
;
...
...
include/common.inc.php
View file @
62a76ef8
...
@@ -6,7 +6,7 @@ define('IN_GAME', TRUE);
...
@@ -6,7 +6,7 @@ define('IN_GAME', TRUE);
define
(
'GAME_ROOT'
,
substr
(
dirname
(
__FILE__
),
0
,
-
7
));
define
(
'GAME_ROOT'
,
substr
(
dirname
(
__FILE__
),
0
,
-
7
));
define
(
'GAMENAME'
,
'bra'
);
define
(
'GAMENAME'
,
'bra'
);
if
(
PHP_VERSION
<
'4.3.0'
)
{
if
(
version_compare
(
PHP_VERSION
,
'4.3.0'
,
'<'
)
)
{
exit
(
'PHP version must >= 4.3.0!'
);
exit
(
'PHP version must >= 4.3.0!'
);
}
}
require
GAME_ROOT
.
'./include/global.func.php'
;
require
GAME_ROOT
.
'./include/global.func.php'
;
...
...
include/db_mysql.class.php
View file @
62a76ef8
...
@@ -22,7 +22,7 @@ class dbstuff {
...
@@ -22,7 +22,7 @@ class dbstuff {
}
}
}
}
if
(
$this
->
version
()
>
'4.1'
)
{
if
(
version_compare
(
$this
->
version
(),
'4.1'
,
'>'
)
)
{
global
$charset
,
$dbcharset
;
global
$charset
,
$dbcharset
;
if
(
!
$dbcharset
&&
in_array
(
strtolower
(
$charset
),
array
(
'gbk'
,
'big5'
,
'utf-8'
)
))
{
if
(
!
$dbcharset
&&
in_array
(
strtolower
(
$charset
),
array
(
'gbk'
,
'big5'
,
'utf-8'
)
))
{
$dbcharset
=
str_replace
(
'-'
,
''
,
$charset
);
$dbcharset
=
str_replace
(
'-'
,
''
,
$charset
);
...
@@ -32,7 +32,7 @@ class dbstuff {
...
@@ -32,7 +32,7 @@ class dbstuff {
mysql_query
(
"SET character_set_connection=
$dbcharset
, character_set_results=
$dbcharset
, character_set_client=
$dbcharset
"
);
mysql_query
(
"SET character_set_connection=
$dbcharset
, character_set_results=
$dbcharset
, character_set_client=
$dbcharset
"
);
}
}
if
(
$this
->
version
()
>
'5.0.1'
)
{
if
(
version_compare
(
$this
->
version
(),
'5.0.1'
,
'>'
)
)
{
mysql_query
(
"SET sql_mode=''"
);
mysql_query
(
"SET sql_mode=''"
);
}
}
}
}
...
...
include/global.func.php
View file @
62a76ef8
...
@@ -183,7 +183,7 @@ function openfile($filename){
...
@@ -183,7 +183,7 @@ function openfile($filename){
}
}
function
compatible_json_encode
(
$data
){
//自动选择使用内置函数或者自定义函数,结合JSON.php可做到兼容低版本PHP
function
compatible_json_encode
(
$data
){
//自动选择使用内置函数或者自定义函数,结合JSON.php可做到兼容低版本PHP
if
(
PHP_VERSION
<
'5.2.0'
)
{
if
(
version_compare
(
PHP_VERSION
,
'5.2.0'
,
'<'
))
{
require_once
GAME_ROOT
.
'./include/JSON.php'
;
require_once
GAME_ROOT
.
'./include/JSON.php'
;
$json
=
new
Services_JSON
();
$json
=
new
Services_JSON
();
$jdata
=
$json
->
encode
(
$data
);
$jdata
=
$json
->
encode
(
$data
);
...
...
install.php
View file @
62a76ef8
...
@@ -7,7 +7,7 @@ error_reporting(E_ERROR | E_WARNING | E_PARSE);
...
@@ -7,7 +7,7 @@ error_reporting(E_ERROR | E_WARNING | E_PARSE);
define
(
'IN_GAME'
,
TRUE
);
define
(
'IN_GAME'
,
TRUE
);
define
(
'GAME_ROOT'
,
''
);
define
(
'GAME_ROOT'
,
''
);
if
(
PHP_VERSION
<
'4.3.0'
)
{
if
(
version_compare
(
PHP_VERSION
,
'4.3.0'
,
'<'
)
)
{
exit
(
'PHP version must >= 4.3.0!'
);
exit
(
'PHP version must >= 4.3.0!'
);
}
}
...
@@ -657,7 +657,7 @@ if(!$action) {
...
@@ -657,7 +657,7 @@ if(!$action) {
$curr_os
=
PHP_OS
;
$curr_os
=
PHP_OS
;
$curr_php_version
=
PHP_VERSION
;
$curr_php_version
=
PHP_VERSION
;
if
(
$curr_php_version
<
'4.3.0'
)
{
if
(
version_compare
(
$curr_php_version
,
'4.3.0'
,
'<'
)
)
{
$msg
.=
"<font color=
\"
#FF0000
\"
>
$lang[php_version_430]
</font>
\t
"
;
$msg
.=
"<font color=
\"
#FF0000
\"
>
$lang[php_version_430]
</font>
\t
"
;
$quit
=
TRUE
;
$quit
=
TRUE
;
}
}
...
@@ -673,7 +673,7 @@ if(!$action) {
...
@@ -673,7 +673,7 @@ if(!$action) {
$query
=
$db
->
query
(
"SELECT VERSION()"
);
$query
=
$db
->
query
(
"SELECT VERSION()"
);
$curr_mysql_version
=
$db
->
result
(
$query
,
0
);
$curr_mysql_version
=
$db
->
result
(
$query
,
0
);
if
(
$curr_mysql_version
<
'3.23'
)
{
if
(
version_compare
(
$curr_mysql_version
,
'3.23'
,
'<'
)
)
{
$msg
.=
"<font color=
\"
#FF0000
\"
>
$lang[mysql_version_323]
</font>
\t
"
;
$msg
.=
"<font color=
\"
#FF0000
\"
>
$lang[mysql_version_323]
</font>
\t
"
;
$quit
=
TRUE
;
$quit
=
TRUE
;
}
}
...
@@ -701,7 +701,7 @@ if(!$action) {
...
@@ -701,7 +701,7 @@ if(!$action) {
$db
->
select_db
(
$dbname
);
$db
->
select_db
(
$dbname
);
if
(
$db
->
error
())
{
if
(
$db
->
error
())
{
if
(
$db
->
version
()
>
'4.1'
)
{
if
(
version_compare
(
$db
->
version
(),
'3.23'
,
'<'
)
)
{
$db
->
query
(
"CREATE DATABASE IF NOT EXISTS
$dbname
DEFAULT CHARACTER SET
$dbcharset
"
);
$db
->
query
(
"CREATE DATABASE IF NOT EXISTS
$dbname
DEFAULT CHARACTER SET
$dbcharset
"
);
}
else
{
}
else
{
$db
->
query
(
"CREATE DATABASE IF NOT EXISTS
$dbname
"
);
$db
->
query
(
"CREATE DATABASE IF NOT EXISTS
$dbname
"
);
...
@@ -1231,7 +1231,7 @@ function runquery($sql) {
...
@@ -1231,7 +1231,7 @@ function runquery($sql) {
if
(
substr
(
$query
,
0
,
12
)
==
'CREATE TABLE'
)
{
if
(
substr
(
$query
,
0
,
12
)
==
'CREATE TABLE'
)
{
$name
=
preg_replace
(
"/CREATE TABLE ([a-z0-9_]+) .*/is"
,
"
\\
1"
,
$query
);
$name
=
preg_replace
(
"/CREATE TABLE ([a-z0-9_]+) .*/is"
,
"
\\
1"
,
$query
);
echo
$lang
[
'create_table'
]
.
' '
.
$name
.
' ... <font color="#0000EE">'
.
$lang
[
'succeed'
]
.
'</font><br>'
;
echo
$lang
[
'create_table'
]
.
' '
.
$name
.
' ... <font color="#0000EE">'
.
$lang
[
'succeed'
]
.
'</font><br>'
;
$db
->
query
(
createtable
(
$query
,
$dbcharset
));
$db
->
query
(
createtable
(
$
db
,
$
query
,
$dbcharset
));
}
else
{
}
else
{
$db
->
query
(
$query
);
$db
->
query
(
$query
);
}
}
...
@@ -1299,11 +1299,11 @@ function random($length) {
...
@@ -1299,11 +1299,11 @@ function random($length) {
return
$hash
;
return
$hash
;
}
}
function
createtable
(
$sql
,
$dbcharset
)
{
function
createtable
(
$
db
,
$
sql
,
$dbcharset
)
{
$type
=
strtoupper
(
preg_replace
(
"/^\s*CREATE TABLE\s+.+\s+\(.+?\).*(ENGINE|TYPE)\s*=\s*([a-z]+?).*$/isU"
,
"
\\
2"
,
$sql
));
$type
=
strtoupper
(
preg_replace
(
"/^\s*CREATE TABLE\s+.+\s+\(.+?\).*(ENGINE|TYPE)\s*=\s*([a-z]+?).*$/isU"
,
"
\\
2"
,
$sql
));
$type
=
in_array
(
$type
,
array
(
'MYISAM'
,
'HEAP'
))
?
$type
:
'MYISAM'
;
$type
=
in_array
(
$type
,
array
(
'MYISAM'
,
'HEAP'
))
?
$type
:
'MYISAM'
;
return
preg_replace
(
"/^\s*(CREATE TABLE\s+.+\s+\(.+?\)).*$/isU"
,
"
\\
1"
,
$sql
)
.
return
preg_replace
(
"/^\s*(CREATE TABLE\s+.+\s+\(.+?\)).*$/isU"
,
"
\\
1"
,
$sql
)
.
(
mysql_get_server_info
()
>
'4.1'
?
" ENGINE=
$type
DEFAULT CHARSET=
$dbcharset
"
:
" TYPE=
$type
"
);
(
version_compare
(
$db
->
version
(),
'4.1'
,
'>'
)
?
" ENGINE=
$type
DEFAULT CHARSET=
$dbcharset
"
:
" TYPE=
$type
"
);
}
}
function
setconfig
(
$string
)
{
function
setconfig
(
$string
)
{
...
...
login_old.php
View file @
62a76ef8
...
@@ -7,7 +7,7 @@ $now = time();
...
@@ -7,7 +7,7 @@ $now = time();
define
(
'IN_GAME'
,
TRUE
);
define
(
'IN_GAME'
,
TRUE
);
define
(
'GAME_ROOT'
,
substr
(
dirname
(
__FILE__
),
0
,
0
));
define
(
'GAME_ROOT'
,
substr
(
dirname
(
__FILE__
),
0
,
0
));
define
(
'GAMENAME'
,
'bra'
);
define
(
'GAMENAME'
,
'bra'
);
if
(
PHP_VERSION
<
'4.3.0'
)
{
if
(
version_compare
(
PHP_VERSION
,
'4.3.0'
,
'<'
)
)
{
exit
(
'PHP version must >= 4.3.0!'
);
exit
(
'PHP version must >= 4.3.0!'
);
}
}
require_once
GAME_ROOT
.
'./include/global.func.php'
;
require_once
GAME_ROOT
.
'./include/global.func.php'
;
...
...
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