title: PHP contact avoid Spam
body: <p>In this question I will take 2 parts of my problem.</p>
  
  <p><strong>PART 1:</strong></p>
  
  <p>I have a php + javascript validator form that sends an e-mail to my client if right rand numbers (generated by php) are validated by javascript.
  So far so good...
  The problem is that rand numbers are not sufficient to avoid SPAM (in fact, my client receives approx 20 per day e-mails by fake Adidas campaign). So, my idea comes from getting a rand number + 10 (forcing user to solve the calculation).</p>
  
  <p><strong>PART 2:</strong></p>
  
  <p>I am not preety sure what is the best way to solve this, but I think in this 3 options:</p>
  
  <ol>
  <li>Sum rand number inside php variable;</li>
  <li>Read rand number in javascript and sum 10 inside javascript;</li>
  <li>Read rand number generated by <code>php</code> and sum another rand number.</li>
  </ol>
  
  <hr>
  
  <h2><strong>Here is my code, without sum:</strong></h2>
  
  <p><em><strong>PHP</em></strong></p>
  
  <pre><code>$ran_num = rand(0,9999);
  $exclude_check = "valid";
  </code></pre>
  
  <p><em><strong>JAVASCRIPT</em></strong></p>
  
  <pre><code>if (document.getElementById("spambox").value != "&lt;?php echo $ran_num ?&gt;") {
  alert('&lt;?php echo $spamerror_s5_qc ?&gt;');
  return false;
  }
  </code></pre>