• php留言板


    login.php
    <
    form action="loginchuli.php" method="post"> <div>用户名:<input type="text" name="uid" /></div> <div>密码:<input type="text" name="pwd" /></div> <input type="submit" value="登录" /> </form>
    loginchuli.php
    <?php session_start(); $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; include("../DBDA.php"); $db = new DBDA(); $sql = "select count(*) from yuangong where UserName='{$uid}' and PassWord = '{$pwd}'"; $z = $db->StrQuery($sql); if($z == 1) { $_SESSION["uid"] = $uid; header("location:main.php"); } else { header("location:login.php"); }
    main.php
    <
    br /><br /> <a href="fabu.php">发布信息</a> <a href="tuichu.php">退出系统</a> <br /> <br /> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>发送人</td> <td>发送时间</td> <td>接收人</td> <td>信息内容</td> </tr> <?php session_start(); if(empty($_SESSION["uid"])) { header("location:login.php"); exit; } $uid = $_SESSION["uid"]; include("../DBDA.php"); $db = new DBDA(); $sql = "select * from liuyan where recever='{$uid}' or recever='suoyou'"; $attr = $db->Query($sql); foreach($attr as $v) { //处理发送者姓名 $sqlname = "select Name from yuangong where username='{$v[1]}'"; $name = $db->StrQuery($sqlname); //处理接收者姓名 $jieshou = ""; if($v[2]=="suoyou") { $jieshou = "所有人"; } else { $sqln = "select Name from yuangong where username='{$uid}'"; $jieshou = $db->StrQuery($sqln); } echo "<tr> <td>{$name}</td> <td>{$v[3]}</td> <td>{$jieshou}</td> <td>{$v[4]}</td> </tr>"; } ?> </table>
    <?php
    session_start();
    
    if(empty($_SESSION["uid"]))
    {
        header("location:login.php");
        exit;
    }
    
    $uid = $_SESSION["uid"];
    include("../DBDA.php");
    $db = new DBDA();
    
    ?>
    <br /><br />
    <a href="main.php">查看信息</a> <a href="tuichu.php">退出系统</a>
    
    <br />
    <h2>信息发送</h2>
    
    <form action="fschuli.php" method="post">
    <div>接收人:
        <select name="jieshou">
            <option value="suoyou">所有人</option>
            <?php
                $sql = "select firend from firend where me='{$uid}'";
                $attr = $db->Query($sql);
                
                foreach($attr as $v)
                {
                    $sqln = "select Name from yuangong where username='{$v[0]}'";
                    $name = $db->StrQuery($sqln);
                    
                    echo "<option value='{$v[0]}'>{$name}</option>";
                }
                
            ?>
        </select>
    </div>
    <br />
    <div>
        信息内容:
        <textarea name="neirong">
        </textarea>
    </div>
    <br />
    <div>
        <input type="submit" value="发送" />
        <input type="reset" value="复位" />
    </div>
    </form>
    <?php
    session_start();
    
    if(empty($_SESSION["uid"]))
    {
        header("location:login.php");
        exit;
    }
    
    $uid = $_SESSION["uid"];
    include("../DBDA.php");
    $db = new DBDA();
    
    ?>
    <br /><br />
    <a href="main.php">查看信息</a> <a href="tuichu.php">退出系统</a>
    
    <br />
    <h2>信息发送</h2>
    
    <form action="fschuli.php" method="post">
    <div>接收人:
        <select name="jieshou">
            <option value="suoyou">所有人</option>
            <?php
                $sql = "select firend from firend where me='{$uid}'";
                $attr = $db->Query($sql);
                
                foreach($attr as $v)
                {
                    $sqln = "select Name from yuangong where username='{$v[0]}'";
                    $name = $db->StrQuery($sqln);
                    
                    echo "<option value='{$v[0]}'>{$name}</option>";
                }
                
            ?>
        </select>
    </div>
    <br />
    <div>
        信息内容:
        <textarea name="neirong">
        </textarea>
    </div>
    <br />
    <div>
        <input type="submit" value="发送" />
        <input type="reset" value="复位" />
    </div>
    </form>
    fabu.php
    <?
    php session_start(); if(empty($_SESSION["uid"])) { header("location:login.php"); exit; } $uid = $_SESSION["uid"]; include("../DBDA.php"); $db = new DBDA(); ?> <br /><br /> <a href="main.php">查看信息</a> <a href="tuichu.php">退出系统</a> <br /> <h2>信息发送</h2> <form action="fschuli.php" method="post"> <div>接收人: <select name="jieshou"> <option value="suoyou">所有人</option> <?php $sql = "select firend from firend where me='{$uid}'"; $attr = $db->Query($sql); foreach($attr as $v) { $sqln = "select Name from yuangong where username='{$v[0]}'"; $name = $db->StrQuery($sqln); echo "<option value='{$v[0]}'>{$name}</option>"; } ?> </select> </div> <br /> <div> 信息内容: <textarea name="neirong"> </textarea> </div> <br /> <div> <input type="submit" value="发送" /> <input type="reset" value="复位" /> </div> </form>
    fschuli.php
    <?php session_start(); include("../DBDA.php"); $db = new DBDA(); $jieshou = $_POST["jieshou"]; $neirong = $_POST["neirong"]; $uid = $_SESSION["uid"]; $time = date("Y-m-d H:i:s"); $sql = "insert into liuyan values('','{$uid}','{$jieshou}','{$time}','{$neirong}',false)"; if($db->Query($sql,0)) { header("location:fabu.php"); } else { echo "发布失败!"; }
    tuichu.php
    <?php session_start(); unset($_SESSION["uid"]); header("location:login.php");
  • 相关阅读:
    statefulSet 原理理解
    kubernetes 集群机器重启后磁盘盘符变化
    去掉数据库外键约束
    kubernetes集群中对多个pod操作命令
    (转)怎么实时查看mysql当前连接数
    Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position
    phpfpm和nginx设置开机自动启动
    jquery ajax超时设置
    lumen中间件中设置响应header
    php支持多个地址跨域访问
  • 原文地址:https://www.cnblogs.com/mantou1314/p/5534474.html
Copyright © 2020-2023  润新知