CopyCode The Code is as follows: // define constanets for input reading
Define ('input _ get', 0x0101 );
Define ('input _ Post', 0x0102 );
Define ('input _ GPC ', 0x0103 );
/**
* Read input value and convert it for internal use
* Performs stripslashes () and charset conversion if necessary
*
* @ Param string field name to read
* @ Param int source to get value from (GPC)
* @ Param Boolean allow HTML tags in Field Value
* @ Param string charset to convert
* @ Return string field value or null if not available
*/
Function get_input_value ($ fname, $ source, $ allow_html = false, $ charset = NULL ){
$ Value = NULL;
If ($ source = input_get & isset ($ _ Get [$ fname])
$ Value = $ _ Get [$ fname];
Else if ($ source = input_post & isset ($ _ post [$ fname])
$ Value = $ _ post [$ fname];
Else if ($ source = input_gpc ){
If (isset ($ _ post [$ fname])
$ Value = $ _ post [$ fname];
Else if (isset ($ _ Get [$ fname])
$ Value = $ _ Get [$ fname];
Else if (isset ($ _ cookie [$ fname])
$ Value = $ _ cookie [$ fname];
}
If (empty ($ value ))
Return $ value;
// Strip single quotes if magic_quotes_sybase is enabled
If (ini_get ('Magic _ quotes_sybase '))
$ Value = str_replace ("'' "," '", $ value );
// Strip slashes if magic_quotes Enabled
Else if (get_magic_quotes_gpc () | get_magic_quotes_runtime ())
$ Value = stripslashes ($ value );
// Remove HTML tags if not allowed
If (! $ Allow_html)
$ Value = strip_tags ($ value );
// Convert to internal charset
Return $ value;
}
usage: get_input_value ('_ uid', input_get)