<!DOCTYPE html>
<HTML lang="zh-CN">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE>欢迎来到告白墙</TITLE>
<style type=text/css>
TD{
font-size:12px;
line-height:150%;
}
</style>
<!-- 引入 Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
background-image: url(image/61782be166c826c8-653ea5468e5789eb-eeb202e4919e8be15dc884a47dcba71d.jpg);
}
</style>
</HEAD>
<BODY>
<table border=1 cellspacing=0 cellspadding=0 style="border-collapse:collapse" align=center width=890 bordercolor=black height="382">
<tr >
<td width="445" height=100 bgcolor=#333333 style="font-size:30px;line-height:30px;" >
<p class="text-center" >
<img src="image/1.jpg">
</p>
</td>
<tr>
<tr>
<td height=25 bgcolor="#333333">
<a class="btn btn-info" href=send.php role="button">写留言</a>
<a class="btn btn-info" href=login.php role="button">登录</a>
<a class="btn btn-info" href=register.php role="button">注册</a>
<a class="btn btn-info" href=logout.php role="button" style="float:right;margin-right:5px">注销登录</a>
</td>
</tr>
<tr><td style="padding-left:20px;padding-top:20px" height=200 bgcolor="#FFFFFF">
<?php
//连接数据库
$conn=new mysqli("localhost","root","root","gbook");
// Check connection
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
$sql = "SELECT * FROM message";
$result = $conn->query($sql);
//遍历数据库,输出留言
if ($result->num_rows > 0)
{
//分页数据
$totalnum=mysqli_num_rows($result);
$pagesize=5;
$page=$_GET["page"];
if($page=="")
{
$page=1;
}
$begin=($page-1) * $pagesize;
$totalpage=ceil($totalnum/$pagesize);
echo "<table border=0 width=95%><tr><td>";
$query="SELECT * FROM message order by addtime desc limit $begin,$pagesize";
$result2=$conn->query($query);
$datanum=mysqli_num_rows($result2);
//遍历数据库,输出表白内容
for($i=1;$i<=$datanum;$i++)
{
$info=mysqli_fetch_array($result2,MYSQLI_ASSOC);
echo "<h3>-> ".$info['author']."</h3><h5 style='float:right;color:#B8BEB7'> ".$info['addtime']."</h5><br>";
echo " <h4>".$info['content']."</h4><br>";
$sql="SELECT * FROM reply where id=".$info['id'];
$result3=$conn->query($sql);
echo "<br><b>回复:</b><br>";
if(mysqli_num_rows($result3)>0){
$List = array();
$Order = null;
while($Order = mysqli_fetch_array ($result3)){
$List[] = $Order;
}
$count=count($List);
$id=$List[0][1];
for($j=0;$j<mysqli_num_rows($result3);$j++){
echo " <font size='3px'>".$List[$j][1].":".$List[$j][2]."</font><br>";
}
}else{
echo " 无回复<br>";
}
echo "<a href=reply.php?id=".$info['id'].">评论</a>";
echo "<hr>";
}
echo "</table>";
} else {
echo "0 结果";
}
mysqli_close($conn);
echo "留言共".$totalnum."条 ";
echo "页数共".$totalpage."页<br>";
?>
<nav aria-label='Page navigation'>
<ul class='pagination'>
<li>
<a href=index.php?page=1 aria-label='Previous'>
<span aria-hidden='true'>«</span>
</a>
</li>
<?php
if($_GET['page']==""){
$_GET['page']=1;
}
for($j=1;$j<=$totalpage;$j++){
if($j==$_GET['page']){
echo "<li class='active'><a href=index.php?page=".$j.">".$j."</a></li>";
}else{
echo "<li><a href=index.php?page=".$j.">".$j."</a></li>";
}
}
echo "
<li>
<a href=index.php?page=".$totalpage." aria-label='Next'>
<span aria-hidden='true'>»</span>
</a>
</li>
";
?>
</ul>
</nav>
</td></tr>
<tr><td height=60 bgcolor=#6c6c6c align=center>
<font color=#FFFFFF>版权所有:cz
</td></tr>
</table>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
php告白墙源码(期末作业小项目).zip
共30个文件
php:6个
jpg:6个
css:4个
需积分: 40 61 下载量 61 浏览量
2019-12-18
12:12:07
上传
评论 39
收藏 5.75MB ZIP 举报
温馨提示
自己写的一个简单的php期末作业项目。 五个独立页面:首页,登录,注册,写留言,评论。 附带数据库sql文件以及系统说明文档。 (数据库用的MySQL,可以下载一个PHPstudy,然后把项目放进PHPstudy根目录下的www文件里,开启phpstudy的Apache和mysql服务,就可以在浏览器通过localhost访问了)
资源推荐
资源详情
资源评论
收起资源包目录
php告白墙.zip (30个子文件)
php告白墙
系统说明书.doc 3.41MB
告白墙 数据库.sql 5KB
告白墙源码
fonts
glyphicons-halflings-regular.woff2 18KB
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.woff 23KB
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.eot 20KB
register.php 2KB
send.php 2KB
logout.php 443B
index.php 4KB
js
npm.js 484B
bootstrap.js 68KB
bootstrap.min.js 36KB
css
bootstrap.css 143KB
bootstrap-theme.min.css 23KB
bootstrap.css.map 380KB
bootstrap.min.css 118KB
bootstrap-theme.min.css.map 25KB
bootstrap-theme.css.map 47KB
bootstrap.min.css.map 529KB
bootstrap-theme.css 26KB
image
4.jpg 562KB
3.jpg 318KB
61782be166c826c8-653ea5468e5789eb-eeb202e4919e8be15dc884a47dcba71d.jpg 551KB
1.jpg 105KB
2.jpg 153KB
5.jpg 399KB
login.php 3KB
reply.php 2KB
共 30 条
- 1
资源评论
无謂乄
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功