-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathdatabase_lists.php
119 lines (99 loc) · 5.17 KB
/
database_lists.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
define('ACCESS', true);
define('PHPMYADMIN', true);
include_once 'function.php';
if (IS_LOGIN) {
$title = 'Danh sách database';
include_once 'database_connect.php';
if (IS_CONNECT && IS_DATABASE_ROOT) {
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
$title = 'Xóa database';
$name = isset($_GET['name']) && empty($_GET['name']) == false ? addslashes($_GET['name']) : null;
if ($name != null && isDatabaseExists($name, null, true)) {
$title .= ': ' . $name;
include_once 'header.php';
echo '<div class="title"><div class="ellipsis">' . $title . '</div></div>';
if (isset($_POST['accept'])) {
if (!@mysql_query("DROP DATABASE `$name`", LINK_IDENTIFIER))
echo '<div class="notice_failure">Xóa database thất bại: ' . mysql_error() . '</div>';
else
goURL('database_lists.php');
} else if (isset($_POST['not'])) {
goURL('database_lists.php');
}
echo '<div class="list">
<form action="database_lists.php?action=delete&name=' . stripslashes($name) . '" method="post">
<span>Bạn có thực sự muốn xóa database không, mọi thứ trong database sẽ bị xóa hết?</span><hr/>
<center>
<input type="submit" name="accept" value="Xóa"/>
<input type="submit" name="not" value="Huỷ"/>
</center>
</form>
</div>';
} else {
include_once 'header.php';
echo '<div class="title">' . $title . '</div>
<div class="list">Tên database không tồn tại</div>';
}
echo '<ul class="list">
<li><img src="icon/database.png"/> <a href="database_lists.php">Dang sách database</a></li>
</ul>';
} else {
include_once 'header.php';
$query = @mysql_query('SHOW DATABASES', LINK_IDENTIFIER);
if (is_resource($query)) {
echo '<div class="title">' . $title . '</div>
<ul class="list_database">';
while ($assoc = @mysql_fetch_assoc($query)) {
$name = $assoc['Database'];
$count = @mysql_result(@mysql_query('SELECT COUNT(*) FROM `information_schema`.`tables` WHERE `table_schema`="' . $name . '"', LINK_IDENTIFIER), 0);
echo '<li>
<p>
<a href="database_lists.php?action=delete&name=' . $name . '">
<img src="icon/database.png"/>
</a>
<a href="database_tables.php?db_name=' . $name . '">
<strong>' . $name . '</strong>
</a>
</p>
<p>
<span class="count_tables">' . $count . '</span>
<span>bảng</span>
</p>
</li>';
}
echo '</ul>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/database_create.png"/> <a href="database_create.php">Tạo database</a></li>
</ul>';
} else {
echo '<div class="title">' . $title . '</div>
<div class="list">Không thể lấy danh sách database</div>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/disconnect.png"/> <a href="database_disconnect.php">Ngắt kết nối database</a></li>
</ul>';
}
}
} else if (IS_CONNECT && !IS_DATABASE_ROOT) {
echo '<div class="title">' . $title . '</div>
<div class="list">Bạn đang kết nối tới một database không thể vào danh sách database</div>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/disconnect.png"/> <a href="database_disconnect.php">Ngắt kết nối database</a></li>
</ul>';
} else {
echo '<div class="title">' . $title . '</div>
<div class="list">Lỗi cấu hình hoặc không kết nối được</div>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/disconnect.png"/> <a href="database_disconnect.php">Ngắt kết nối database</a></li>
</ul>';
}
include_once 'footer.php';
} else {
goURL('login.php');
}
include_once 'database_close.php';
?>