title: Blind SQL Injection using acunetix
body: <p>I'm using acunetix to test my website. The problem is with this script <a href="http://boedesign.com/blog/2007/02/18/ajax-star-rating/" rel="nofollow noreferrer">http://boedesign.com/blog/2007/02/18/ajax-star-rating/</a></p>
  <p>acunetix doesn't show any message, but when I test for blind SQL I can get values like</p>
  <pre><code>8 and 1=0 --
  8 and 31337-31337=0
  </code></pre>
  <p>in the rating_id mysql column, I want to only allow numbers in there, so I made a little fix but since the first number is 8 its passing trough the if. how can I fix it? It's something like this at includes/rating_process.php</p>
  <pre><code>// IF JAVASCRIPT IS ENABLED
  if($_POST){
  $id = escape($_POST['id']);
  $rating = (int) $_POST['rating'];
   
  if($rating &lt;= 5 &amp;&amp; $rating &gt;= 1 &amp;&amp; $id &gt;= 1 &amp;&amp; $id &lt;=9999999){
   
  if(@mysql_fetch_assoc(mysql_query(&quot;SELECT id FROM ratings WHERE IP = '&quot;.$_SERVER['REMOTE_ADDR'].&quot;' AND rating_id = '$id'&quot;)) || isset($_COOKIE['has_voted_'.$id])){
    
  echo 'already_voted';  
  } else {
  </code></pre>
  <p>and almost the same think at the &quot;// IF JAVASCRIPT IS DISABLED&quot;</p>