-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
135 lines (123 loc) · 5.42 KB
/
index.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
<?php
//定义常量ON来获取访问页面的权限
define('ON', true);
//引入公共文件
require_once 'inc/common.inc.php';
$link = connect();
//页面信息的查询
$sql_info = "select * from ws_info where id=1";
$result = execute($link, $sql_info);
$data_info = fetch_array($result);
//判断是否处于登录状态
$member_id = login_state($link);
//父版块信息
$sql_sel = "select * from ws_father_module order by sort";
$result_father = execute($link, $sql_sel);
//帖子总数
$sql_total = "select * from ws_content";
$result_total = execute($link, $sql_total);
$total = mysqli_num_rows($result_total);
//今日总帖子
$sql_total_today = "select * from ws_content where time>CURDATE()";
$result_total_today = execute($link, $sql_total_today);
$total_today = mysqli_num_rows($result_total_today);
//会员总数
$sql_member = "select * from ws_member";
$result_member = execute($link, $sql_member);
$total_member = mysqli_num_rows($result_member);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页 - <?php echo $data_info['index_title']?></title>
<link rel="stylesheet" href="style/public.css">
<link rel="stylesheet" href="style/common.css">
<link rel="stylesheet" href="style/index.css">
<script type="text/javascript" src="js/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<?php require_once 'inc/header.inc.php';?>
<div style="margin-top: 55px;"></div>
<div class="auto">
<div class="chart clear">
<p>今日:<em><?php echo $total_today?></em><span class="pipe">|</span>帖子:<em><?php echo $total?></em><span class="pipe">|</span>会员:<em><?php echo $total_member?></em></p>
<div class="quick-thread-box">
<a class="quick-thread" href="publish.php">我要发帖</a>
</div>
</div>
<div class="quote_reply">
<div class="latest_quote">
<h4>最新发表</h4>
<ul>
<?php
$sql = "select * from ws_content order by id desc limit 0,10";
$result = execute($link, $sql);
while($data = fetch_array($result)){
$sql_son = "select wsm.module_name,wm.user from ws_son_module wsm,ws_member wm where wsm.id={$data['module_id']} and wm.id={$data['member_id']}";
$result_son = execute($link, $sql_son);
$data_son = fetch_array($result_son);
?>
<li>[<?php echo $data_son['module_name']?>] <a href="show.php?cid=<?php echo $data['id'] ?>"><?php echo $data['title']?></a><span>[<?php echo $data_son['user']?>]</span></li>
<?php }?>
</ul>
</div>
<div class="latest_reply">
<h4>最新回复</h4>
<ul>
<?php
$sql_reply = "select * from ws_reply order by id desc limit 0,10";
$result_reply = execute($link, $sql_reply);
while($data_reply = fetch_array($result_reply)){
$sql_member = "select wc.id,wc.title,wm.user,wsm.module_name from ws_content wc,ws_member wm,ws_son_module wsm where wc.id={$data_reply['content_id']} and wm.id=wc.member_id and wc.module_id=wsm.id";
$result_member = execute($link, $sql_member);
$data_member = fetch_array($result_member);
?>
<li>[<?php echo $data_member['module_name']?>] <a href="show.php?cid=<?php echo $data_member['id']?>"><?php echo $data_member['title'] ?></a><span>[<?php echo $data_member['user']?>]</span></li>
<?php }?>
</ul>
</div>
</div>
<?php while (@$data_father = fetch_array($result_father)) { ?>
<div class="box auto">
<div class="title">
<span class="collapsed"></span>
<h2><a href="list_father.php?id=<?php echo $data_father['id']?>"><?php echo $data_father['module_name']?></a></h2>
</div>
<div class="childlist">
<table class="cl">
<tr class="cl_row">
<?php
$sql_sel_son = "select * from ws_son_module where father_module_id={$data_father['id']}";
$result_son = execute($link, $sql_sel_son);
if (mysqli_num_rows($result_son)) {
while (@$data_son = fetch_array($result_son)) {
$sql_total = "select * from ws_content where module_id={$data_son['id']}";
$sql_today = "select * from ws_content where module_id={$data_son['id']} and time>CURDATE()";
$result_total = execute($link, $sql_total);
$result_today = execute($link, $sql_today);
$count_total = mysqli_num_rows($result_total);
$count_today = mysqli_num_rows($result_today);
?>
<td class="cl_col">
<dl>
<dt><a href="list_son.php?id=<?php echo $data_son['id'];?>"><?php echo $data_son['module_name']?></a></dt>
<dd>今日:<?php echo $count_today?></dd>
<dd>帖子:<?php echo $count_total?></dd>
</dl>
</td>
<?php }?>
<?php }else {?>
<td>暂无子版块...</td>
<?php }?>
</tr>
</table>
</div>
</div>
<?php }?>
<?php require_once 'inc/footer.inc.php';?>
</div>
</body>
</html>