一、要求

二、示例页面

三、网页代码及网页显示

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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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");

最新文章

  1. MMORPG大型游戏设计与开发(服务器 游戏场景 聊天管道和寻路器)
  2. Android Studio Eclipse Code Formatter
  3. html-javascript前端页面刷新重载的方法汇总
  4. centos6.2下安装redis和phpredis扩展,亲测好用
  5. 客户端(C#)调用CXF搭建的webservice的出现一些问题记录
  6. Windows 8.1 explorer.exe总是崩溃的解决办法
  7. ARMv8 Linux内核源代码分析:__flush_dcache_all()
  8. js导出execl兼容ie Chrome Firefox各种主流浏览器(js export execl)
  9. C#基础——集合及特殊集合
  10. 为什么阿里巴巴禁止开发人员使用isSuccess作为变量名
  11. 解决pycharm问题:module &#39;pip&#39; has no attribute &#39;main&#39;
  12. 【20171123】【GITC精华演讲】贝业新兄弟李济宏:如何做到企业信息化建设的加减乘除
  13. Python--详解Python中re.sub
  14. cc攻击和ddos攻击的区别和攻防 + 调SYN连接参数
  15. python简说(十四)内置函数
  16. Django之模型层-了解ORM
  17. [LintCode] Permutations II
  18. UVM中的factory机制实现
  19. clear(), evict(), flush()三种方法的用法实例
  20. tp配置+路由+基本操作

热门文章

  1. C++第一次课堂作业 circle
  2. LintCode-165.合并两个排序链表
  3. iOS开发应用程序生命周期
  4. 火狐浏览器(FireFox)安装Flash插件失败处理方法
  5. Django 2.0 学习(09):Django 静态文件(样式和背景图片)
  6. JS详细图解作用域链与闭包
  7. 后缀自动机SAM学习笔记
  8. [BZOJ2055] 80人环游世世界
  9. [SHOI2012]回家的路 最短路
  10. BZOJ1458 士兵占领 【带上下界网络流】