Chinaunix首页
|
论坛
|
博客
博文
博主
cuadmin
4月28日14:30-20:30机房服务器迁移,暂停博客使用
9/30日 14:00 -10/4日 08:00暂时无法发布内容!
9/30日 14:00 -10/4日 08:00暂时无法发布内容!
首页
|
博文目录
|
关于我
harlizou
博客访问: 3906
博文数量: 5
博客积分: 270
博客等级: 二等列兵
技术积分: 50
用 户 组: 普通用户
注册时间: 2011-06-05 13:05
个人简介
暂无简介。
文章分类
全部博文
(5)
得分
(5)
未分配的博文
(0)
文章存档
2011年
(5)
2011年10月
(3)
2011年06月
(2)
我的朋友
最近访客
推荐博文
·
基于向量检索服务与TextEmbed...
·
k8s里的node-exporter如何cur...
·
MySQL Subquery Cache vs Ora...
·
DashVector x 通义千问大模型...
·
ORACLE vs MySQL 对组合索引...
相关博文
·
Linux常用的基本系统管理命令...
·
百度搜索:蓝易云 - Redis除...
·
百度搜索:蓝易云 - java创建...
·
百度搜索:蓝易云 - java处理...
·
百度搜索:蓝易云 - springMV...
·
百度搜索:蓝易云 - linux加...
·
百度搜索:蓝易云 - Maven多...
·
百度搜索:蓝易云 - Nginx双...
·
百度搜索:蓝易云 - aft算法...
·
百度搜索:蓝易云 - Linux下...
tytyt
分类:
LINUX
2011-10-04 16:39:07
rtgfdgf
<
?
php
/************************/
/* 文件名:17-6.php
/* 说明:留言列表
/************************/
include
"17-4.php"
;
include
"17-5.php"
;
include
"17-1.php"
;
//每页最多显示留言数
$
each_page
=
EACH_PAGE
;
//记录偏移量
$
offset
=
intval
(
$
_GET
[
'offset'
]
)
;
//关键字,用于留言搜索
$
keyword
=
$
_GET
[
'keyword'
]
;
//构造检索条件
if
(
$
keyword
)
{
$
where
=
"content LIKE '%$keyword%' OR revort LIKE '%$keyword%' "
;
$
title
=
"搜索结果"
;
}
else
{
$
where
=
"1=1"
;
$
title
=
"最新留言"
;
}
//总记录数
$
sql
=
"SELECT Count(*) FROM guestbook WHERE $where"
;
$
result
=
mysql_query
(
$
sql
)
;
$
row
=
mysql_fetch_row
(
$
result
)
;
$
total
=
$
row
[
0
]
;
//规范$offset
if
(
$
offset
<
0
)
$
offset
=
0
;
elseif
(
$
offset
>
$
total
)
$
offset
=
$
total
;
$
result
=
mysql_query
(
$
sql
)
;
//查询当前页记录
$
sql
=
"SELECT * FROM guestbook WHERE $where ORDER BY id DESC
LIMIT $offset, $each_page"
;
$
result
=
mysql_query
(
$
sql
)
;
//查询的记录数
$
numrows
=
mysql_num_rows
(
$
result
)
;
?
>
<
script
>
function vaildForm
(
obj
)
{
if
(
obj
.
keyword
.
value
=
=
''
|
|
obj
.
keyword
.
value
.
length
<
3
)
{
alert
(
'您没有填写搜索关键词,或者您的关键词太短!\n请重新填写至少 3 个字符。'
)
;
return false
;
}
else
{
return true
;
}
}
<
/
script
>
<
table
border
=
0
cellpadding
=
0
cellspacing
=
0
width
=
730
class
=
TitleBar
>
<
tr
>
<
td
class
=
TitleBar_L
>
<
/
td
>
<
td
class
=
TitleBar_T
>
≡
<
?
php
echo
$
title
?
>
≡
<
/
td
>
<
td
class
=
TitleBar_R
>
<
/
td
>
<
/
tr
>
<
/
table
>
<
?
php
if
(
$
numrows
>
0
)
{
$
tmp
=
0
;
/* 循环遍历数组,输出列表 */
while
(
$
data
=
mysql_fetch_array
(
$
result
)
)
{
$
tmp
+
+
;
//表格背景样式
$
bg_style
=
(
$
tmp
%
2
)
+
1
;
//留言ID
$
id
=
$
data
[
'id'
]
;
//是只有管理员阅读
$
hide
=
$
data
[
'hide'
]
;
//用户名
$
name
=
$
data
[
'name'
]
;
//性别
$
gender
=
(
$
data
[
'gender'
]
)
?
'男'
:
'女'
;
//电子邮件地址
$
email
=
$
data
[
'email'
]
;
//主页
$
homepage
=
$
data
[
'homepage'
]
;
//头像
$
face
=
$
data
[
'face'
]
;
//OICQ号码
$
oicq
=
$
data
[
'oicq'
]
;
//IP地址
$
ip
=
$
data
[
'ip'
]
;
//发布时间
$
time
=
$
data
[
'time'
]
;
//发布内容
$
content
=
nl2br
(
ubbcode
(
$
data
[
'content'
]
)
)
;
if
(
$
data
[
'revort'
]
)
{
//回复时间
$
retime
=
$
data
[
'retime'
]
;
//回复内容
$
revort
=
nl2br
(
ubbcode
(
$
data
[
'revort'
]
)
)
;
}
?
>
<
table
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"0"
width
=
"730"
class
=
"TextBox_"
>
<
tr
>
<
td
width
=
"5"
rowspan
=
"4"
class
=
"Border_L"
>
<
/
td
>
<
td
height
=
"1"
class
=
"BgLine"
>
<
/
td
>
<
td
width
=
"5"
rowspan
=
"4"
class
=
"Border_R"
>
<
/
td
>
<
/
tr
>
<
tr
>
<
td
height
=
"8"
>
<
/
td
>
<
/
tr
>
<
tr
>
<
td
valign
=
"top"
>
<
table
border
=
"0"
width
=
"100%"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
valign
=
"top"
width
=
"144"
>
&
nbsp
;
<
div
align
=
"center"
>
<
strong
>
<
?
php
echo
$
name
?
>
<
/
strong
>
<
br
>
<
br
>
<
img
src
=
"images/face/.gif"
border
=
0
width
=
100
height
=
100
>
<
br
>
<
br
>
性别:
<
?
php
echo
$
gender
?
>
<
br
>
<
br
>
<
/
div
>
<
/
td
>
<
td
width
=
"1"
class
=
"bgLine"
>
<
/
td
>
<
td
valign
=
"top"
width
=
"575"
>
&
nbsp
;
<
img
alt
=
"5345@et.com"
border
=
0
src
=
"images/email.gif"
width
=
16
height
=
16
>
<
a
href
=
"mailto:"
>
信箱
<
/
a
>
<
img
alt
=
""
src
=
"images/home.gif"
border
=
0
width
=
16
height
=
16
>
<
a
href
=
""
target
=
_blank
>
主页
<
/
a
>
<
img
alt
=
"IP 地址:"
border
=
0
src
=
"images/ip.gif"
width
=
16
height
=
15
>
地址
<
img
alt
=
""
border
=
0
src
=
"images/time.gif"
width
=
16
height
=
16
>
发表时间:
<
?
php
echo
$
time
?
>
<
?
php
if
(
$
_SESSION
[
'isAdmin'
]
)
{
?
>
<
img
src
=
"images/revert.gif"
border
=
0
>
<
a
href
=
"17-11.php?id="
>
回复
<
/
a
>
<
img
src
=
"images/delete.gif"
border
=
0
>
<
a
href
=
"delete.php?id="
OnClick
=
"JavaScript: if(confirm('确实要删除这条留言吗?')) return true; else return false;"
>
删除
<
/
a
>
<
?
php
}
?
>
<
hr
align
=
"left"
width
=
"70%"
size
=
"1"
noshade
>
<
table
border
=
"0"
width
=
"96%"
cellspacing
=
"4"
cellpadding
=
"4"
>
<
tr
>
<
td
class
=
"booktext"
>
<
div
class
=
"booktext"
>
<
?
php
if
(
$
_SESSION
[
'isAdmin'
]
|
|
!
$
hide
)
{
echo
$
content
;
}
else
{
echo
"
这是一条悄悄话,只有管理员能看
"
;
}
?
>
<
/
div
>
<
/
td
>
<
/
tr
>
<
/
table
>
<
/
td
>
<
/
tr
>
<
?
php
//如果有回复信息
if
(
$
revort
)
{
?
>
<
tr
>
<
td
valign
=
"top"
align
=
"center"
>
<
hr
align
=
"right"
width
=
"80%"
size
=
"1"
noshade
>
版主回复
<
br
>
<
?
php
echo
$
retime
?
>
<
/
td
>
<
td
width
=
"1"
class
=
"bgLine"
>
<
/
td
>
<
td
valign
=
"top"
>
<
hr
align
=
"left"
width
=
"80%"
size
=
"1"
noshade
>
<
table
border
=
"0"
width
=
"96%"
cellspacing
=
"4"
cellpadding
=
"4"
class
=
"booktext"
>
<
tr
>
<
td
class
=
"Revert"
>
<
?
php
echo
$
revort
?
>
<
/
td
>
<
/
tr
>
<
/
table
>
<
/
td
>
<
/
tr
>
<
?
php
}
?
>
<
/
table
>
<
/
td
>
<
/
tr
>
<
tr
>
<
td
height
=
"8"
>
<
/
td
>
<
/
tr
>
<
/
table
>
<
?
php
}
//endforeach
}
else
{
//endif
?
>
<
h3
>
暂时没有留言
<
/
h3
>
<
?
php
}
?
>
<
table
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"0"
width
=
"730"
class
=
"Hemline"
>
<
tr
>
<
td
class
=
"Hemline_L"
>
<
/
td
>
<
td
class
=
"Hemline_T"
>
<
img
style
=
"width: 1; height: 0"
>
<
/
td
>
<
td
class
=
"Hemline_R"
>
<
/
td
>
<
/
tr
>
<
/
table
>
<
table
width
=
730
border
=
0
cellspacing
=
0
cellpadding
=
0
height
=
34
>
<
tr
>
<
td
nowrap
width
=
100
>
<
table
border
=
0
cellspacing
=
0
cellpadding
=
0
>
<
form
action
=
"17-6.php"
method
=
GET
OnSubmit
=
"return vaildForm(this)"
>
<
tr
>
<
td
nowrap
>
&
nbsp
;
搜索:
<
input
class
=
text
size
=
13
name
=
"keyword"
value
=
""
>
&
nbsp
;
<
/
td
>
<
/
tr
>
<
/
form
>
<
/
table
>
<
/
td
>
<
td
align
=
right
nowrap
>
<
p
>
共
<
font
color
=
red
>
<
b
>
<
?
php
echo
$
total
?
>
<
/
b
>
<
/
font
>
条记录
&
nbsp
;
<
b
>
<
?
php
//为分页准备
$
last_offset
=
$
offset
-
$
each_page
;
if
(
$
last_offset
<
0
)
{
?
>
前一页
<
?
php
}
else
{
?
>
<
a
href
=
"?offset=&keyword="
>
前一页
<
/
a
>
<
?
php
}
echo
" "
;
$
next_offset
=
$
offset
+
$
each_page
;
if
(
$
next_offset
>
=
$
total
)
{
?
>
后一页
<
?
}
else
{
?
>
<
a
href
=
"?offset=&keyword="
>
后一页
<
/
a
>
<
?
php
}
?
>
<
/
td
>
<
/
tr
>
<
/
table
>
<
?
php
include
"17-2.php"
;
?
>
dgfhf
阅读(341) | 评论(0) | 转发(0) |
0
上一篇:
tghg
下一篇:
dsfdf
给主人留下些什么吧!~~
评论热议
请登录后评论。
登录
注册