Pbootcms留言防护代码
MessageController.php在此代码之上放下面的代码即可 $status = $this->config('message_verify') === '0' ? 1 : 0;//屏蔽关键字提交 2023.2.24$filter_keyword = ['http','https','www','seo','site'];foreach($filter_keyword as $val){if(
原理:按关键词屏蔽提交留言,只要留言内容出现指定关键词则无法提交留言。
MessageController.php
在此代码之上放下面的代码即可 $status = $this->config('message_verify') === '0' ? 1 : 0;
//屏蔽关键字提交 2023.2.24
$filter_keyword = ['http','https','www','seo','site'];
foreach($filter_keyword as $val){
if(strripos(' '.$data['pmessage'],$val)){
alert_back('Unable to submit, please change other contact information!');
}
}
//end
注意pmessage换成对应的留言内容字段。