} IF(IsSet($_POST['val1'])) {$_POST['val'] = $_POST['val1']."|".$_POST['val2']."|".$_POST['val3']."|".$_POST['val4']."|".$_POST['val5']."|".$_POST['val10'];} IF($_POST['vtype'] == "boolean" && ((boolean)$_POST['val'] != $_POST['val'])) { Die(VA_Message($err_msg_wrong_vtype, "error")); } ELSEIF($_POST['vtype'] == "int" && ((int)$_POST['val'] != $_POST['val'])) { Die(VA_Message($err_msg_wrong_vtype, "error")); } ELSEIF($_POST['vtype'] == "float" && ((float)$_POST['val'] != $_POST['val'])) { Die(VA_Message($err_msg_wrong_vtype, "error")); } ELSEIF($_POST['vtype'] == "class" && !Ereg("^([1-5]|1[0-1])|(([1-5]|1[0-1])\|([1-5]|1[0-1])\|([1-5]|1[0-1])\|([1-5]|1[0-1])\|([1-5]|1[0-1])\|([1-5]|1[0-1]))$", $_POST['val'])) { Die(VA_Message($err_msg_wrong_vtype, "error")); } $_POST['val'] = $DB_hub->Real_Escape_String($_POST['val']); $_POST['help'] = $DB_hub->Real_Escape_String($_POST['help']); IF($_POST['file'] == "defaults") {$_POST['file'] = "config";} $query = "REPLACE INTO SetupList \n"; $query .= "(file, var, val) \n"; $query .= "VALUES ('".$_POST['file']."', '".$_POST['var']."', '".$_POST['val']."')"; $DB_hub->Query($query); IF($_POST['help'] != "" && $_POST['applies'] != "" && $_POST['vtype'])
function validate_form(&$errors) { global $config, $perm, $lang_str; if (false === parent::validate_form($errors)) { return false; } if (is_array($config->denny_reg) and !$perm->have_perm("admin")) { foreach ($config->denny_reg as $val) { if (Ereg($val->reg, $_POST['ul_sip_address'])) { $errors[] = $lang_str[$val->label]; return false; } } } return true; }
FUNCTION ValidateIP($ip) { IF(Ereg("([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])", $ip)) {RETURN TRUE;} ELSE {RETURN FALSE;} }