Hello all.
I am starting to work on a URL "cleaner" of sorts. The code below is only
checking
for a few simple entries on the URL, but for some reason it is not replacing
them
with "" when found.
$qs and $clean_qs produce the same results.
Also, can someone who is fluent with regex stuff take a look at my
eregi expressions ? Im not sure if this is the most efficient way of
searching
through the URL for a match.
$qs = $PHP_SELF . "?" . $HTTP_SERVER_VA RS['QUERY_STRING'];
$urlcheck = array (
"%20OR%20",
"--",
"xp_cmdshel l"
);
$urlclean = array (
"",
"",
""
);
$badurl = 0;
while (list ($key, $val) = each ($urlcheck)) {
if (eregi($val, $qs)) {
$badurl = 1;
}
}
$clean_qs = eregi_replace ($urlcheck, $urlclean, $qs);
echo $qs;
echo "<br>";
echo $clean_qs;
Many thanks all.
I am starting to work on a URL "cleaner" of sorts. The code below is only
checking
for a few simple entries on the URL, but for some reason it is not replacing
them
with "" when found.
$qs and $clean_qs produce the same results.
Also, can someone who is fluent with regex stuff take a look at my
eregi expressions ? Im not sure if this is the most efficient way of
searching
through the URL for a match.
$qs = $PHP_SELF . "?" . $HTTP_SERVER_VA RS['QUERY_STRING'];
$urlcheck = array (
"%20OR%20",
"--",
"xp_cmdshel l"
);
$urlclean = array (
"",
"",
""
);
$badurl = 0;
while (list ($key, $val) = each ($urlcheck)) {
if (eregi($val, $qs)) {
$badurl = 1;
}
}
$clean_qs = eregi_replace ($urlcheck, $urlclean, $qs);
echo $qs;
echo "<br>";
echo $clean_qs;
Many thanks all.
Comment