小丁的屋舍
PHP留言板实战
2020-02-15
查看标签
1830次浏览
<?php 
$text = $_POST["text"];
$name = $_POST["name"];

//数据检测
function post( $text ){
if ($text === "") {
return false;
}
$not = ["习平","fuck","233"];
foreach ($not as $user) {
    if ($text === $user) {
       return false;
    }
    }
return false;
}

//调回函数,检查内容
$chak = post( $text );
if ($chak === false) {
    die("总得输入点什么留言内容吧!");
}
//调回函数,检查昵称
$chak = post( $name );
if ($chak == false) {
die("难道你是无名氏?");
}
echo "留言内容:" . $text;
echo "</br>";
echo "留言人:" . $name;
?>
留下足迹请遵守法律规则哦~
123
February 15th, 2020 at 07:54 pm123
February 15th, 2020 at 07:54 pm

123

访客
冷瞳
February 15th, 2020 at 02:27 pm冷瞳
February 15th, 2020 at 02:27 pm

挺好 ヾ(≧∇≦*)ゝ

访客