まあ、私は実際には非常に単純な解決策で多くの成功を収めてきました.
CSS クラスを作成します。
.magic /* Call it whatever you want
{
display: none;
}
フォームに次のようなものを挿入します。
<form method="post" action="">
<p>
<label>Name</label>
<input type="text" name="name">
<p>
<!-- and the magic -->
<p class="magic">
<input type="text" name="email"> <!-- spam bots LOVES 'email' fields ;) -->
</p>
<!-- /end magic -->
<p>
<label>Real E-mail input field</label>
<input type="text" name="some_email">
</p>
</form>
コントローラーでは、次のようなことができます。
...
public function create_post()
{
$this->form_validation... // If you use form validation
[...]
// If all regular validations are true, do the last bit
if( $this->input->post('email') == "" ) //If something is in the 'email' field, it has propbably been filled by a bot, because regular users can't see the field.
{
$this->your_model->insert_the_post($data);
}
// otherwise, pretend like nothing.
}
あなたのユーザーはこれを見ることはありません - そしてこれは私を数年間スパムから守ってきました. シンプルですが効果的です。