aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/functions.inc.php
diff options
context:
space:
mode:
authorPim van den Berg2010-01-01 19:36:31 +0100
committerPim van den Berg2010-01-01 19:36:31 +0100
commitbc31ed0e4647a568a1596cc2e09664675479a70d (patch)
tree9670e334534e18a9588e18d3feabbcb3a67e734e /inc/functions.inc.php
parentadd swap_io support (diff)
downloadapt-panopticon_cgp-bc31ed0e4647a568a1596cc2e09664675479a70d.zip
apt-panopticon_cgp-bc31ed0e4647a568a1596cc2e09664675479a70d.tar.gz
apt-panopticon_cgp-bc31ed0e4647a568a1596cc2e09664675479a70d.tar.bz2
apt-panopticon_cgp-bc31ed0e4647a568a1596cc2e09664675479a70d.tar.xz
better validation of possible user input (get)
Diffstat (limited to '')
-rw-r--r--inc/functions.inc.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/inc/functions.inc.php b/inc/functions.inc.php
new file mode 100644
index 0000000..2906530
--- /dev/null
+++ b/inc/functions.inc.php
@@ -0,0 +1,27 @@
1<?php
2
3# global functions
4
5function validate_get($value, $type) {
6 switch($type) {
7 case 'host':
8 if (!preg_match('/^[\d\w\W]+$/', $value))
9 return NULL;
10 break;
11 case 'plugin':
12 case 'type':
13 if (!preg_match('/^\w+$/', $value))
14 return NULL;
15 break;
16 case 'pinstance':
17 case 'tinstance':
18 if (!preg_match('/^[\d\w-]+$/', $value))
19 return NULL;
20 break;
21 }
22
23 return $value;
24}
25
26
27?>