-
Notifications
You must be signed in to change notification settings - Fork 0
/
recent.php
389 lines (365 loc) · 15.2 KB
/
recent.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<?php require_once('Connections/weblib.php') ;?>
<!DOCTYPE <html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>科技快讯 | 大型主机科普网站</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<style type="text/css">
#container { padding-bottom:20px; margin:10px; width: 600px; height: 250px; overflow: hidden; position: relative; border-bottom: 1px solid #E1E1E1;}
#list { width: 4200px; height: 250px; position: absolute; z-index: 1;}
#buttons { position: absolute; height: 10px; width: 100px; z-index: 2; bottom: 40px; left: 250px;}
#buttons span { cursor: pointer; float: left; border: 1px solid #fff; width: 10px; height: 10px; border-radius: 50%; background: #333; margin-right: 5px;}
#buttons .on { background: orangered;}
.arrow { cursor: pointer; display: none; line-height: 39px; text-align: center; font-size: 36px; font-weight: bold; width: 40px; height: 40px; position: absolute; z-index: 2; top: 105px; background-color: RGBA(0,0,0,.3); color: #fff;}
.arrow:hover { background-color: RGBA(0,0,0,.7);}
#container:hover .arrow { display: block;}
#prev { left: 20px;}
#next { right: 20px;}
.pic { width:600px; height:250px; background:url("images/pic.jpg"); float:left; }
.letter { padding:10px; width: 200px; height: 100px; position: absolute; z-index: 3; margin-left:280px; margin-top:80px; background-color: RGBA(255,255,255,.4);border: 1px solid #E1E1E1;}
.letter:hover { background-color: RGBA(255,255,255,.6);}
.letter p{ color:#333; text-align:left; line-height:16px; font-size:14px; padding:2px;}
.letter .strong{ padding:5px; font-weight:700; font-size:18px; margin-bottom:10px; border-bottom: 2px dotted #E1E1E1;}
</style>
</head>
<body>
<?php
class Show
{
var $PageSize; //每页的数量
var $CurrentPageID; //当前的页数
var $NextPageID; //下一页
var $PreviousPageID; //上一页
var $numPages; //总页数
var $amount; //总记录数
var $isFirstPage; //是否第一页
var $isLastPage; //是否最后一页
var $sql; //sql查询语句
var $num; //预定显示页码数
var $CurrentNum; //当前显示记录数
function display($currentNum){
//获取当前页数
if(isset($_GET['CurrentPageID'])){
$this->CurrentPageID=intval($_GET['CurrentPageID']);
}
else{
$this->CurrentPageID=1;
}
//每页数量
$this->CurrentNum=$currentNum;
$sql="select count(*) as amount from article where module = 1 and status=3" ;
$result=mysql_query($sql)or die(mysql_error());
$number=mysql_fetch_array($result);
$this->amount=$number[0];
//获取页数
if($this->amount){
if($this->amount<$this->CurrentNum){$this->page_count=1;}
if($this->amount%$this->CurrentNum){
$this->numPages=(int)($this->amount/$this->CurrentNum)+1;
}else{
$this->numPages=$this->amount/$this->CurrentNum;
}
}else{
$this->numPages=0;
}
//获取数据
$this->page=($this->CurrentPageID-1)*$this->CurrentNum;
if($this->amount){
$sql="select* from article where module=1 and status=3order by aid desc limit $this->page,$this->CurrentNum";
$result=mysql_query($sql)or die(mysql_error());
while($row=mysql_fetch_array($result)){
$rowset[]=$row;
}
}else{
$rowset=array();
}
return $rowset;
}
//分页码函数
function pagebar(){
$num=5;
$num = min($this->numPages, $num); //处理显示的页码数大于总页数的情况
if($this->CurrentPageID >$this->numPages || $this->CurrentPageID < 1) return $this->numPages; //处理非法页号的情况
$end = $this->CurrentPageID + floor($num/2) <= $this->numPages ? $this->CurrentPageID + floor($num/2) : $this->numPages; //计算结束页号
$start = $end - $num + 1; //计算开始页号
if($start < 1) { //处理开始页号小于1的情况
$end -= $start - 1;
$start = 1;
}
for($i=$start; $i<=$end; $i++) { //输出分页条,添加链接样式
if($i == $this->CurrentPageID){
echo " <a href='Admin_user.php?CurrentPageID=".$i."'>[$i]</a>";
} else{
echo " <a href='Admin_user.php?CurrentPageID=".$i."'>$i</a>";
}
}
}
}
$user_display=new Show;
$row=$user_display->display(7);
?>
<div id="topBar">
<div class="wrapper">
<div class="l">
您好,欢迎访问大型主机科普网站!
</div>
<div class="r">
<a href="#" onclick="window.external.AddFavorite(location.href,'');">加入收藏</a>
<a href="#" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage(location.href);">设为首页</a>
<span> <a href="login.php" target="_blank">登录</a>| <a href="register.php" target="_blank">注册</a>| <a href="manager.html" target="_blank">管理员入口</a> </span>
</div>
</div>
</div>
<div id="header">
<div class="wrapper">
<div class="logo">
<a href="/"><img src="images/logo3.png" alt="大型主机科普网站" /></a>
</div>
</div>
</div>
<div id="nav">
<ul>
<li><a href="index.php" class="a1">首页</a></li>
<li><a href="recent.php" class="a2">科技快讯</a></li>
<li><a href="technology.php" class="a3">主机技术</a></li>
<li><a href="medias.php" class="a4">科普乐园</a></li>
<li><a href="q_a.php" class="a5">知识问答</a></li>
<form class="search" method="get" action="" target="_blank">
<p> <input class="searchTxt" value="" maxlength="30" name="wd" type="text" style="background-image:url('images/search_bg.png') " /> <input src="images/search_icon.png" class="search_icon" name="" type="image" /> </p>
</form>
</ul>
</div>
<script type="text/javascript">
function select_search_type(n){
document.getElementById('search_type1').className='';
document.getElementById('search_type2').className='';
document.getElementById('search_type3').className='';
document.getElementById('search_type'+n).className='current';
document.getElementById('search_type').value=n;
}
</script>
<div id="main">
<div id="page">
<div class="pageLeft">
<div id="recentMenu">
</div>
<div class="map2">
<a target="_blank" href="http://j.map.baidu.com/f_v1z" ><img src="images/ditu.png" /></a>
</div>
</div>
<div class="pageRight">
<div class="title_pic">
<img src="images/recent_pic.png" />
</div>
<div id="current">
所在位置:
<a href="" class="curr">首页</a> >
<a href="" class="curr">科技快讯</a> >
<a href="" class="curr">主机技术</a>
</div>
<div id="recentMain">
<div id="recentTop">
<div id="container">
<div id="list" style="left: -600px;">
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
<div class="pic"><div class="letter"><p class="strong"><a href="" target="_blank">大型机专业引擎</a></p><p>大型主机的中央处理器(CP)可以处理System z、 z/Architecture 和 ESA/390等指令集</p></div></div>
</div>
<div id="buttons">
<span index="1" class="on"></span>
<span index="2"></span>
<span index="3"></span>
<span index="4"></span>
<span index="5"></span>
</div>
<a href="javascript:;" id="prev" class="arrow"><</a>
<a href="javascript:;" id="next" class="arrow">></a>
</div>
</div>
<div id="recentBottom">
<?php
foreach($row as $val)
{
?>
<div class="glist">
<div class="gimg">
<a href="articlebrowse.php?aid=<?php echo $val['aid']; ?>" target="_blank"><img src="<?php echo $val['pic']?>" height="93" width="145" /></a>
</div>
<div class="gtitle">
<p class="strong"><a href="articlebrowse.php?aid=<?php echo $val['aid']; ?>" target="_blank"><?php echo $val['title']?></a></p>
<p><?php echo $val['introduction']?></p>
</div>
</div>
<?php
}
?>
</div>
</div>
<!-- 以下是来自明智科普网的分页js -->
<div class="itemC">
<script language="JavaScript"> <!--
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
if(_nPageCount == null || _nPageCount<=1){
return;
}
var nCurrIndex = _nCurrIndex || 0;
for(var i=0; i<_nPageCount; i++){
var sPageName = (i == 0 ? _sPageName : (_sPageName+"_" + i)) + "."+_sPageExt;
if(nCurrIndex == i){ document.write((i+1) + " ");
}else{ document.write("<a href='" + sPageName + "' class='current'>"+(i+1)+"</a> ");
}
}
}
//WCM置标
createPageHTML(0, 0, "index", "html");
</script>1
<a href="#" class="current">2</a>
<a href="#" class="current">3</a>
<a href="#" class="current">4</a>
<a href="#" class="current">5</a>
<a href="#" class="current">6</a>
<a href="#" class="current">7</a>
<a href="#" class="current">8</a>
<a href="#" class="current">9</a>
<a href="#" class="current">10</a>
</div>
<!-- 以上是来自明智科普网的分页js -->
</div>
<div class="clearit"></div>
</div>
</div>
<script type="text/javascript">
window.onload = function () {
var container = document.getElementById('container');
var list = document.getElementById('list');
var buttons = document.getElementById('buttons').getElementsByTagName('span');
var prev = document.getElementById('prev');
var next = document.getElementById('next');
var index = 1;
var len = 5;
var animated = false;
var interval = 3000;
var timer;
function animate (offset) {
if (offset == 0) {
return;
}
animated = true;
var time = 300;
var inteval = 10;
var speed = offset/(time/inteval);
var left = parseInt(list.style.left) + offset;
var go = function (){
if ( (speed > 0 && parseInt(list.style.left) < left) || (speed < 0 && parseInt(list.style.left) > left)) {
list.style.left = parseInt(list.style.left) + speed + 'px';
setTimeout(go, inteval);
}
else {
list.style.left = left + 'px';
if(left>-200){
list.style.left = -600 * len + 'px';
}
if(left<(-600 * len)) {
list.style.left = '-600px';
}
animated = false;
}
}
go();
}
function showButton() {
for (var i = 0; i < buttons.length ; i++) {
if( buttons[i].className == 'on'){
buttons[i].className = '';
break;
}
}
buttons[index - 1].className = 'on';
}
function play() {
timer = setTimeout(function () {
next.onclick();
play();
}, interval);
}
function stop() {
clearTimeout(timer);
}
next.onclick = function () {
if (animated) {
return;
}
if (index == 5) {
index = 1;
}
else {
index += 1;
}
animate(-600);
showButton();
}
prev.onclick = function () {
if (animated) {
return;
}
if (index == 1) {
index = 5;
}
else {
index -= 1;
}
animate(600);
showButton();
}
for (var i = 0; i < buttons.length; i++) {
buttons[i].onclick = function () {
if (animated) {
return;
}
if(this.className == 'on') {
return;
}
var myIndex = parseInt(this.getAttribute('index'));
var offset = -600 * (myIndex - index);
animate(offset);
index = myIndex;
showButton();
}
}
container.onmouseover = stop;
container.onmouseout = play;
play();
}
</script>
<div id="footer">
<div class="nav">
<ul>
<li class="jianjie"><a href="#" class="a1">华工IBM中心简介</a></li>
<li><a href="#" class="a2">网站简介</a></li>
<li><a href="#" class="a3">联系我们</a></li>
<li><a href="message.php" class="a4">留言建议</a></li>
<li><a href="#" class="a5">友情链接</a></li>
</ul>
</div>
<!-- <div class="friendlink">
<ul>
<li><a href="#" class="a1">科学松鼠会</a></li>
<li><a href="#" class="a2">蝌蚪五线谱</a></li>
<li><a href="#" class="a3">中国科普网</a></li>
<li><a href="#" class="a4"></a></li>
</ul>
</div> -->
<!-- <div class="copyright">
<div class="l">© Copyright © 2014.</div>
</div> -->
</div>
<a href="#" title="返回顶部" id="goTop"></a>
</body>
</html>