Page 1 of 1

Some error Check It

Posted: Sat Aug 16, 2003 12:08 am
by phppick
Try to run this code.


-------test.php----

<?

include_once ('httpio.inc');

$formVars = HttpPrm();
$userid = $formVars["userid"];
$password = $formVars["password"];

?>
----END test.php---



----httpio.inc--
<?

function HttpPrm( )
{
global $HTTP_GET_VARS,$HTTP_POST_VARS,$HttpPost;

if ( count($HTTP_POST_VARS) ) return ( $HTTP_POST_VARS );
if ( count($HTTP_GET_VARS) ) return ( $HTTP_GET_VARS );
return ( $HTTP_POST_VARS );
}

function HttpVar( $vKey )
{
global $HTTP_GET_VARS,$HTTP_POST_VARS,$HttpPost;

if ( count($HTTP_POST_VARS) ) return ( $HTTP_POST_VARS[$vKey] );
if ( count($HTTP_GET_VARS) ) return ( $HTTP_GET_VARS[$vkey] );
return ( $HTTP_POST_VARS[$vkey] );
}

?>

--end httpio.inc---

Posted: Sat Aug 16, 2003 11:54 am
by PixelMaster
Had no problems ...

Just a note : you don't need to declare the variables $HTTP_GET_VARS and $HTTP_POST_VARS as global. Just use $_GET and $_POST - they're superglobals, and can be used with out global declarations, anywhere, anytime. Not to mention shorter and easier to type ...

Posted: Sat Aug 16, 2003 12:14 pm
by patrikG
what's the error message you get?