// 10-29-2000
//
// I used the same object name as the similar program
written
// by David Sklar at http://px.sklar.com/code.html?code_id=15
// I couldn't get his to work for array data for
some reason and
// his variable names were sort of abstract for my
tastes, so
// I developed this one. It also strips tags,
and this code is based
// upon some stuff I found at the php.net site by:
// tomjr@tx3.net
// jkeppens@xs4all.be
// dsalada@adventassociates.com
// so it is not totally my doing. I hope it
is useful to you. Basically,
// calling it will
// make hidden tags for any post, get, or cookie
data that it passed
// to the php script that calls it. It strips
the tags of the values that
// it puts into the hidden fields, but it does not
strip the tags of the
// variables that PHP creates for you from the HTTP_POST_VARS
and so forth.
// I haven't tested the get and cookie stuff yet,
but it probably works.
//
// Jonathan Barlow - jon@barlownet.com
// BARLOWnet.com - Custom Web Applications Development
// Send resumes and business plans to me, I'm
always interested in
// PHP programmers for freelance stuff or interesting
projects.
class c_HiddenVars {
function post()
{
global $HTTP_POST_VARS;
if(is_array($HTTP_POST_VARS))
{
reset($HTTP_POST_VARS);
while (list($key, $val) = each($HTTP_POST_VARS))
{
if (is_array($val))
{
while (list($akey,$aval)
= each($val))
{
$HTTP_POST_VARS[$key][$akey]
= strip_tags($aval);
echo "<input type=hidden
name=\"$key" . "[" . $akey . "]\"" . " value=\"".htmlspecialchars($HTTP_POST_VARS[$key][$akey])."\">\n";
}
}
else
{
$HTTP_POST_VARS[$key] =
strip_tags($val);
echo "<input type=hidden
name=\"$key\" value=\"".htmlspecialchars($HTTP_POST_VARS[$key])."\">\n";
}
}
}
}
function get()
{
if(is_array($HTTP_GET_VARS))
{
reset($HTTP_GET_VARS);
while (list($key, $val) = each($HTTP_GET_VARS))
{
if (is_array($val))
{
while (list($akey,$aval)
= each($val))
{
$HTTP_GET_VARS[$key][$akey]
= strip_tags($aval);
echo "<input type=hidden
name=\"$key" . "[" . $akey . "]\"" . " value=\"".htmlspecialchars($HTTP_POST_VARS[$key][$akey])."\">\n";
}
}
else
{
$HTTP_GET_VARS[$key] = strip_tags($val);
echo "<input type=hidden
name=\"$key\" value=\"".htmlspecialchars($HTTP_POST_VARS[$key])."\">\n";
}
}
}
}
function cookie()
{
if(is_array($HTTP_COOKIE_VARS))
{
reset($HTTP_COOKIE_VARS);
while (list($key, $val) = each($HTTP_COOKIE_VARS))
{
if (is_array($val))
{
while (list($akey,$aval)
= each($val))
{
$HTTP_COOKIE_VARS[$key][$akey]
= strip_tags($aval);
echo "<input type=hidden
name=\"$key" . "[" . $akey . "]\"" . " value=\"".htmlspecialchars($HTTP_POST_VARS[$key][$akey])."\">\n";
}
}
else
{
$HTTP_COOKIE_VARS[$key]
= strip_tags($val);
echo "<input type=hidden
name=\"$key\" value=\"".htmlspecialchars($HTTP_POST_VARS[$key])."\">\n";
}
}
}
}
};
?>