Jump to content

skip enumeration of a value in form validation


justinh

Recommended Posts

Hi,

I have a server-side PHP script to enumerate all the values in a form submission. After these values are processed, they are pushed to another script for another purpose. Some name/value pairs are required for secondary processing and some I don't care about. I want to know how to remove the names I don't care about for the secondary processing.

 

Here is the code:

<?php	$request_method = $_SERVER["REQUEST_METHOD"];	if($request_method == "GET")	{		$query_vars = $_GET;	} 	elseif ($request_method == "POST")	{		$query_vars = $_POST;	}	reset($query_vars);	$t = date("U");	$file = $_SERVER['DOCUMENT_ROOT'] . "ssfmgdform_" . $t;	$fp = fopen($file,"w");	while (list ($key, $val) = each ($query_vars)) 	{		fputs($fp,"<GDFORM_VARIABLE NAME=$key START>rn"); 		fputs($fp,"$valrn");		fputs($fp,"<GDFORM_VARIABLE NAME=$key END>rn");		if ($key == "redirect") 		{ 			$landing_page = $val;		}	}	fclose($fp);		if ($landing_page != "")	{		header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");	} 	else 	{		header("Location: http://".$_SERVER["HTTP_HOST"]."/");	}?>

So, if I know the name ($key) I'm interested in, can I inject something like 'if $key="XYZ", skip it' so it doesn't get processed downstream? By the time I get to this point, there is a name I don't need and don't want to process.

 

I can barely walk around in this code, so I need to be spoon fed a bit. :-)

 

Thanks,

Justin

Edited by justinh
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...