Am trying to pass the command to another check in the script. The Variable is passed from the URL.
. My issus is that when the Variable is matched, then I pass the command "eregi" to the next check in the script and that works fine.
Now if the same variable does not match, then I send the command "!eregi" to the next check and that fails. Any ideas how to pass !eregi to the command and why does it fail ?
<?
$ans = "ftp";
echo $_GET['bg'] ;
echo "<br>";
if ( eregi( 'ftp', $_GET['bg'] ))
{
$cmd = "eregi" ;
echo "$cmd";
echo "<br>";
}
else {
$cmd = "!eregi" ;
echo "$cmd";
echo "<br>";
}
if ($cmd('ftp', $ans)) <--This is not working when $cmd is !eregi
{
echo "matched";
} else {
echo "not matched";
}
?>