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


PHP filter_input函数代码示例

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


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

示例1: searchSend

 public function searchSend()
 {
     $weather = new \Models\Weather();
     if (isset($_POST["day"]) && isset($_POST["month"]) && isset($_POST["year"]) && isset($_POST["type"])) {
         $day = htmlspecialchars(filter_input(INPUT_POST, 'day', FILTER_SANITIZE_NUMBER_INT));
         $month = htmlspecialchars(filter_input(INPUT_POST, 'month', FILTER_SANITIZE_NUMBER_INT));
         $year = htmlspecialchars(filter_input(INPUT_POST, 'year', FILTER_SANITIZE_NUMBER_INT));
         $type = htmlspecialchars(filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING));
         $date = $year . "-" . $month . "-" . $day;
         $data["response"] = $weather->getAllByTypeAndDate($type, $date);
         echo json_encode($data["response"]);
     } else {
         if (isset($_POST["month"]) && isset($_POST["year"]) && isset($_POST["type"])) {
             $month = htmlspecialchars(filter_input(INPUT_POST, 'month', FILTER_SANITIZE_NUMBER_INT));
             $year = htmlspecialchars(filter_input(INPUT_POST, 'year', FILTER_SANITIZE_NUMBER_INT));
             $type = htmlspecialchars(filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING));
             $data["response"] = $weather->getAllByTypeAndMonth($type, $month, $year, "text");
             echo json_encode($data["response"]);
         } else {
             if (isset($_POST["year"]) && isset($_POST["type"])) {
                 $year = htmlspecialchars(filter_input(INPUT_POST, 'year', FILTER_SANITIZE_NUMBER_INT));
                 $type = htmlspecialchars(filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING));
                 $data["response"] = $weather->getAllByTypeAndYear($type, $year, "text");
                 echo json_encode($data["response"]);
             }
         }
     }
 }
开发者ID:XxP1asmaxX,项目名称:MeteoColmar,代码行数:28,代码来源:Historic.php

示例2: private_core

 protected function private_core()
 {
     $this->almacen = new almacen();
     $this->clientes = new cliente();
     $this->rutas_all = new distribucion_rutas();
     $this->distribucion_clientes = new distribucion_clientes();
     //Mandamos los botones y tabs
     $this->shared_extensions();
     //Verificamos los accesos del usuario
     $this->allow_delete = $this->user->admin ? TRUE : $this->user->allow_delete_on(__CLASS__);
     $fecha_pedido = filter_input(INPUT_POST, 'fecha_pedido');
     $fecha_facturacion = filter_input(INPUT_POST, 'fecha_facturacion');
     $ruta = filter_input(INPUT_POST, 'ruta');
     $codalmacen = filter_input(INPUT_POST, 'codalmacen');
     $codcliente = filter_input(INPUT_POST, 'codcliente');
     $this->fecha_pedido = $fecha_pedido ? $fecha_pedido : \date('d-m-Y');
     $this->fecha_facturacion = $fecha_facturacion ? $fecha_facturacion : \date('d-m-Y', strtotime('+1 day'));
     $this->ruta = $ruta ? $ruta : false;
     $this->codalmacen = $codalmacen ? $codalmacen : false;
     $this->codcliente = $codcliente ? $codcliente : false;
     if ($this->codcliente) {
         $this->cliente = $this->clientes->get($this->codcliente);
         $this->cliente_nombre = $this->cliente->nombre;
     }
     $cliente = filter_input(INPUT_GET, 'buscar_cliente');
     if ($cliente) {
         $this->buscar_cliente($cliente);
     }
     $this->rutas = $this->codalmacen ? $this->rutas_all->all_rutasporalmacen($this->empresa->id, $this->codalmacen) : array();
     if ($this->ruta and $this->codalmacen) {
         $this->clientes_ruta = $this->distribucion_clientes->clientes_ruta($this->empresa->id, $this->codalmacen, $this->ruta);
     }
 }
开发者ID:joenilson,项目名称:distribucion,代码行数:33,代码来源:distribucion_venta.php

示例3: verifValue

function verifValue($bdd, $image, $montant, $idnote)
{
    $resultatRetour = false;
    //Verifie qu'un fichier est bien présent
    if (!isset($image) || !$image['error'] == 0) {
        echo 'Erreur avec le justificatif (image)';
    } else {
        if (!strtotime(nl2br(filter_input(INPUT_POST, 'date')))) {
            echo 'Erreur lors de la saisie de la Date  ';
        } else {
            if (strlen(filter_input(INPUT_POST, 'description')) > 255) {
                echo 'Description trop longue (255 caractères maximum !).';
            } else {
                if (!is_numeric($montant) || $montant > 50000 || $montant < 0) {
                    echo 'Montant incorrect, merci de mettre des . pour les centimes ex : 22.90';
                } else {
                    if (is_numeric($idnote)) {
                        $check = $bdd->prepare('SELECT * FROM note_frais WHERE statut_id = 1 AND id=:id limit 1');
                        $check->execute(array(":id" => $idnote));
                        if ($check->rowCount() != 1) {
                            echo 'Stop F12 !';
                        } else {
                            $resultatRetour = true;
                        }
                    } else {
                        $resultatRetour = true;
                    }
                }
            }
        }
    }
    return $resultatRetour;
}
开发者ID:JuanTrochez,项目名称:enote,代码行数:33,代码来源:fraisController.php

示例4: __construct

 public function __construct()
 {
     $url = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_SPECIAL_CHARS);
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     $file = ROOT . '/controller/' . $url[0] . '.class.php';
     define('METHOD', $url[1]);
     if (file_exists($file)) {
         require $file;
     } else {
         if (empty($url[0])) {
             header("Location: /article/all");
             exit;
         } else {
             require ROOT . '/controller/error.class.php';
             $controller = new Error();
             return false;
         }
     }
     $controller = new $url[0]();
     if (isset($url[2])) {
         $controller->{$url}[1]($url[2]);
     } else {
         if (isset($url[1])) {
             $controller->{$url}[1]();
         } else {
             $controller->defaultClass();
         }
     }
 }
开发者ID:barabash97,项目名称:vladicms,代码行数:30,代码来源:bootstrap.class.php

示例5: returnGoodsStatus

 public function returnGoodsStatus($i10dabd0ff3063e4a86ec016d1e108ad0fbecba80)
 {
     $i30127f0cd4894803854852241754c6b654188778 = filter_input(INPUT_POST, "notifySms");
     if ($i30127f0cd4894803854852241754c6b654188778 || !isset($i30127f0cd4894803854852241754c6b654188778)) {
         $this->hooks->returnGoodsStatus(filter_input(INPUT_POST, "return_status_id"), filter_input(INPUT_POST, "comment"), $i10dabd0ff3063e4a86ec016d1e108ad0fbecba80);
     }
 }
开发者ID:mirzavu,项目名称:clothfarm,代码行数:7,代码来源:events.php

示例6: validateInputVar

 /**
  * Фильтрует переменную, переданную методами post или get
  * @param string $name имя переменной (ключ в массиве post или get)
  * @param string $method константа метода, которым передана переменная (например 'INPUT_POST')
  * @param string $type тип переменной
  * @return mixed отфильтрованная переменная
  */
 static function validateInputVar($name, $method, $type = '')
 {
     switch ($type) {
         case 'int':
             $filter = FILTER_SANITIZE_NUMBER_INT;
             break;
         case 'str':
             $filter = FILTER_SANITIZE_STRING;
             break;
         case 'url':
             $filter = FILTER_SANITIZE_URL;
             break;
         case 'email':
             $filter = FILTER_SANITIZE_EMAIL;
             break;
         case 'html':
             $filter = 'html';
             break;
         default:
             $filter = FILTER_DEFAULT;
     }
     if (!defined($method)) {
         if (!preg_match('/^input/i', $method)) {
             $method = 'INPUT_' . strtoupper($method);
         }
     }
     $method = constant($method);
     if (filter_has_var($method, $name)) {
         if ($filter === 'html') {
             return strip_tags(filter_input($method, $name), '<a><p><b><strong><table><th><tr><td><area><article><big><br><center><dd><div><dl><dt><dir><em><embed><figure><font><hr><h1><h2><h3><h4><h5><h6><img><ol><ul><li><small><sup><sub><tt><time><tfoot><thead><tbody><u>');
         } else {
             return filter_input($method, $name, $filter);
         }
     }
 }
开发者ID:ralf000,项目名称:newshop,代码行数:42,代码来源:Validate.class.php

示例7: post_restore

 public function post_restore()
 {
     if (isset($_POST['job_id']) && isset($_POST['backup_uniqid']) && isset($_POST['_wpnonce']) && isset($_POST['method'])) {
         $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
         if (!wp_verify_nonce($nonce, 'my-wp-backup-restore-backup')) {
             wp_die(esc_html__('Nope! Security check failed!', 'my-wp-backup'));
         }
         $id = absint($_POST['job_id']);
         $uniqid = sanitize_key($_POST['backup_uniqid']);
         $method = filter_input(INPUT_POST, 'method', FILTER_SANITIZE_STRING);
         $backup = self::get($id, $uniqid);
         if (!isset($backup['duration'])) {
             add_settings_error('', '', __('Invalid backup id/uniqid.', 'my-wp-backup'));
             set_transient('settings_errors', get_settings_errors());
             wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
         }
         if (!$backup->has_archives()) {
             // No local copy and no remote copy === DEAD END.
             if (empty($backup['destinations'])) {
                 add_settings_error('', '', __('Backup files missing.', 'my-wp-backup'));
                 set_transient('settings_errors', get_settings_errors());
                 wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
             }
             if (!isset($backup['destinations'][$method])) {
                 add_settings_error('', '', sprintf(__('No backup files from %s.', 'my-wp-backup'), Job::$destinations[$method]));
                 set_transient('settings_errors', get_settings_errors());
                 wp_safe_redirect($this->admin->get_page_url('backup', array('settings-updated' => 1)));
             }
         }
         wp_schedule_single_event(time(), 'wp_backup_restore_backup', array(array($id, $uniqid, $method)));
         wp_safe_redirect($this->admin->get_page_url('backup', array('uniqid' => $uniqid, 'action' => 'viewprogress', 'id' => $id)));
     }
 }
开发者ID:guysyml,项目名称:software,代码行数:33,代码来源:Backup.php

示例8: fireAction

 public function fireAction()
 {
     $row = filter_input(INPUT_POST, 'row');
     $col = filter_input(INPUT_POST, 'col');
     $view = new \View();
     if (!$row || !$col) {
         $view->dislayJson(array('status' => 0, 'msg' => 'Invalid coordinates!'));
         return;
     }
     //fire
     $status = $this->fire($row, $col);
     $view->grid = $this->board->getGrid();
     $view->symbols = $this->getBoardSymbols();
     $view->rows = $this->getRowsNames();
     $view->cols = $this->getColsNames();
     //Get the html for the board
     ob_start();
     $view->display('Web/board');
     $html = ob_get_contents();
     ob_clean();
     $data = array('status' => 1, 'msg' => $this->getMessageByStatus($status), 'html' => $html, 'tries' => $this->board->getTries());
     $view->dislayJson($data);
     //Reset the game if it's over
     if ($this->isGameOver()) {
         $this->reset();
     }
 }
开发者ID:wildalmighty,项目名称:BattleShips,代码行数:27,代码来源:GameWEB.php

示例9: saveProcess

 private function saveProcess()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         View::setMessageFlash("danger", "Form tidak valid");
         return FALSE;
     }
     // form validation
     if (!filter_input(INPUT_POST, "form_token") || Form::isFormTokenValid(filter_input(INPUT_POST, "form_token"))) {
         View::setMessageFlash("danger", "Form tidak valid");
         return FALSE;
     }
     // required fields
     $filter = array("name" => FILTER_SANITIZE_STRING, "phone" => FILTER_SANITIZE_STRING, "address" => FILTER_SANITIZE_STRING);
     $input = filter_input_array(INPUT_POST, $filter);
     if (in_array('', $input) || in_array(NULL, $input)) {
         View::setMessageFlash("danger", "Kolom tidak boleh kosong");
         return FALSE;
     }
     // set member object
     $staff = Authentication::getUser();
     $staff->setData('name', $input['name']);
     $staff->setData('phone', $input['phone']);
     $staff->setData('address', $input['address']);
     if (!($update = $staff->update())) {
         View::setMessageFlash("danger", "Penyimpanan Gagal");
         return;
     }
     View::setMessageFlash("success", "Penyimpanan Berhasil");
 }
开发者ID:bahrul221,项目名称:tc-tgm,代码行数:29,代码来源:StaffProfileController.php

示例10: is_current_section

 /**
  * Check if this is the current section.
  * @return boolean True if this is the currently active section.
  */
 public function is_current_section()
 {
     if (!isset($this->active)) {
         $this->active = filter_input(INPUT_GET, 'section') == $this->get_slug();
     }
     return $this->active;
 }
开发者ID:Air-Craft,项目名称:air-craft-www,代码行数:11,代码来源:Section.php

示例11: show

    public function show()
    {
        //取得頁數資訊
        //控制參數
        $qlimit = array();
        $modelName = $this->getModelName();
        $model = new $modelName();
        $searchSQL = self::getJQGridSearchParams();
        //echo($searchSQL);
        $id = filter_input(INPUT_GET, 'row_id', FILTER_SANITIZE_NUMBER_INT);
        if ($id) {
            //$id = $this->parseDataInFormat($id, 'd_id');
            $qlimit[] = 'a.m_id=' . $id;
        }
        if ($searchSQL) {
            $qlimit[] = $searchSQL;
        }
        $qlimit = self::implodeQueryFilters($qlimit);
        return $model->getJQGridGridData($qlimit, array('SQL_SELECT' => 'a.m_id, a.m_name, a.m_sat_name, a.s_property, a.m_img,
					a.m_place, a.m_subplace, a.m_lv, a.m_meet, a.m_mission, b.m_subject,
					a.m_npc, a.m_npc_message, a.hp, a.sp, a.at, a.df, a.mat, a.mdf,
					a.str, a.smart, a.agi, a.life, a.vit, a.au, a.be, 
					a.skill_1, a.skill_2, a.skill_3, a.skill_4, a.skill_5, 
					a.time_1, a.time_2, a.time_3, a.m_job_Exp, a.d_id, a.m_topr
				', 'SQL_FROM' => 'wog_monster a LEFT JOIN wog_mission_main b ON b.m_id=a.m_mission', 'sanitize' => array('MonsterController', 'sanitizeShowData')));
    }
开发者ID:WeishengChang,项目名称:wogap,代码行数:26,代码来源:MonsterController.php

示例12: __construct

 function __construct()
 {
     $this->getCluster = filter_input(INPUT_POST, "getParam");
     $this->userid = filter_input(INPUT_POST, "userid");
     $this->part = 'modelfile/' . $this->userid . '/';
     $this->getContent();
 }
开发者ID:tappy,项目名称:ServerEMining,代码行数:7,代码来源:getClusterModel.php

示例13: __construct

 public function __construct()
 {
     if (isset($_GET['url'])) {
         //se verifica que la variable url no este vacia, en caso de que no entra en la condicion y la filtra
         $url = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_URL);
         //se le envia la manera como va a llegar sea por post o get, despues la variable, y con el sanitize se limpia de caracteres especiales
         $url = explode('/', $url);
         //se recorre la url, y cada vez que encuentre un slas la separa y crea un array
         $url = array_filter($url);
         //recorre el array y lo limpia de los caracteres especiales
         $this->_controlador = strtolower(array_shift($url));
         //coje la primera posicion del array, la convierte en minuscula con strlower y la asigna a la variable _controlador
         $this->_metodo = strtolower(array_shift($url));
         //coje la primera posicion del array, la convierte en minuscula con strlower y la asigna a la variable _metodo
         $this->_parametros = $url;
         //coje lo que queda en el array y lo mete en la variable _parametros
     }
     if (!$this->_controlador) {
         $this->_controlador = DEFAULT_CONTROLLER;
     }
     //en caso de que la url venga vacia asigna el controlador index por defecto el que se creo en el config
     if (!$this->_metodo) {
         $this->_metodo = 'index';
         //en caso de que el metodo venga vacio asigna el metod index por defecto
     }
     if (!isset($this->_parametros)) {
         $this->_parametros = array();
         //si los parametros no existen le dira a la variable que va a ser de tipo array
     }
 }
开发者ID:b3nkos,项目名称:sevg,代码行数:30,代码来源:request.php

示例14: setRoute

 private function setRoute()
 {
     $this->route = filter_input(INPUT_GET, 'request', FILTER_SANITIZE_URL);
     $this->route = trim($this->route, "/");
     $this->route = explode("/", $this->route);
     $this->checkForEmptyRoute();
 }
开发者ID:wamacs,项目名称:CRUDMVC,代码行数:7,代码来源:router.php

示例15: private_core

 public function private_core()
 {
     $this->allow_delete = $this->user->allow_delete_on(__CLASS__);
     $this->almacen = new almacen();
     $this->agencia_transporte = new agencia_transporte();
     $this->distribucion_tipounidad = new distribucion_tipounidad();
     $this->distribucion_unidades = new distribucion_unidades();
     $delete = \filter_input(INPUT_GET, 'delete');
     $codalmacen = \filter_input(INPUT_POST, 'codalmacen');
     $codtrans = \filter_input(INPUT_POST, 'codtrans');
     $placa_val = \filter_input(INPUT_POST, 'placa');
     $capacidad = \filter_input(INPUT_POST, 'capacidad');
     $tipounidad = \filter_input(INPUT_POST, 'tipounidad');
     $estado_val = \filter_input(INPUT_POST, 'estado');
     $estado = isset($estado_val) ? true : false;
     $placa = !empty($delete) ? $delete : $placa_val;
     $unidad = new distribucion_unidades();
     $unidad->idempresa = $this->empresa->id;
     $unidad->placa = trim(strtoupper($placa));
     $unidad->codalmacen = $codalmacen;
     $unidad->codtrans = (string) $codtrans;
     $unidad->tipounidad = (int) $tipounidad;
     $unidad->capacidad = (int) $capacidad;
     $unidad->estado = $estado;
     $unidad->usuario_creacion = $this->user->nick;
     $unidad->fecha_creacion = \Date('d-m-Y H:i:s');
     $condicion = !empty($delete) ? 'delete' : 'update';
     $valor = !empty($delete) ? $delete : $placa;
     if ($valor) {
         $this->tratar_unidad($valor, $condicion, $unidad);
     }
     $this->listado = $this->distribucion_unidades->all($this->empresa->id);
 }
开发者ID:joenilson,项目名称:distribucion,代码行数:33,代码来源:distrib_unidades.php


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