name=='')$pid=0; $pandp=$pandps[$pid]; return array('name'=>$pandp->name,'total'=>os_getPostageAndPackagingSubtotal($pandp->constraints,$total,$weight)); } function os_getPostageAndPackagingSubtotal($cstrs,$total,$weight){ foreach($cstrs as $cstr){ if($cstr->type=='total_weight_less_than_or_equal_to' && $weight<=$cstr->value)return os_getPostageAndPackagingSubtotal($cstr->constraints,$total,$weight); if($cstr->type=='total_weight_more_than_or_equal_to' && $weight>=$cstr->value)return os_getPostageAndPackagingSubtotal($cstr->constraints,$total,$weight); if($cstr->type=='total_less_than_or_equal_to' && $total<=$cstr->value)return os_getPostageAndPackagingSubtotal($cstr->constraints,$total,$weight); if($cstr->type=='total_more_than_or_equal_to' && $total>=$cstr->value)return os_getPostageAndPackagingSubtotal($cstr->constraints,$total,$weight); } $val=str_replace('weight',$weight,$cstr->value); $val=str_replace('total',$total,$val); $val=preg_replace('#[^0-9*/\-+.\(\)]#','',$val); if(preg_match('/[^0-9.]/',$val))eval('$val=('.$val.');'); return (float)$val; } if(!isset($_SESSION['postage'])){ header('Location: admin.php'); exit; } if(!isset($_SESSION['weight']))$_SESSION['weight']=2; if(!isset($_SESSION['total']))$_SESSION['total']=2; if(!isset($_SESSION['pandp']))$_SESSION['pandp']=2; if(isset($_REQUEST['weight']))$_SESSION['weight']=(float)$_REQUEST['weight']; if(isset($_REQUEST['total']))$_SESSION['total']=(float)$_REQUEST['total']; if(isset($_REQUEST['pandp']))$_SESSION['pandp']=(int)$_REQUEST['pandp']; ?>
admin page P&P = '.$pandp['total'].' ('.htmlspecialchars($pandp['name']).')'; ?>Rules: