留言板实例代码

9 篇文章 2 订阅
7 篇文章 3 订阅

今天又有一波技术福利来了。也是手把手教给各位,希望得到各位喜欢。那么 它来了 它来了~~~此福利提供给初入互联网的小清新,是一整套代码,写的也比较简单,但是它是源码哦!!!是后端+前端+数据库+效果图 

 

~~~因此,如果你是大佬,想看看我写的,可以尽情浏览但是有一点不要说什么代码lol啥的、因为看清楚我的标题,谢谢配合。

 

你们知道这套代码,小清新们直接ctrl+c 以及 ctrl+v 就能使用了、想想爽不爽.....所以这里小编说喜欢的话就关注我一下,可以加文章底部微信,不懂问题可以提问哦。

 

其余话不多说,开始吧~面对疾风吧......

 

第一步:首先是登录页面:

<!DOCTYPE html><html>     <head>         <meta charset="UTF-8">         <title>留言板登录</title>         <script src="bootstrap/js/jquery-1.11.2.min.js"></script>         <script src="bootstrap/js/bootstrap.min.js"></script>         <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>     </head>     <style>         .header{             margin-left: 550px;             margin-top: 150px;             height: 300px;             max-width: 300px;         }         .xiugai{             max-width: 200px;         }         .login{             margin-top: 10px;         }</style>     <body>         <form action="messloginchuli.php" method="post">         <div class="header">             <h2>开发部内部留言板</h2>             <div class="input-group xiugai">                 <span class="input-group-addon" style="margin-top: 20px;">用户名:</span>                 <input type="text" class="form-control" name="uid" placeholder="请输入用户名">             </div>             <div class="input-group xiugai" style="margin-top: 10px;">                 <span class="input-group-addon">口令:</span>                 <input type="text" class="form-control" name="pwd" placeholder="请输入口令">             </div>             <button type="submit" class="btn btn-success login">登录</button>        </div>    </form>     </body></html>

 

 

第二步:登录页面完成后要进入登录处理页面了,也就是上面提交到的messloginchuli.php

<?phpsession_start();  // 登录之后要把所包含登录的页面连接起来,开启session$uid = $_POST["uid"];$pwd = $_POST["pwd"];require_once "./DBDA.class.php";$db = new DBDA();$sql = "select password from yuangong where username='{$uid}'";$arr = $db->query($sql,0);//var_dump($arr[0][0]);if($arr[0][0]=$pwd && !empty($pwd)){     $_SESSION["uid"]=$uid;     header("location:message.php");}?>

 

 

登录页面效果如图:

 

第三步:登录完成后是进入主页面,也就是显示自己收到的对话内容,下面是设计的数据库的表格和主页面的代码:

 

<!DOCTYPE html><html>     <head>         <meta charset="UTF-8">         <title></title>         <script src="bootstrap/js/jquery-1.11.2.min.js"></script>         <script src="bootstrap/js/bootstrap.min.js"></script>         <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>     </head>     <style>         .mess{             max-width: 800px;             margin-left: 250px;             margin-top: 150px;         }</style>     <body>         <?php         session_start();         $uid = $_SESSION["uid"];         if(empty($_SESSION["uid"])){             header("location:messlogin.php");             exit;         }         ?>         <div style="margin-left: 880px; margin-top: 50px;font-size: 20px;" >             <a href="publish_info.php" >发布信息</a>             <a href="tuichuchuli.php">退出系统</a>             </div>         <table class="table table-bordered mess" style="margin-top: -40px;">             <caption style="font-size: 20px;">                 留言信息:             </caption>                          <thead>                 <tr>                     <th>发送人</th>                     <th>发送时间</th>                     <th>接收人</th>                     <th>信息内容</th>                 </tr>             </thead>             <tbody>                 <?php                 require_once "./DBDA.class.php";                 $db = new DBDA();                 $sql = "select * from liuyan where recever='{$uid}' or recever='all'";                 $arr = $db->query($sql,0);                 foreach($arr as $v){                     echo "<tr>                     <td>{$v[1]}</td>                     <td>{$v[2]}</td>                     <td>{$v[3]}</td>                     <td>{$v[4]}</td>                 </tr>";                 }                 ?>                              </tbody>         </table>     </body></html>

 

第四步:退出登录系统实现用户注销,返回登录页面功能代码如下:

 <?phpsession_start();$uid = $_SESSION["uid"];unset($uid);header("location:messlogin.php");?>

 

 

代码写到这里,比较重要的部分就完成了,下面是要进入发布信息页面了,相当于之前写的添加的页面,其处理页面也是和之前没什么区别的,差别在于现在的处理页面是在用户登录的情况下操作的,需要用session把所有的登录情况下的页面连接起来

 

主页面效果如下图:


第五步:最后是信息发布页面,可以给任何人发送信息,代码如下:

<!DOCTYPE html><html>     <head>         <meta charset="UTF-8">         <title>发布信息界面</title>         <script src="bootstrap/js/jquery-1.11.2.min.js"></script>         <script src="bootstrap/js/bootstrap.min.js"></script>         <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>     </head>     <style>         .mess{             max-width: 200px;             margin-top: 10px;         }         .mess1{             margin-top: 10px;         }         .opt{             max-width: 200px;             margin-left: 80px;         }         .txt{             max-width: 200px;         }</style>     <body><?phpsession_start();$uid = $_SESSION["uid"];if (empty($_SESSION["uid"])) {     header("location:messlogin.php");     exit ;}?>     <div  style="margin-left: 500px; margin-top: 150px;">         <div style="margin-left: 60px; margin-bottom: 20px;font-size: 20px;" >             <a href="message.php" >查看信息</a>             <a href="seemess.php" style="margin-left: 80px;" >查看发送信息</a>             </div>         <form class="form-horizontal" role="form" action="infochuli.php" method="post">                          <div class="form-group">                     <label for="firstname" class="col-sm-2 control-label mess1">接收人:</label>                     <div class="form-group ">                         <select class="form-control opt" name="recever">                             <option value="all">所有人</option>                         <?php                                                  require_once "./DBDA.class.php";                         $db = new DBDA();           //这里可以给特定的朋友发送信息的sql语句                         //$sql = "select firend.firend,yuangong.name from firend,yuangong where firend.firend                       //= yuangong.username and firend.me = '{$uid}'";                         $sname = "select * from yuangong where username not in ('{$uid}')";                         $arr = $db->query($sname,0);                                                 //var_dump($arr[0][2]);                         foreach($arr as $v){                             echo "<option value='{$v[0]}'>{$v[2]}</option>";                         }                         ?>                         </select>                     </div>                 </div>                          <div class="form-group">                 <label for="lastname" class="col-sm-2 control-label mess1">信息内容:</label>                 <div class="col-sm-10">                     <textarea class="form-control txt" rows="3" name="content"></textarea>                 </div>             </div>             <div class="form-group">                 <div class="col-sm-offset-2 col-sm-10">                     <button type="submit" class="btn btn-default">                     发送                     </button>                 </div>             </div>         </form>     </div>     </body></html>

 

发信息页面如图:

 

 

 

第六步:发布信息完成后要进入处理页面了,也就是提交到的infochuli.php,最后返回发送信息界面

<?phpsession_start();$uid = $_SESSION["uid"];$recever = $_POST["recever"];$content = $_POST["content"];$arr = $_POST["recever"];$t = date("Y-m-d H:i:s");require_once "./DBDA.class.php";$db = new DBDA();$sql = "insert into liuyan values('','{$uid}','{$t}','{$recever}','{$content}',0)";$arr = $db->query($sql);if($arr && !empty($arr)){     header("location:publish_info.php");}else{     echo "发送失败!";}?>

到这里也就完了~~~欢迎交流WeChat:xzzs730

  • 23
    点赞
  • 123
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
Verilog是一种硬件描述语言,用于对数字电路进行建模和仿真。Verilog实例代码是指使用Verilog语言编写的代码,用来描述数字电路中的各种元件和其行为。 一个简单的Verilog实例代码可以是一个简单的门电路,比如与门或者或门。以下是一个使用Verilog语言编写的与门的实例代码: ```verilog module and_gate( input a, input b, output c ); assign c = a & b; endmodule ``` 在这个实例代码中,我们定义了一个module(模块)叫做and_gate,然后定义了三个端口:两个input端口 a 和 b,以及一个output端口 c。在module内部,我们使用assign关键字对输出端口 c 进行赋值,赋值的表达式是“a & b”,表示 c 的值等于 a 与 b 的逻辑与运算结果。 另外,Verilog实例代码也可以是更加复杂的数字电路,比如寄存器、计数器、乘法器等等。通过使用不同的Verilog语法和元件实例化,我们可以描述各种各样的数字电路。 总之,Verilog实例代码是使用Verilog语言编写的用来描述数字电路的代码,通过Verilog编译器可以将其转换成对应的逻辑门电路,从而实现数字电路的建模和仿真。 Verilog实例代码对于数字电路的设计和验证非常重要,因为它能够帮助工程师理解和调试复杂的数字系统。 Verilog实例代码更是数字电路设计的基础,掌握Verilog实例代码的编写对于数字电路设计的学习至关重要。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

八点半的Bruce丶D

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值