Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncschool
/
ncfilters
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 57e002f8
authored
May 19, 2017
by
netz.coop eG
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Database Scheme url: not unique anymore,colors of buttons
1 parent
e00bda3e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
23 deletions
fw.txt
include/classes/Connectdb.php
include/classes/Output.php
include/classes/Sytemoutput.php
include/db/nclists.sqlite
include/install/dblayout.sql
include/install/nclists.sqlite
index.php
fw.txt
View file @
57e002f
iptables -t nat -A PREROUTING --src 10.8.11.102-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335
siptables -t nat -A PREROUTING --src 10.8.11.102-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335
iptables -t nat -A PREROUTING --src 10.8.11.103-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335
siptables -t nat -A PREROUTING --src 10.8.11.103-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335
iptables -t nat -A PREROUTING --src 10.8.11.104-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335
siptables -t nat -A PREROUTING --src 10.8.11.104-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335
iptables -t nat -A PREROUTING --src 10.8.11.113-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335
siptables -t nat -A PREROUTING --src 10.8.11.113-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335
iptables -t nat -A PREROUTING --src 10.8.11.114-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335
siptables -t nat -A PREROUTING --src 10.8.11.114-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335
include/classes/Connectdb.php
View file @
57e002f
...
...
@@ -114,4 +114,19 @@ class Connectdb extends SQLite3
return
$login
;
}
public
function
getgroupids
(){
$result
=
$this
->
query
(
'SELECT * from groups;'
);
$ary_content
=
array
();
$i
=
0
;
while
(
$res
=
$result
->
fetchArray
(
SQLITE3_ASSOC
))
{
$group_id
=
$res
[
'group_id'
];
foreach
(
$res
as
$key
=>
$value
)
{
$ary_content
[
$group_id
][
$key
]
.=
$value
;
}
$i
++
;
}
return
$ary_content
;
}
}
include/classes/Output.php
View file @
57e002f
...
...
@@ -153,12 +153,31 @@ class Output {
return
$string
;
}
public
function
printdropdown
(
$array
,
$name
,
$fieldlabel
=
'name'
,
$fieldvalue
=
'group_id'
)
{
$string
.=
'<select name="'
.
$name
.
'">'
;
foreach
(
$array
as
$key
=>
$value
)
{
$string
.=
' <option value="'
.
$value
[
$fieldvalue
]
.
'" label="'
.
$value
[
$fieldlabel
]
.
'">'
.
$value
[
$fieldlabel
]
.
' ('
.
$value
[
$fieldvalue
]
.
')</option>'
;
}
$string
.=
' </select>'
;
return
$string
;
}
public
function
printtable
(
$ary_head
,
$ary_content
,
$controlls
=
false
,
$ary_controll
=
array
(),
$user
=
0
)
{
$string
=
'<table class="table table-responsive">'
;
$string
.=
'<thead class="thead-inverse">'
;
$string
.=
'<tr>'
;
$string
.=
'<th>#</th>'
;
if
(
$ary_controll
[
'table'
]
===
'pclist'
){
$db
=
new
Connectdb
();
$arraygroups
=
$db
->
getgroupids
();
// echo '<pre>';
// print_r($arraygroups);
// echo '</pre>';
}
foreach
(
$ary_head
as
$key
=>
$value
)
{
if
(
$value
===
'updated'
||
$value
===
'updatedby'
||
$value
===
'intern'
)
{
...
...
@@ -189,7 +208,14 @@ class Output {
}
elseif
(
$skey
===
'updatedby'
)
{
$string
.=
'<input type="hidden" name="updatedby" value="'
.
$user
.
'">'
;
}
else
{
if
(
$skey
===
'id'
&&
$ary_controll
[
'table'
]
!==
'groups'
)
{
if
(
$ary_controll
[
'table'
]
===
'pclist'
&&
$skey
===
'group_id'
){
// $string .= '<td>' . $arraygroups[$svalue]['name'].' ('. $svalue .') </td>';
$string
.=
'<td>'
;
$string
.=
$this
->
printdropdown
(
$arraygroups
,
'group_id'
,
$fieldlabel
=
'name'
,
$fieldvalue
=
'group_id'
);
$string
.=
'</td>'
;
}
elseif
(
$skey
===
'id'
&&
$ary_controll
[
'table'
]
!==
'groups'
)
{
$string
.=
'<td></td>'
;
}
elseif
(
$skey
===
'childlvl'
)
{
$string
.=
'<td><input type="number" name="'
.
$skey
.
'" value="1"></td>'
;
...
...
@@ -245,7 +271,7 @@ class Output {
}
else
{
$string
.=
'<input type="hidden" name="id" value="'
.
$value
[
'id'
]
.
'">'
;
}
$string
.=
''
.
$this
->
printbutton
(
'✔'
,
'
primary
btn-sm'
,
'Aktivieren'
)
.
''
;
$string
.=
''
.
$this
->
printbutton
(
'✔'
,
'
danger
btn-sm'
,
'Aktivieren'
)
.
''
;
$string
.=
'</form></td>'
;
}
else
{
$string
.=
'<td><form class="form-horizontal" method="POST" role="form" >'
;
...
...
@@ -257,14 +283,19 @@ class Output {
}
else
{
$string
.=
'<input type="hidden" name="id" value="'
.
$value
[
'id'
]
.
'">'
;
}
$string
.=
''
.
$this
->
printbutton
(
'✖'
,
'
danger
btn-sm'
,
'Deaktivieren'
)
.
''
;
$string
.=
''
.
$this
->
printbutton
(
'✖'
,
'
success
btn-sm'
,
'Deaktivieren'
)
.
''
;
$string
.=
'</form></td>'
;
}
$string
.=
'<input type="hidden" name="updatedby" value="'
.
$user
.
'">'
;
}
else
{
if
(
$ary_controll
[
'table'
]
===
'pclist'
&&
$skey
===
'group_id'
){
$string
.=
'<td>'
.
$arraygroups
[
$svalue
][
'name'
]
.
' ('
.
$svalue
.
') </td>'
;
}
else
{
$string
.=
'<td>'
.
$svalue
.
'</td>'
;
}
}
}
$string
.=
'</tr>'
;
...
...
include/classes/Sytemoutput.php
View file @
57e002f
...
...
@@ -51,11 +51,11 @@ class Sytemoutput {
if
(
$i
===
0
){
file_put_contents
(
FWFILENAME
,
'iptables -t nat -A PREROUTING --src '
.
$value
[
'ip'
]
.
'-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335 '
.
PHP_EOL
);
file_put_contents
(
FWFILENAME
,
'iptables -t nat -A PREROUTING --src '
.
$value
[
'ip'
]
.
'
-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335 '
.
PHP_EOL
);
}
else
{
file_put_contents
(
FWFILENAME
,
'iptables -t nat -A PREROUTING --src '
.
$value
[
'ip'
]
.
'-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335 '
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
FWFILENAME
,
'iptables -t nat -A PREROUTING --src '
.
$value
[
'ip'
]
.
'
-i eth1 -p udp --dport 53 -j REDIRECT --to-port 5335 '
.
PHP_EOL
,
FILE_APPEND
);
}
file_put_contents
(
FWFILENAME
,
'iptables -t nat -A PREROUTING --src '
.
$value
[
'ip'
]
.
'-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335 '
.
PHP_EOL
,
FILE_APPEND
);
file_put_contents
(
FWFILENAME
,
'iptables -t nat -A PREROUTING --src '
.
$value
[
'ip'
]
.
'
-i eth1 -p tcp --dport 53 -j REDIRECT --to-port 5335 '
.
PHP_EOL
,
FILE_APPEND
);
}
$i
++
;
}
...
...
include/db/nclists.sqlite
View file @
57e002f
No preview for this file type
include/install/dblayout.sql
View file @
57e002f
--
-- File generated with SQLiteStudio v3.0.4 on
Do. Mai 18 13:28:54
2017
-- File generated with SQLiteStudio v3.0.4 on
Fr. Mai 19 01:27:37
2017
--
-- Text encoding used: UTF-8
--
PRAGMA
foreign_keys
=
off
;
BEGIN
TRANSACTION
;
-- Table:
group
s
CREATE
TABLE
groups
(
group_id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
UNIQUE
,
name
TEXT
UNIQUE
,
chldvlv
INTEGER
DEFAULT
(
4
)
NOT
NULL
,
open
BOOLEAN
DEFAULT
(
0
),
updated
DATETIME
,
updatedby
TEXT
);
-- Table:
domain
s
CREATE
TABLE
domains
(
id
INTEGER
PRIMARY
KEY
UNIQUE
,
url
TEXT
NOT
NULL
,
ip
TEXT
NOT
NULL
UNIQUE
,
priority
INT
DEFAULT
(
0
),
intern
BOOLEAN
DEFAULT
(
0
),
enable
BOOLEAN
DEFAULT
(
1
),
childlvl
INT
DEFAULT
(
4
),
updated
DATETIME
,
updatedby
TEXT
);
-- Table: pclist
CREATE
TABLE
pclist
(
id
INTEGER
PRIMARY
KEY
UNIQUE
,
ip
TEXT
NOT
NULL
UNIQUE
,
group_id
INTEGER
NOT
NULL
,
updated
DATETIME
,
updatedby
TEXT
);
...
...
@@ -16,9 +16,12 @@ CREATE TABLE pclist (id INTEGER PRIMARY KEY UNIQUE, ip TEXT NOT NULL UNIQUE, gro
CREATE
TABLE
nclistsuser
(
id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
UNIQUE
,
name
TEXT
UNIQUE
,
password
TEXT
NOT
NULL
,
updated
DATETIME
,
updatedby
TEXT
);
INSERT
INTO
nclistsuser
(
id
,
name
,
password
,
updated
,
updatedby
)
VALUES
(
0
,
'admin'
,
'$1$DOjc9ufI$Z4mNyrOZm8AXJYmRfUAsw1'
,
'2017-05-23 15:50:00'
,
'0'
);
-- Table: domains
CREATE
TABLE
domains
(
id
INTEGER
PRIMARY
KEY
UNIQUE
,
url
TEXT
UNIQUE
NOT
NULL
,
ip
TEXT
NOT
NULL
UNIQUE
,
priority
INT
DEFAULT
(
0
),
intern
BOOLEAN
DEFAULT
(
0
),
enable
BOOLEAN
DEFAULT
(
1
),
childlvl
INT
DEFAULT
(
4
),
updated
DATETIME
,
updatedby
TEXT
);
INSERT
INTO
domains
(
id
,
url
,
ip
,
priority
,
intern
,
enable
,
childlvl
,
updated
,
updatedby
)
VALUES
(
0
,
'antolin.de'
,
'217.13.73.6'
,
0
,
0
,
1
,
1
,
NULL
,
NULL
);
-- Table: groups
CREATE
TABLE
groups
(
group_id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
UNIQUE
,
name
TEXT
UNIQUE
,
chldvlv
INTEGER
DEFAULT
(
4
)
NOT
NULL
,
open
BOOLEAN
DEFAULT
(
0
),
updated
DATETIME
,
updatedby
TEXT
);
INSERT
INTO
groups
(
group_id
,
name
,
chldvlv
,
open
,
updated
,
updatedby
)
VALUES
(
0
,
'Klasse 1a'
,
1
,
1
,
NULL
,
NULL
);
INSERT
INTO
groups
(
group_id
,
name
,
chldvlv
,
open
,
updated
,
updatedby
)
VALUES
(
2
,
'Klasse 1b'
,
1
,
1
,
NULL
,
NULL
);
INSERT
INTO
groups
(
group_id
,
name
,
chldvlv
,
open
,
updated
,
updatedby
)
VALUES
(
3
,
'Klasse 2a'
,
2
,
0
,
NULL
,
NULL
);
INSERT
INTO
groups
(
group_id
,
name
,
chldvlv
,
open
,
updated
,
updatedby
)
VALUES
(
4
,
'Klasse 4a'
,
4
,
0
,
NULL
,
NULL
);
COMMIT
TRANSACTION
;
PRAGMA
foreign_keys
=
on
;
include/install/nclists.sqlite
View file @
57e002f
No preview for this file type
index.php
View file @
57e002f
...
...
@@ -218,7 +218,7 @@ if (!isset($_SESSION['user_id'])) {
$db
->
exec
(
'INSERT INTO pclist (id,ip,group_id) VALUES ("4","10.8.11.104","1") '
);
$db
->
exec
(
'INSERT INTO pclist (id,ip,group_id) VALUES ("5","10.8.11.113","4") '
);
$db
->
exec
(
'INSERT INTO pclist (id,ip,group_id) VALUES ("6","10.8.11.114","4") '
);
echo
'INSERT INTO pclist (id,ip,group_id) VALUES ("6","10.8.11.114","4")'
;
//
echo 'INSERT INTO pclist (id,ip,group_id) VALUES ("6","10.8.11.114","4")';
}
if
(
is_array
(
$_POST
)
&&
key_exists
(
'domains'
,
$_POST
)
&&
$_POST
[
'domains'
]
===
'print'
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment