title: How to prevent users changing variables via firebug in ajax requests
body: <p>I allow my users to favorite an update or a forum topic.
  So when a user tries to favorite one of these i will send via Ajax 2 things, the item_id(update or topic) as id(ex. 1321313213) and its type("update" or "topic") as string.</p>
  
  <p>However lets say someones tries to favorite an update with the id untouched but the type is changed to "topic"(via firebug or whatever else)...</p>
  
  <p>This should not procceed since this combination is not correct... how can i assure that the item_id being sent is an update or a topic since this ID might co-exist in both tables???</p>
  
  <p><strong>Current solution:</strong></p>
  
  <p>Create a hidden input element and add as value 5 random characters (a-zA-Z0-9) and md5 type name(update or topic)</p>
  
  <p>like:</p>
  
  <pre><code>$random_str = $this-&gt;my_model-&gt;generateRandomString(5);
  &lt;input type="hidden" value="&lt;?php echo $random_str.md5("update"); ?&gt;" id="type" /&gt;
  </code></pre>
  
  <p>so when i try to validate the data to check if it is an update or topic i split the type on the first 5 characters and later and check if the later characters are md5 hashed are update or topic and continue validation</p>
  
  <p>I would like some help in case this can be altered as well...</p>