-
Notifications
You must be signed in to change notification settings - Fork 5
/
drops.php
170 lines (165 loc) · 7.13 KB
/
drops.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
<?php
require('conn.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
乌云知识库
</title>
<meta content="webkit" name="renderer">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
<link href="/layui/css/layui.css" media="all" rel="stylesheet">
</head>
<body class="layui-main">
<div class="layui-container">
<div class="layui-col-xs6 layui-col-md12">
<div class="layui-field-title">
<h1><a href="http://<?php echo $_SERVER['SERVER_ADDR'] ;?>">乌云知识库</a></h1>
<h2><a href="#">WooYun Drops</a></h2>
</div>
</div>
<hr class="layui-bg-blue">
<div class="layui-col-xs6 layui-col-md12 layui-text-center layui-mt-5 layui-mb-5">
<h1 class="layui-text-h1">乌云知识库</h1>
</div>
<div class="layui-col-xs6 layui-col-md12 layui-mt-5">
<form class="layui-form" action="" method="get">
<div class="layui-form-item" style="width: 90%;margin: 0 auto">
<div class="layui-input-inline">
<input type="text" name="q" required="" lay-verify="required" placeholder="搜索条件" class="layui-input">
</div>
<button class="layui-btn layui-btn-normal" type="submit">搜索</button>
</div>
</form>
</div>
<div class="layui-col-xs6 layui-col-md12">
<!--检索结果-start-->
<?php
if(isset($_GET['q'])){
@$q0=isset($_GET['q'])?$_GET['q']:'SQL注射';
@$q = str_replace("'","",$q0);
$qs = mysql_query("select * from drops where title like '%".@$q."%' or link like '%".@$q."%' group by id order by id desc");
$num = "15"; //每页显示30条
@$page=isset($_GET['page'])?intval($_GET['page']):1;
@$total=mysql_num_rows($qs); //查询数据的总数total
@$pagenum=ceil($total/$num);
@$offset=($page-1)*$num;
@$$drops_result2222 = mysql_query("select * from drops where title like '%".@$q."%' or link like '%".@$q."%' group by id order by id desc limit ".$offset.",15");
if (mysql_num_rows($$drops_result2222)>0) {
echo '
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
<legend>
搜索结果
</legend>
</fieldset>
<table class="layui-table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>
标题
</th>
<th>
链接
</th>
<th>
操作
</th>
</tr>
</thead>';
echo "<tbody>";
while(@$row223 = mysql_fetch_array($$drops_result2222)){
echo "<tr>";
echo '<td>'.$row223['title'].'</td>'. PHP_EOL;
echo '<td>'.$row223['link'].'</td>'. PHP_EOL;
echo '<td> <a href="http://'.$_SERVER["SERVER_ADDR"].$row223['link'].'" class="layui-btn layui-btn-normal" target="_blank">查看</a></td>'. PHP_EOL;
echo "</tr>";
}
echo '</tbody>';
echo '</table>';
echo '<div style="float:right;padding:10px 30px 0 0">';
@$page = $_GET['page']?$_GET['page']:1;//当前页数,默认是1
if($page==1){
$prepage=1;
}else{
$prepage=$page-1;
}
if($page==$pagenum){
$nextpage=$pagenum;
}else{
$nextpage=$page+1;
}
echo '<center> 共 '.$total.' 条记录';
echo ','.$pagenum.' 页 ';
echo '<a href="drops.php?q='.$q.'&page=1" class="layui-btn layui-btn-sm">首页</a>'. PHP_EOL;
echo '<a href="drops.php?q='.$q.'&page='.$prepage.'" class="layui-btn layui-btn-primary layui-btn-sm">上一页</a>'. PHP_EOL;
echo '<a href="drops.php?q='.$q.'&page='.$nextpage.'" class="layui-btn layui-btn-primary layui-btn-sm">下一页</a>'. PHP_EOL;
echo '<a href="drops.php?q='.$q.'&page='.$pagenum.'" class="layui-btn layui-btn-danger layui-btn-sm">末页</a></center>'. PHP_EOL;
echo '</div>';
}else{
echo '<blockquote class="layui-elem-quote layui-text layui-mt-5">未检索到相关内容!</blockquote>';
}
}
?>
</div>
<!---检索结果-end-->
<div class="layui-col-xs6 layui-col-md12"style="margin-bottom: 100px;">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
<legend>
随机文章
</legend>
</fieldset>
<?php
@$drops_random = mysql_query("SELECT * FROM drops WHERE id >= ((SELECT MAX(id) FROM drops)-(SELECT MIN(id) FROM drops)) * RAND() + (SELECT MIN(id) FROM drops) LIMIT 5");
@$drops_random = mysql_query("SELECT * FROM drops WHERE id >= ((SELECT MAX(id) FROM drops)-(SELECT MIN(id) FROM drops)) * RAND() + (SELECT MIN(id) FROM drops) LIMIT 5");
if (mysql_num_rows($drops_random)>0) {
echo '
<table class="layui-table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>
标题
</th>
<th>
链接
</th>
<th>
操作
</th>
</tr>
</thead>';
echo "<tbody>";
while(@$row223333 = mysql_fetch_array($drops_random)){
echo "<tr>";
echo '<td>'.$row223333['title'].'</td>'. PHP_EOL;
echo '<td>'.$row223333['link'].'</td>'. PHP_EOL;
echo '<td> <a href="http://'.$_SERVER["SERVER_ADDR"].$row223333['link'].'" class="layui-btn layui-btn-normal" target="_blank">查看</a></td>'. PHP_EOL;
echo "</tr>";
}
echo '</tbody>';
echo '</table>';
}
?>
</div>
</div>
<div class="layui-footer" style="margin-top: 50px;">
<ul>
<li><a href="/">wooyun.org</a></li>
</ul>
</div>
</body>
<script charset="utf-8" src="/layui/layui.js">
</script>
</html>