Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISPConfig
ISPConfig 3
Commits
ec9c5478
Commit
ec9c5478
authored
Oct 29, 2015
by
Florian Schaal
Browse files
allow ipv6 for remote-database-access
parent
831dd0a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
interface/lib/classes/validate_database.inc.php
View file @
ec9c5478
...
...
@@ -42,19 +42,19 @@ class validate_database {
$values
=
explode
(
","
,
$field_value
);
foreach
(
$values
as
$cur_value
)
{
$cur_value
=
trim
(
$cur_value
);
$valid
=
true
;
// if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) {
if
(
preg_match
(
"/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
\\
.)
{
3
}
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/"
,
$cur_value
))
{
$groups
=
explode
(
"."
,
$cur_value
);
foreach
(
$groups
as
$group
){
if
(
$group
<
0
or
$group
>
255
)
$valid
=
false
;
if
(
function_exists
(
'filter_var'
))
{
if
(
!
filter_var
(
$field_value
,
FILTER_VALIDATE_IP
))
{
$valid
=
false
;
}
}
else
{
$valid
=
false
;
if
(
!
preg_match
(
"/^[0-9a-f]
{
1,4}:([0-9a-f]{0,4}:){1,6}[0-9a-f]{1,4
}
$/"
,
$cur_value
)
&&
!
preg_match
(
"/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
\\
.)
{
3
}
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/"
,
$cur_value
))
{
$valid
=
false
;
}
}
if
(
$valid
==
false
)
{
$errmsg
=
$validator
[
'errmsg'
];
if
(
isset
(
$app
->
tform
->
wordbook
[
$errmsg
]))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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