PHP练习4 留言板
一、要求
二、示例页面
三、网页代码及网页显示
1.denglu.php 登录页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{ margin:0px auto; padding:0px}
#aa{ width:400px; height:89px; font-size:36px; color:#39F; text-align:center; line-height:89px; vertical-align:middle; border-bottom:1px solid #999}
.bb{ width:400px; height:59px}
.cc{ width:159px; height:59px; float:left; font-size:20px; text-align:right; line-height:59px; vertical-align:middle}
.dd{ width:200px; height:59px; float:left}
.ee{ width:150px; height:30px; text-align:center; margin-top:15px}
.ff{ width:80px; height:30px}
</style>
</head> <body>
<form action="dengluchuli.php" method="post">
<div style="width:400px; height:259px; margin-top:100px; border:1px solid #999">
<div id="aa">汉企网络0904留言板</div>
<div class="bb">
<div class="cc">用户名:</div>
<div class="dd"><input id="yonghuming" class="ee" type="text" name="uid" /></div>
</div>
<div class="bb">
<div class="cc">密码:</div>
<div class="dd"><input class="ee" type="password" name="pwd" /></div>
</div>
<div style="width:400px; height:50px; text-align:center; margin-top:10px">
<input class="ff" type="submit" value="登录" />
<input class="ff" type="button" value="复位" onclick="Fuwei()" />
</div>
</div>
</form>
</body>
<script type="text/javascript">
function Fuwei()
{
document.getElementById("yonghuming").value = "";
}
</script>
</html>
2.dengluchili.php 登录处理页面
<?php
session_start();
$UserName = $_POST["uid"]; $PassWord = $_POST["pwd"]; include("DBDA.class.php");
$db = new DBDA();
$sql = "select PassWord from yuangong where UserName='$UserName'"; $mm = $db->StrQuery($sql); if($PassWord !="" && $PassWord==$mm)
{
$_SESSION['views']=$UserName;
header("location:main.php");
}
else
{
echo "用户名或密码输入错误";
}
3.main.php 主页面,显示所有的信息。
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head> <body>
<?php include("DBDA.class.php");
$db = new DBDA(); $sall = "select count(*) from liuyan";
$total = $db->StrQuery($sall); include("../page.class.php");
$page = new Page($total,20); $sql = "select * from liuyan ".$page->limit; $result = $db->Query($sql); foreach($result as $v)
{
}
?>
<br />
<div><a href="fabuxinxi.php">发布信息</a> <a href="tuichuchuli.php">退出系统</a></div>
<br />
<table width="50%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>发送人</td>
<td>接收人</td>
<td>发送时间</td>
<td>信息内容</td>
</tr>
<?php
foreach($result as $v)
{
echo "<tr><td>$v[1]</td><td>$v[2]</td><td>$v[3]</td><td>$v[4]</td></tr>";
}
?>
</table>
<?php
echo $page->fpage();//显示表格下方的数据和页面的信息。
if(empty($_SESSION["views"]))
{
header("location:denglu.php");
exit;
}
?>
</body>
</html>
4.fabuxinxi.php 发布信息页面
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{ margin:0px; padding:0px}
.aa{ width:300px; height:40px; border:2px solid #999; border-bottom:0px; text-align:center; line-height:40px; vertical-align:middle}
.bb{ width:80px; height:30px}
#text1{ float:left; margin-top:10px; width:150px; height:20px; margin-left:2px}
</style>
</head>
<body>
<form action="fabuxinxichuli.php" method="post" onclick="return true">
<div style="position:relative; left:100px; top:40px">
<div><a href="chakanxinxi.php">查看信息</a> <a href="tuichuchuli.php">退出系统</a></div>
<br />
<div class="aa">
<div style="float:left; width:100px; height:40px; text-align:right">接收人:</div>
<!--<input id="text1" type="text" name="jieshouren" />-->
<select name="jishouren" style="width:100px; height:25px; margin-top:8px; margin-left:-100px">
<option selected="selected">所有人</option>
<?php
include("DBDA.class.php");
$db = new DBDA();
$sql = "select firend from firend";
$result = $db->Query($sql);
foreach($result as $v)
{
echo "<option>$v[0]</option>";
}
?>
</select>
</div>
<div class="aa" style="height:90px">
<div style="float:left; width:100px; height:90px; text-align:right; line-height:90px; vertical-align:middle">信息内容:</div>
<div style="text-align:left"><textarea id="text2" name="xinxineirong" style="margin-top:4px; height:80px"></textarea></div>
</div>
<div class="aa" style="border-bottom:2px solid #999">
<input class="bb" type="submit" value="发送" />
<input class="bb" type="button" value="复位" onclick="Fuwei()" />
</div>
</div>
</form>
<?php
if(empty($_SESSION["views"]))
{
header("location:denglu.php");
}
?>
</body>
<script type="text/javascript">
function Fuwei()
{
document.getElementById("text1").value = "";
document.getElementById("text2").value = "";
}
</script>
</html>
5.fabuxinxichuli.php 发布信息处理页面
<?php
session_start();
$fasongren = $_SESSION['views'];
$time = date("Y-m-d h:i:s");
$jieshouren = $_POST["jieshouren"];
$xinxineirong = $_POST["xinxineirong"]; include("DBDA.class.php");
$db = new DBDA(); $sql ="insert into liuyan values('','{$fasongren}','{$jieshouren}','{$time}','{$xinxineirong}')";
$db->Query($sql,0);
if(empty($_SESSION["views"]))
{
header("location:denglu.php");
}
else
{
header("location:main.php");
}
6.chakanxinxi.php 只显示和登陆者有关系的信息
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<?php
$sender = $_SESSION['views'];
$Recever = $_SESSION['views'];
include("DBDA.class.php");
$db = new DBDA(); $sall = "select count(*) from liuyan";
$total = $db->StrQuery($sall); include("../page.class.php");
$page = new Page($total,20); $sql = "select * from liuyan where Sender='$sender' or Recever='$Recever' ".$page->limit; $result = $db->Query($sql); foreach($result as $v)
{
}
?>
<br />
<div><a href="fabuxinxi.php">返回</a></div>
<br />
<table width="50%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>发送人</td>
<td>接收人</td>
<td>发送时间</td>
<td>信息内容</td>
</tr>
<?php
foreach($result as $v)
{
echo "<tr><td>$v[1]</td><td>$v[2]</td><td>$v[3]</td><td>$v[4]</td></tr>";
}
?>
</table>
<?php
echo $page->fpage();//显示表格下方的数据和页面的信息。
if(empty($_SESSION["views"]))
{
header("location:denglu.php");
exit;
}
?>
</body>
</html>
7.tuichuchuli.php 退出系统,清空session。
<?php
session_start(); unset($_SESSION); session_destroy(); header("location:denglu.php");
PHP练习4 留言板的更多相关文章
- AngularJs学习笔记(制作留言板)
原文地址:http://www.jmingzi.cn/?post=13 初学Anjularjs两天了,一边学一边写的留言板,只有一级回复嵌套.演示地址 这里总结一下学习的过程和笔记.另外,看看这篇文章 ...
- dd——留言板再加验证码功能
1.找到后台-核心-频道模型-自定义表单 2.然后点击增加新的自定义表单 diyid 这个,不管他,默认就好 自定义表单名称 这个的话,比如你要加个留言板还是投诉建议?写上去呗 数据表 这个不要碰, ...
- asp.net留言板项目源代码下载
HoverTree是一个asp.net开源项目,实现了留言板功能. 前台体验网址:http://hovertree.com/guestbook/ 后台请下载源代码安装. 默认用户名:keleyi 默认 ...
- html的留言板制作(js)
这次留言板运用到了最基础的localstorage的本地存储,展现的效果主要有: 1.编写留言2.留言前可以编辑自己的留言昵称.不足之处: 1.未能做出我喜欢的类似于网易的叠楼功能. 2.未能显示评论 ...
- 11月8日PHP练习《留言板》
一.要求 二.示例页面 三.网页代码及网页显示 1.denglu.php 登录页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran ...
- [课程设计]Scrum 3.7 多鱼点餐系统开发进度(留言板选择方案)
Scrum 3.7 多鱼点餐系统开发进度(留言板选择方案) 1.团队名称:重案组 2.团队目标:长期经营,积累客户充分准备,伺机而行 3.团队口号:矢志不渝,追求完美 4.团队选题:餐厅到店点餐系统W ...
- [课程设计]Scrum 3.6 多鱼点餐系统开发进度(用户测试反馈页面构思&留言板设计)
Scrum 3.6 多鱼点餐系统开发进度(用户测试反馈页面构思&留言板设计) 1.团队名称:重案组 2.团队目标:长期经营,积累客户充分准备,伺机而行 3.团队口号:矢志不渝,追求完美 4.团 ...
- 用 Express4 写一个简单的留言板
Knowledge Dependence:阅读文本前,你需要熟悉 Node.js 编程.Express 以及相关工具和常用中间件的使用. Node.js 以其单线程异步非阻塞的特点,越来越被广大的 W ...
- 个人网页的留言板实现与sae的数据库账户配置
个人网页(github)的留言板终于搞定了.总之后端的东西不会写,只有修改以前教程里面的文件.记录一下重要的过程. 使用了留言保存的send()函数,模版有注册登录功能.根据需求修改了一下,去掉了登录 ...
- jsp中运用application实现共享留言板功能
jsp中application的知识点总结: 1.一个Web应用程序启动后,将会自动创建一个application对象,在整个应用程序的运行过程中只有这一个application对象,即所有访问该网站 ...
随机推荐
- com技术学习
百度百科概念 COM是微软公司为了计算机工业的软件生产更加符合人类的行为方式开发的一种新的软件开发技术.在COM构架下,人们可以开发出各种各样的功能专一的组件,然后将它们按照需要组合起来,构成复杂的应 ...
- lintcode-142-O(1)时间检测2的幂次
142-O(1)时间检测2的幂次 用 O(1) 时间检测整数 n 是否是 2 的幂次. 样例 n=4,返回 true; n=5,返回 false. 挑战 O(1) time 标签 比特位操作 思路 使 ...
- iOS- 如何将非ARC的项目转换成ARC项目(实战)
1.前言 因为公司有个国外餐饮系统,编程开发了3-4年,之前用的都是非ARC,开发到今年,第一批迭代开发的人员早已不见,目前发现了有许多的内存泄露之类的,系统没有自动释放该释放的内存.一旦app长 ...
- 百度安卓sdk开发
一 key问题 1 在百度地图api控制台申请key的流程主要用到了app包,开发工具的开发sha1和发布sha1值,这2个值的获取就非常关键了. 一般来说我们都是在windows上开发安卓,使用an ...
- eclipse 创建并运行maven web项目
这两天想在eclipse上运行maven web项目,折腾了许久,总算success啦. 1,利用eclipse创建dynamic web project(eclipse需要安装m2eclipse). ...
- 解决ueditor编辑器图片在线管理图片无法显示
使用ueditor,点击在线管理,服务器图片路径显示不正确,如下图所示 查看源码,如下: 发现图片src中中间多了一长串的项目跟路径,解决的办法是 把 jsp/controller.jsp 里面 ...
- Linux服务器记录并查询历史操作记录
Linux服务器在使用过程中,经常会有除自己之外的其他人员使用.并不是每个人都对Linux服务器特别熟悉,难免会有一些操作导致服务器报错. 因此,监控Linux服务器的操作并记录下来,是非常有必要的! ...
- PHP查询网站
1.w3school http://www.w3school.com.cn/php/ 2.PHP官网 http://php.net/manual/en/funcref.php 3.国内的类似w3csh ...
- SpringBoot2.0(一) mybatis
使用mybatis springboot使用mybatis主要依赖 mybatis-spring-boot-starter 来实现.其提供了2中解决方案,一种是使用注解:另一种是简化后的传统的xml方 ...
- Go语言【第一篇】:Go初识
Go语言特色 简洁.快速.安全 并行.有趣.开源 内存管理.数据安全.编译迅速 Go语言用途 Go语言被设计成一门应用于搭载Web服务器,存储集群或类似用途的巨型中央服务器的系统编程语言.对于高性能分 ...