内容目录
一、详细介绍
最新在线留言板系统PHP源码
一款基于PHP 7.0+开发的开源在线留言板源代码,旨在为用户提供简洁、易用且功能丰富的留言交互体验。其界面基于Bootstrap 5构建,支持响应式设计,能够适应不同设备的屏幕尺寸。程序采用POST方法提交数据,并提供了一个简易的后台管理系统,用户可以通过该后台修改网站标题、删除留言等操作。本程序依赖于Bootstrap 5.3 CSS/JS、Bootstrap Icons以及PHP 7.0+环境运行。
后台登录地址:你的域名/admin
默认密码:123456
二、效果展示
1.部分代码
代码如下(示例):
php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !isset($_POST['login'])) {
// 写入留言姓名、标题、内容和邮箱
// 过滤输入数据
$name = trim(htmlspecialchars($_POST['name'], ENT_QUOTES, 'UTF-8'));
if ($config['site_title'])
$title = trim(htmlspecialchars($_POST['title'], ENT_QUOTES, 'UTF-8'));
$content = trim(htmlspecialchars($_POST['content'], ENT_QUOTES, 'UTF-8'));
$user_email = trim(htmlspecialchars($_POST['user_email'], ENT_QUOTES, 'UTF-8'));
// 对输入的留言内容进行违规词判断
// 验证所有字段非空
$errors = [];
if (empty($name)) $errors[] = "姓名不能为空";
//当后台允许用户留言标题时
if ($config['site_title'])
if (empty($title)) $errors[] = "标题不能为空";
if (empty($content)) $errors[] = "内容不能为空";
if (isset($config['site_user_email']) && $config['site_user_email']) { // 当后台允许用户留言邮箱时
if (empty($user_email)) $errors[] = "邮箱不能为空";
}
// 调用违禁词函数
if (hasForbiddenWords($content, $forbiddenWords)) {
echo "内容包含违禁词!";
exit;
} else {
2.效果图展示


