-
Notifications
You must be signed in to change notification settings - Fork 743
/
install.php
182 lines (155 loc) · 6.45 KB
/
install.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
/**
* Created by runner.han
* There is nothing new under the sun
*/
include_once 'header.php';
include_once 'inc/config.inc.php';
$dbhost=DBHOST;
$dbuser=DBUSER;
$dbpw=DBPW;
$dbname=DBNAME;
$mes_connect='';
$mes_create='';
$mes_data='';
$mes_ok='';
if(isset($_POST['submit'])){
//判断数据库连接
if(!@mysqli_connect($dbhost, $dbuser, $dbpw)){
exit('数据连接失败,请仔细检查inc/config.inc.php的配置');
}
$link=mysqli_connect(DBHOST, DBUSER, DBPW);
$mes_connect.="<p class='notice'>数据库连接成功!</p>";
//如果存在,则直接干掉
$drop_db="drop database if exists $dbname";
if(!@mysqli_query($link, $drop_db)){
exit('初始化数据库失败,请仔细检查当前用户是否有操作权限');
}
//创建数据库
$create_db="CREATE DATABASE $dbname";
if(!@mysqli_query($link,$create_db)){
exit('数据库创建失败,请仔细检查当前用户是否有操作权限');
}
$mes_create="<p class='notice'>新建数据库:".$dbname."成功!</p>";
//创建数据.选择数据库
if(!@mysqli_select_db($link, $dbname)){
exit('数据库选择失败,请仔细检查当前用户是否有操作权限');
}
//创建users表
$creat_users=
"CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(30) NOT NULL,
`password` varchar(66) NOT NULL,
`level` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4";
if(!@mysqli_query($link,$creat_users)){
exit('创建users表失败,请仔细检查当前用户是否有操作权限');
}
//往users表里面插入默认的数据
$insert_users = "insert into `users` (`id`,`username`,`password`,`level`) values (1,'admin',md5('123456'),1),(2,'pikachu',md5('000000'),2),(3,'test',md5('abc123'),3)";
if(!@mysqli_query($link,$insert_users)){
echo $link->error;
exit('创建users表数据失败,请仔细检查当前用户是否有操作权限');
}
//创建留言板的表message
$create_message=
"CREATE TABLE IF NOT EXISTS `message` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`content` varchar(255) NOT NULL,
`time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='stored_xss_1' AUTO_INCREMENT=56";
if(!@mysqli_query($link,$create_message)){
exit('创建message表失败,请仔细检查当前用户是否有操作权限');
}
//创建xssblind的看法收集表
$create_xssblind=
"CREATE TABLE IF NOT EXISTS `xssblind` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`content` text NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7";
if(!@mysqli_query($link,$create_xssblind)){
exit('创建xssblind表失败,请仔细检查当前用户是否有操作权限');
}
//创建会员信息的表member
$create_member=
"CREATE TABLE IF NOT EXISTS `member` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(66) NOT NULL,
`pw` varchar(128) NOT NULL,
`sex` char(10) NOT NULL,
`phonenum` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=25";
if(!@mysqli_query($link,$create_member)){
exit('创建member表失败,请仔细检查当前用户是否有操作权限');
}
$insert_member=
"INSERT INTO `member` (`id`, `username`, `pw`, `sex`, `phonenum`, `address`, `email`) VALUES
(1, 'vince', md5('123456'), 'boy', '18626545453', 'chain', '[email protected]'),
(2, 'allen', md5('123456'), 'boy', '13676767767', 'nba 76', '[email protected]'),
(3, 'kobe', md5('123456'), 'boy', '15988767673', 'nba lakes', '[email protected]'),
(4, 'grady', md5('123456'), 'boy', '13676765545', 'nba hs', '[email protected]'),
(5, 'kevin', md5('123456'), 'boy', '13677676754', 'Oklahoma City Thunder', '[email protected]'),
(6, 'lucy', md5('123456'), 'girl', '12345678922', 'usa', '[email protected]'),
(7, 'lili', md5('123456'), 'girl', '18656565545', 'usa', '[email protected]')";
if(!@mysqli_query($link,$insert_member)){
exit('创建member数据失败,请仔细检查当前用户是否有操作权限');
}
//创建数据.创建表sqli里面http头注入的信息,httpinfo和数据
$creat_httpinfo=
"CREATE TABLE IF NOT EXISTS `httpinfo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`userid` int(10) unsigned NOT NULL,
`ipaddress` varchar(255) NOT NULL,
`useragent` varchar(255) NOT NULL,
`httpaccept` varchar(255) NOT NULL,
`remoteport` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=42";
if(!@mysqli_query($link,$creat_httpinfo)){
exit('创建httpinfo表失败,请仔细检查当前用户是否有操作权限');
}
$mes_data="<p class='notice'>创建数据库数据成功!</p>";
$mes_ok="<p class='notice'>好了,可以开搞了~<a href='index.php'>点击这里</a>进入首页</p>";
}
?>
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<!-- <li>-->
<!-- <i class="ace-icon fa fa-home home-icon"></i>-->
<!-- <a href="#">Home</a>-->
<!-- </li>-->
<li class="active">系统初始化安装</li>
</ul><!-- /.breadcrumb -->
</div>
<div class="page-content">
<div id=install_main>
<p class="main_title">Setup guide:</p>
<p class="main_title">第0步:请提前安装“mysql+php+中间件”的环境;</p>
<p class="main_title">第1步:请根据实际环境修改inc/config.inc.php文件里面的参数;</p>
<p class="main_title">第2步:点击“安装/初始化”按钮;</p>
<form method="post">
<input type="submit" name="submit" value="安装/初始化"/>
</form>
</div>
<div class="info" style="color: #D6487E;padding-top: 40px;">
<?php
echo $mes_connect;
echo $mes_create;
echo $mes_data;
echo $mes_ok;
?>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->