title: jQuery Real Person - always fails
body: <p>No matter what I type in (even the correct captcha), I always get missmatched output. I've tried echoing the values (they are supposed to match if you type in the right code). and I always get something like this:</p>
  
  <p>6952304285049<br/>
  -1247767175</p>
  
  <ul>
  <li>I am using jquery-1.10.2.min.js (and have this linked in my header along with the realperson.js file)
  <a href="http://gfishdesigns.com/COMP2920/_COMPLETED/Assignment%202/SignUp.php" rel="noreferrer">http://gfishdesigns.com/COMP2920/_COMPLETED/Assignment%202/SignUp.php</a></li>
  </ul>
  
  <p>Here's my code (im doing some other validating as well):</p>
  
  <pre><code>&lt;?php
  include 'Header.php';
  include 'Database.php';
  ?&gt;
  &lt;script type="text/javascript"&gt;
      $(function() {
          $('#defaultReal').realperson();
      });
  &lt;/script&gt;
  
  &lt;h1&gt;Sign Up&lt;/h1&gt;
  
  &lt;?php
  
  if ($_POST){
  
      $username = $_POST['username'];
      $password = $_POST['password'];
      $check = '';
  
      //validate CAPTCHA
      function rpHash($value) { 
          $hash = 5381; 
          $value = strtoupper($value); 
          for($i = 0; $i &lt; strlen($value); $i++) { 
          $hash = (($hash &lt;&lt; 5) + $hash) + ord(substr($value, $i)); 
          } 
          return $hash; 
      } 
        if (rpHash($_POST['defaultReal']) == $_POST['defaultRealHash']) { ?&gt;
          &lt;p class="accepted"&gt;You have entered the "real person" value correctly and the form has been processed.&lt;/p&gt;
  &lt;?php 
  
      //if username is not blank
      if($username != ''){
  
          //check if username exists already
          $query = "SELECT username FROM tbl_user;";
          $result = mysql_query($query) or die(mysql_error());
          while ($record = mysql_fetch_row($result))
          {
              foreach($record as $field)
              {
                  if($field == $username){
                      //if user exists, dont let them add same user
                      $error_message_username = 'username already used; choose a unique name';
                  }
                  else{
                      $check = 'pass';
                  }
              }
          }   
      }else{
          $error_message_username = 'username cannot be blank';
      }
  
      //if password is not blank
      if($password != ''){    
          $error_message_password = '';
  
          // encrypt password
          $encrypted_password = md5($password);   
  
          if($check == 'pass'){
              //set username and password into database
              $query = "INSERT INTO tbl_user VALUES('','".$username."','".$encrypted_password."');";
              $result = mysql_query($query) or die(mysql_error());
          }
      }else{
          $error_message_password = 'password cannot be blank';
      }
  
  
  
      } else { ?&gt;
              &lt;p class="rejected"&gt;You have NOT entered the CAPTCHA value correctly and the form has been rejected.&lt;/p&gt;
      &lt;?php 
  echo rpHash($_POST['defaultReal']) . '&lt;br/&gt;';
  echo $_POST['defaultRealHash'];
  
  }
  
  }    
  
  ?&gt;
  
  &lt;form method="post" action="SignUp.php"&gt;
    &lt;p&gt;
      E-Mail:
      &lt;input type="text" class="required email" id="username" name="username"&gt;
      &lt;?php 
      if ( $error_message_username != '' ) {
          print "$error_message_username";
      }
      ?&gt;
    &lt;/p&gt;
    &lt;p&gt;
      Password:
      &lt;input type="text" name="password"&gt;
              &lt;?php 
      if ( $error_message_password != '' ) {
          print "$error_message_password";
      }
      ?&gt;
    &lt;/p&gt;
    &lt;p&gt;
      CAPTCHA:
      &lt;input type="text" id="defaultReal" name="defaultReal"&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;button class="mybutton" type="submit" value="Sign Up"&gt;Sign Up&lt;/button&gt;
    &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>