-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannounce.php
143 lines (132 loc) · 5.8 KB
/
announce.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<!-- <link rel="icon" href="../../favicon.ico"> -->
<title>Forum</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/main.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery-2.1.4.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
function checkSubmit(){
if ( confirm("确定发布公告?")){
var title = document.post.title.value;
var content = document.post.content.value;
//document.write(title);
if( title == "" || content == "" ){
alert("公告主题或内容不能为空!");
// document.post.title.focus();
return false;
}
return true;
} else {
return false;
}
}
</script>
</head>
<body>
<?php
require("connect.php");
require('checkvalid.php');
// session_start();
$username = $_SESSION['username'];
$u_id = $_SESSION['u_id'];
$bid = $_GET['b_id'];
?>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="nav-wrapper">
<div class="container-fluid">
<ul class="nav navbar-nav ">
<li class="divider-vertical"></li>
<li><a href="index.php"><b>论坛首页</b></a></li>
</ul>
<form class="navbar-form navbar-left" role="search" method="post" action="posts.php?b_id=<?php echo $bid ?>">
<div class="form-group">
<input type="text" name="keyword" class="form-control" placeholder="帖子主题">
</div>
<button type="submit" class="btn btn-default" name="search">搜索</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li>
<div class="navbar-header">
<img alt="avatar" src="<?php echo $_SESSION['avatar']; ?>" class="img-nav img-rounded">
</div>
</li>
<li class="dropdown">
<a href="#" id="username-nav" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo $username?>
<!-- <span class="caret"></span> -->
</a>
<ul class="dropdown-menu" role="menu">
<li><a href="editinfo.php">编辑信息</a></li>
<li><a href="message.php">短消息</a></li>
<?php if($_SESSION['role'] == 0){ ?>
<li><a href="usermanagement.php">用户管理</a></li>
<li><a href="boardmanagement.php">版块管理</a></li>
<?php } ?>
<li class="divider"></li>
<li><a href="logout.php">注销</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="divider-vertical"></li>
<li><a href='posts.php?b_id=<?php echo $bid ?>'>浏览</a></li>
<li class="divider-vertical"></li>
<li><a href="top10.php">热门帖子</a></li>
<li class="divider-vertical"></li>
<li class="active"><a href="announcement.php?b_id=<?php echo $bid?>">公告 <span class="sr-only">(current)</span></a></li>
<li class="divider-vertical"></li>
<li class="divider-vertical-invisable"></li>
<li class="divider-vertical-invisable"></li>
<li class="divider-vertical-invisable"></li>
<li class="divider-vertical-invisable"></li>
<li class="divider-vertical-invisable"></li>
</ul>
</div>
</div>
</nav>
<div class="panel panel-default panel-size">
<div class="panel-heading">
<ol class="breadcrumb breadcrumb-post">
<?php
if(isset($_GET['b_id']))
$bid = $_GET['b_id'];
$sql = "select b_name from forum_board where b_id = $bid";
$query = mysql_query($sql)
or die("Error!");
$row = mysql_fetch_array($query); //num of posts
$b_name = $row[0];
mysql_close();
?>
<li><a href="posts.php?b_id=<?php echo $bid?>"><?php echo $b_name?></a></li>
<li class="active">发布公告</li>
<!-- <li class="active">Data</li> -->
</ol>
</div>
<div class="panel-body">
<form name="post" enctype="multipart/form-data" action="post_handle.php?b_id=<?php echo $bid ?>" method="POST" onsubmit="return checkSubmit()">
<div class="input-group">
<span class="input-group-addon" >主题</span>
<input type="text" class="form-control" placeholder="120个字符以内" name="title">
<span class="input-group-btn">
<button class="btn btn-success" name ="submit_announcement" type="submit">发布</button>
</span>
</div>
<textarea class="form-control input-textarea" rows="10" placeholder="公告内容" name = "content"></textarea>
<input type="file" name="uploadfile" id="uploadfile">
</form>
</div>
</div>
</body>
</html>