Guest User

Untitled

a guest
Jan 20th, 2012
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. // validate editable fields
  2. $editable_fields = array("customerid"=>"is_int",
  3.                          "project"=>"is_string",
  4.                          "fixedquote"=>"is_string",
  5.                          "quoteamount"=>"is_numeric",
  6.                          "quotehours"=>"is_int",
  7.                          "active"=>"is_int");
  8.  
  9. // is it an editable field?
  10. if (isset($editable_fields[$_POST['field']])) {
  11.     // is the value valid?
  12.     if (eval("return ".$editable_fields[$_POST['field']]."('".addslashes($_POST['value'])."');")) {
  13.         /* ... do stuff ... */
  14.     } else {
  15.         /* error about not being the right type of data */
  16.     }
  17. } else {
  18.     /* error about not being an editable field */
  19. }
Advertisement
Add Comment
Please, Sign In to add comment