当前位置: 首页>>代码示例>>PHP>>正文


PHP do_input_validation函数代码示例

本文整理汇总了PHP中do_input_validation函数的典型用法代码示例。如果您正苦于以下问题:PHP do_input_validation函数的具体用法?PHP do_input_validation怎么用?PHP do_input_validation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了do_input_validation函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sprintf

     if ($_POST['proto'] != "tcp") {
         $input_errors[] = sprintf(gettext("%s is only valid with protocol TCP."), $_POST['statetype']);
     }
     if ($_POST['statetype'] == "synproxy state" && $_POST['gateway'] != "") {
         $input_errors[] = sprintf(gettext("%s is only valid if the gateway is set to 'default'."), $_POST['statetype']);
     }
 }
 if (isset($a_filter[$id]['associated-rule-id']) === false && !(is_specialnet($_POST['srctype']) || $_POST['srctype'] == "single")) {
     $reqdfields[] = "srcmask";
     $reqdfieldsn[] = "Source bit count";
 }
 if (isset($a_filter[$id]['associated-rule-id']) === false && !(is_specialnet($_POST['dsttype']) || $_POST['dsttype'] == "single")) {
     $reqdfields[] = "dstmask";
     $reqdfieldsn[] = gettext("Destination bit count");
 }
 do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
 if (!$_POST['srcbeginport']) {
     $_POST['srcbeginport'] = 0;
     $_POST['srcendport'] = 0;
 }
 if (!$_POST['dstbeginport']) {
     $_POST['dstbeginport'] = 0;
     $_POST['dstendport'] = 0;
 }
 if ($_POST['srcbeginport'] && !is_portoralias($_POST['srcbeginport'])) {
     $input_errors[] = sprintf(gettext("%s is not a valid start source port. It must be a port alias or integer between 1 and 65535."), $_POST['srcbeginposrt']);
 }
 if ($_POST['srcendport'] && !is_portoralias($_POST['srcendport'])) {
     $input_errors[] = sprintf(gettext("%s is not a valid end source port. It must be a port alias or integer between 1 and 65535."), $_POST['srcendport']);
 }
 if ($_POST['dstbeginport'] && !is_portoralias($_POST['dstbeginport'])) {
开发者ID:rohankapoorcom,项目名称:pfsense,代码行数:31,代码来源:firewall_rules_edit.php

示例2: gettext

         $reqdfieldsn[] = gettext("Bind Password");
     }
 }
 if ($pconfig['type'] == "radius") {
     $reqdfields = explode(" ", "name type radius_host radius_srvcs");
     $reqdfieldsn = array(gettext("Descriptive name"), gettext("Type"), gettext("Hostname or IP"), gettext("Services"));
     if ($pconfig['radisu_srvcs'] == "both" || $pconfig['radisu_srvcs'] == "auth") {
         $reqdfields[] = "radius_auth_port";
         $reqdfieldsn[] = gettext("Authentication port value");
     }
     if ($id == null) {
         $reqdfields[] = "radius_secret";
         $reqdfieldsn[] = gettext("Shared Secret");
     }
 }
 do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
 if (!empty($pconfig['ldap_host']) && preg_match("/[^a-zA-Z0-9\\.\\-_]/", $pconfig['ldap_host'])) {
     $input_errors[] = gettext("The host name contains invalid characters.");
 }
 if (!empty($pconfig['radius_host']) && preg_match("/[^a-zA-Z0-9\\.\\-_]/", $pconfig['radius_host'])) {
     $input_errors[] = gettext("The host name contains invalid characters.");
 }
 if (auth_get_authserver($pconfig['name']) && !isset($id)) {
     $input_errors[] = gettext("An authentication server with the same name already exists.");
 }
 if ($pconfig['type'] == "radius" && isset($pconfig['radius_timeout']) && !empty($pconfig['radius_timeout']) && (!is_numeric($pconfig['radius_timeout']) || is_numeric($pconfig['radius_timeout']) && $pconfig['radius_timeout'] <= 0)) {
     $input_errors[] = gettext("RADIUS Timeout value must be numeric and positive.");
 }
 if (count($input_errors) == 0) {
     $server = array();
     $server['refid'] = uniqid();
开发者ID:noikiy,项目名称:core-2,代码行数:31,代码来源:system_authservers.php

示例3: unset

if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    if (isset($_POST['Cancel']) && $_POST['Cancel']) {
        header("Location: services_nfs_share.php");
        exit;
    }
    // Input validation.
    $reqdfields = explode(" ", "path");
    $reqdfieldsn = array(gettext("Path"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    foreach ($_POST['network'] as $id => $network) {
        $post_en = array('network' => $network, 'mask' => $_POST['mask'][$id]);
        $reqdfields = explode(" ", "network mask");
        $reqdfieldsn = array(gettext("Authorised network"), gettext("Network mask"));
        do_input_validation($post_en, $reqdfields, $reqdfieldsn, $input_errors);
    }
    // remove last slash and check alldirs option
    $path = $_POST['path'];
    if (strlen($path) > 1 && $path[strlen($path) - 1] == "/") {
        $path = substr($path, 0, strlen($path) - 1);
    }
    if ($path == "/") {
        // allow alldirs
    } else {
        if (isset($_POST['quiet'])) {
            // might be delayed mount
        } else {
            if (isset($_POST['alldirs']) && !ismounted_or_dataset($path)) {
                $input_errors[] = sprintf(gettext("All dirs requires mounted path, but Path %s is not mounted."), $path);
            }
开发者ID:BillTheBest,项目名称:OpenNAS,代码行数:31,代码来源:services_nfs_share_edit.php


注:本文中的do_input_validation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。