I understand the security concerns with eval, but this is for a process that only I use and have access to (not even on the internet). Can someone please help guide me on how to make this work?
I have 4 conditions I want to test, where the conditions can vary from scenario to scenario. With that, I’ve stored them in a table. I have the following 4 records where each condition is in its own record for “scenario x”:
Code: Select all
record 1; varchar field named condition = $row_dsee['field1']==0 and $row_dsee['field2']==0
record 2; varchar field named condition = $row_dsee['field1']==0 and $row_dsee['field2']>0
record 3; varchar field named condition = $row_dsee['field1']>0 and $row_dsee['field2']==0
record 4; varchar field named condition = $row_dsee['field1']>0 and $row_dsee['field2']>0
Code: Select all
while($row_cond=mysql_fetch_array($cond)) {
$vcondition = $row_cond["condition"];
if (eval("return " . $vcondition . ";")) {
$passed++;
}
}
Any help would be greatly appreciated.
Thanks,
David