Java 实现CleanTalk的问题

Java 实现CleanTalk的问题,java,php,html,forms,Java,Php,Html,Forms,我正在尝试实现一个名为CleanTalk的在线服务,它要求我在老板的网页上部署脚本。CleanTalk防止垃圾邮件者填写网站表单和电子邮件注册字段。我仔细地遵照他们的指示,但没有成功地使它发挥作用 如果我将脚本放在任何HTML代码之前,页面其余部分上的所有HTML都不会显示。当我把代码放在页面的末尾时,我可以看到所有的HTML,填写表单并提交,但什么也看不到。我的CleanTalk帐户中也没有记录垃圾邮件拦截,即使我在表单字段中使用他们的垃圾邮件检测仪 以下是CleanTalk提供的php代码:

我正在尝试实现一个名为CleanTalk的在线服务,它要求我在老板的网页上部署脚本。CleanTalk防止垃圾邮件者填写网站表单和电子邮件注册字段。我仔细地遵照他们的指示,但没有成功地使它发挥作用

如果我将脚本放在任何HTML代码之前,页面其余部分上的所有HTML都不会显示。当我把代码放在页面的末尾时,我可以看到所有的HTML,填写表单并提交,但什么也看不到。我的CleanTalk帐户中也没有记录垃圾邮件拦截,即使我在表单字段中使用他们的垃圾邮件检测仪

以下是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-->

下面是我的html表单代码,以及我需要添加的CleanTalk代码:

  <!--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>&nbsp;&nbsp;&nbsp;<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;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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--> 





是的,我是人类

变量日期=新日期(); document.getElementById(“js_on”).value=date.getFullYear();
这是一本书。如果你还需要什么,请告诉我

以下是我收到的错误消息:

警告:session_start():无法在/hermes/bosnacweb01/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact/index2.php:19)的/hermes/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):无法打开流:第73行的/hermes/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact/index2.php中没有这样的文件或目录


致命错误:require_once():在第73行/hermes/bosnacweb01/bosnacweb01bh/b2702/myd.bkholodov/public_html/webservice2/contact../javajq/cleantalk.class.php(include_path=.:/usr/local/lib/php-5.5.22-amd64/lib/php)中打开失败

“我仔细地遵循了他们的指示,但没有成功地让它发挥作用。“.你能说得更具体些吗?发生了什么事?什么不起作用?您在日志中看到了任何错误吗?@mhvelplund谢谢您的提问,我用更多信息编辑了我的问题。@ficuscr谢谢您的提问,我用更多信息修改了问题。