Skip to content

Commit 2ed6ca4

Browse files
committed
database pages
1 parent 9dd6022 commit 2ed6ca4

File tree

18 files changed

+276
-34
lines changed

18 files changed

+276
-34
lines changed

web/add/db/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Init
3-
//error_reporting(NULL);
3+
error_reporting(NULL);
44
ob_start();
55
session_start();
66
$TAB = 'DB';

web/add/user/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Init
3-
//error_reporting(NULL);
3+
error_reporting(NULL);
44
ob_start();
55
session_start();
66
$TAB = 'USER';

web/delete/db/index.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
7+
8+
if ($_SESSION['user'] == 'admin') {
9+
if (!empty($_GET['database'])) {
10+
$v_username = escapeshellarg($user);
11+
$v_database = escapeshellarg($_GET['database']);
12+
exec (VESTA_CMD."v_delete_database ".$v_username." ".$v_database, $output, $return_var);
13+
unset($output);
14+
}
15+
}
16+
17+
header("Location: /list/db/");

web/edit/db/index.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
7+
$TAB = 'DB';
8+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
9+
10+
// Header
11+
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
12+
13+
// Panel
14+
top_panel($user,$TAB);
15+
16+
// Are you admin?
17+
if ($_SESSION['user'] == 'admin') {
18+
19+
// Check user argument?
20+
if (empty($_GET['database'])) {
21+
header("Location: /list/db/");
22+
exit;
23+
}
24+
25+
$v_database = escapeshellarg($_GET['database']);
26+
exec (VESTA_CMD."v_list_database ".$user." ".$v_database." 'json'", $output, $return_var);
27+
if ($return_var != 0) {
28+
$error = implode('<br>', $output);
29+
if (empty($error)) $error = 'Error: vesta did not return any output.';
30+
$_SESSION['error_msg'] = $error;
31+
} else {
32+
$data = json_decode(implode('', $output), true);
33+
unset($output);
34+
$v_username = $user;
35+
$v_database = $_GET['database'];
36+
$v_dbuser = $data[$v_database]['DBUSER'];
37+
$v_password = "••••••••";
38+
$v_host = $data[$v_database]['HOST'];
39+
$v_type = $data[$v_database]['TYPE'];
40+
$v_charset = $data[$v_database]['CHARSET'];
41+
$v_date = $data[$v_database]['DATE'];
42+
$v_time = $data[$v_database]['TIME'];
43+
$v_suspended = $data[$v_database]['SUSPENDED'];
44+
if ( $v_suspended == 'yes' ) {
45+
$v_status = 'suspended';
46+
} else {
47+
$v_status = 'active';
48+
}
49+
50+
// Action
51+
if (!empty($_POST['save'])) {
52+
$v_username = $user;
53+
// Change password
54+
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
55+
$v_password = escapeshellarg($_POST['v_password']);
56+
exec (VESTA_CMD."v_change_database_password ".$v_username." ".$v_database." ".$v_password, $output, $return_var);
57+
if ($return_var != 0) {
58+
$error = implode('<br>', $output);
59+
if (empty($error)) $error = 'Error: vesta did not return any output.';
60+
$_SESSION['error_msg'] = $error;
61+
}
62+
$v_password = "••••••••";
63+
unset($output);
64+
}
65+
if (empty($_SESSION['error_msg'])) {
66+
$_SESSION['ok_msg'] = "OK: changes has been saved.";
67+
}
68+
}
69+
}
70+
71+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_db.html');
72+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html');
73+
unset($_SESSION['error_msg']);
74+
unset($_SESSION['ok_msg']);
75+
}
76+
77+
// Footer
78+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

web/edit/dns/index.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Init
3-
//error_reporting(NULL);
3+
error_reporting(NULL);
44
ob_start();
55
session_start();
66

@@ -19,10 +19,7 @@
1919
// Check user argument?
2020
if (empty($_GET['domain'])) {
2121
header("Location: /list/dns/");
22-
}
23-
24-
if (!empty($_POST['cancel'])) {
25-
header("Location: /list/dns/");
22+
exit;
2623
}
2724

2825
// Check domain

web/edit/mail/index.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Init
3-
//error_reporting(NULL);
3+
error_reporting(NULL);
44
ob_start();
55
session_start();
66

@@ -19,10 +19,7 @@
1919
// Check user argument?
2020
if (empty($_GET['domain'])) {
2121
header("Location: /list/mail/");
22-
}
23-
24-
if (!empty($_POST['cancel'])) {
25-
header("Location: /list/mail/");
22+
exit;
2623
}
2724

2825
// Check domain

web/edit/user/index.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
// Check user argument?
2020
if (empty($_GET['user'])) {
2121
header("Location: /list/user/");
22-
}
23-
24-
if (!empty($_POST['cancel'])) {
25-
header("Location: /list/user/");
22+
exit;
2623
}
2724

2825
// Check user

web/edit/web/index.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Init
3-
//error_reporting(NULL);
3+
error_reporting(NULL);
44
ob_start();
55
session_start();
66

@@ -19,10 +19,7 @@
1919
// Check user argument?
2020
if (empty($_GET['domain'])) {
2121
header("Location: /list/web/");
22-
}
23-
24-
if (!empty($_POST['cancel'])) {
25-
header("Location: /list/web/");
22+
exit;
2623
}
2724

2825
// Check domain

web/list/ip/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// Init
3-
//error_reporting(NULL);
3+
error_reporting(NULL);
44
session_start();
55
$TAB = 'IP';
66

web/suspend/db/index.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
ob_start();
5+
session_start();
6+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
7+
8+
if ($_SESSION['user'] == 'admin') {
9+
if (!empty($_GET['database'])) {
10+
$v_username = escapeshellarg($user);
11+
$v_database = escapeshellarg($_GET['database']);
12+
exec (VESTA_CMD."v_suspend_database ".$v_username." ".$v_database, $output, $return_var);
13+
unset($output);
14+
}
15+
}
16+
17+
header("Location: /list/db/");

0 commit comments

Comments
 (0)