我正在尝试实施名为CleanTalk的在线服务,这需要我在我的老板上部署脚本。网站页面。 CleanTalk阻止垃圾邮件程序员填写网站表单和电子邮件注册字段。我仔细地按照他们的指示,但没有成功地开始工作。
如果我将脚本放在任何HTML代码之前,则页面其余部分的所有以下html都不会显示。当我把代码放在页面的末尾,然后我可以看到所有的HTML,填写表单并提交它,但没有任何经历。即使我在表单字段中使用垃圾邮件测试程序,我的CleanTalk帐户也没有记录到spambot阻止。
以下是CleanTalk提供的php代码:
<!--CLEANTALK SCRIPT-->
<?php
session_start();
require_once (dirname(__FILE__) . '../javajq/cleantalk.class.php');
// Take params from config
$config_url = 'http://moderate.cleantalk.org/api2.0/';
$auth_key = 'nere2usu5ehe'; // Set Cleantalk auth key
if (count($_POST)) {
$sender_nickname = 'John Dow';
if (isset($_POST['login']) && $_POST['login'] != '')
$sender_nickname = $_POST['login'];
$sender_email = 'stop_email@example.com';
if (isset($_POST['email']) && $_POST['email'] != '')
$sender_email = $_POST['email'];
$sender_ip = null;
if (isset($_SERVER['REMOTE_ADDR']))
$sender_ip = $_SERVER['REMOTE_ADDR'];
$js_on = 0;
if (isset($_POST['js_on']) && $_POST['js_on'] == date("Y"))
$js_on = 1;
$message = null;
if (isset($_POST['message']) && $_POST['message'] != '')
$message = $_POST['message'];
// The facility in which to store the query parameters
$ct_request = new CleantalkRequest();
$ct_request->auth_key = $auth_key;
$ct_request->agent = 'php-api';
$ct_request->sender_email = $sender_email;
$ct_request->sender_ip = $sender_ip;
$ct_request->sender_nickname = $sender_nickname;
$ct_request->js_on = $js_on;
$ct_request->message = $message;
$ct_request->submit_time = time() - (int) $_SESSION['ct_submit_time'];
//Additional parameters. You could the description at the bottom of the page.
$ct = new Cleantalk();
$ct->server_url = $config_url;
// Check
$ct_result = $ct->isAllowMessage($ct_request);
if ($ct_result->allow == 1) {
echo 'Message allowed. Reason ' . $ct_result->comment;
} else {
echo 'Message forbidden. Reason ' . $ct_result->comment;
}
echo '<br /><br />';
}
else
{
$_SESSION['ct_submit_time'] = time();
}
?>
<!--CLEANTALK SCRIPT-->
这是我需要添加的CleanTalk代码的html表单代码:
<!--CONTACT FORM-->
<form action="form.php" method="post" name="contact form" style="padding-bottom: 55px;">
<br>
<input class="formstyle round bgcolor purpleb" style="width: 631px;" type="text" name='name' placeholder="Full Name" required><br>
<!-- ADDED value="" TO THE EMAIL SECTION.-->
<input class="formstyle round bgcolor purpleb" type="email" name='email' required placeholder="Email" value="" style="float: left; width: 295px; margin-right: 15px;">
<input class="formstyle round bgcolor purpleb" type="tel" name='tel' required placeholder="Phone" style="float: left; width: 295px;"> <br>
<textarea class="formstyle round bgcolor purpleb messagebox" type="text" name='message' required style="height: 160px;" placeholder="Message"></textarea><br>
<input type="checkbox" id="spambot" name="spambot" value="Yes" required> <label for='spambot'><span class="parastyle grey">Yes, I'm human</span></label>
<br /><br />
<!--For Cleantalk-->
<input type="hidden" name="js_on" id="js_on" value="0" />
<input type="submit" class="purpleb round formstyle bgcolor sendform" value="SEND" name='submit' style="float:left">
<label for='submit'><a class="reco grey" href="/privacy" target="_blank"><span style="text-decoration: none; display: inline-block;"> </span>PRIVACY POLICY</a></label>
<!--For Cleantalk-->
<script type="text/javascript">
var date = new Date();
document.getElementById("js_on").value = date.getFullYear();
</script>
</form>
<!--CONTACT FORM-->
这是link to the CleanTalk API installation instructions。如果您还有其他需要,请告诉我。
以下是我收到的错误消息:
警告:session_start():无法发送会话缓存限制器 - 已发送的标头(输出开始于/hermes/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact/index2.php:19)/ hermes第72行/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact/index2.php
警告:require_once(/hermes/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact ../ javajq / cleantalk.class.php):无法打开流:/ hermes中没有此类文件或目录第73行/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact/index2.php
致命错误:require_once():无法打开所需&#39; /hermes/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact ../javajq/cleantalk.class.php' (include_path =&#39;。:/ usr / local / lib / php-5.5.22-amd64 / lib / php&#39;)/hermes/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact第73行/index2.php