diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-17 15:07:29 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-17 15:07:29 +0000 |
| commit | 21d731eb94bd0091958f71f108edc59354055ac8 (patch) | |
| tree | 806d8842558ba36fd5776791803021e453eba686 /frontends/php/include/validate.inc.php | |
| parent | 689ee09f415938dc164e6b0cf4f114bdb17d698f (diff) | |
- added validate.inc.php (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2533 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/validate.inc.php')
| -rw-r--r-- | frontends/php/include/validate.inc.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php new file mode 100644 index 00000000..ce1c6cc3 --- /dev/null +++ b/frontends/php/include/validate.inc.php @@ -0,0 +1,69 @@ +<?php +/* +** ZABBIX +** Copyright (C) 2000-2006 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ +?> +<?php + function check_var($var,$checks) + { + global $_REQUEST; + + $ret = 1; + + foreach($checks as $field=>$check) + { + if(is_int($key)) + { + $op=$check[0]; + $val=$check[$op]; + + echo "ZZZ"; + echo isset($check["min"]); + } + else + { + if(isset($_REQUEST[$var])) + { + if(($check == T_ZBX_INT)&&(!is_int($_REQUEST[$var]))) + break; + if( ($check == T_ZBX_FLOAT)&&(!is_float($_REQUEST[$var]))) + break; + if($check == T_ZBX_PERIOD) + break; + if( ($check == V_NOT_EMPTY)&&($_REQUEST[$var]=="")) + break; + } + } + } + + return $ret; + } + + function check_fields($fields) + { + global $_REQUEST; + + $ret = 1; + + foreach($fields as $field => $checks) + { + list($type,$opt,$table,$field,$validation,$exception)=$checks; + } + return $ret; + } +?> |
