• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP filter_input_array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: sanitizePostFields

 /**
  * Cleans up our $_POST superglobal values by performing some basic
  * validation checks on each input, clearing the global and re-assigning
  * it to the scope of our class
  */
 private function sanitizePostFields()
 {
     if (isset($_POST)) {
         # Filter all $_POST values as strings
         $this->post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
         # Check if the query_string was set and is not empty during POST
         if (isset($this->post["query_string"]) && !empty(trim($this->post["query_string"]))) {
             # encode any special characters
             $query_string = htmlspecialchars($this->post["query_string"]);
             # remove any html tags
             $query_string = strip_tags($query_string);
             # replace any non-alpha characters
             $query_string = preg_replace('/[^\\p{L}\\p{N}\\s]/u', '', $query_string);
             # reassign our query string to our own $post now that we've
             # cleaned it
             $this->post["query_string"] = $query_string;
             # mark this task as done
             $this->status = "OK";
         }
         # Check if the ref value was passed from our form and is not blank
         # as we'll use this later as a session identifier
         if ($this->status == "OK" && isset($this->post["ref"]) && !empty(trim($this->post["ref"]))) {
             # Filter the ref value as an integer for convinience
             $ref = filter_input(INPUT_POST, 'ref', FILTER_SANITIZE_NUMBER_INT);
             # assign our ref to our property
             $this->post["ref"] = $ref;
             # mark this task as done
             $this->status = "OK";
         }
     }
 }
开发者ID:DrizzlyOwl,项目名称:ash-flix,代码行数:36,代码来源:Request.php


示例2: orbis_save_keychain_details

/**
 * Save keychain details
 */
function orbis_save_keychain_details($post_id, $post)
{
    // Doing autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Verify nonce
    $nonce = filter_input(INPUT_POST, 'orbis_keychain_details_meta_box_nonce', FILTER_SANITIZE_STRING);
    if (!wp_verify_nonce($nonce, 'orbis_save_keychain_details')) {
        return;
    }
    // Check permissions
    if (!($post->post_type == 'orbis_keychain' && current_user_can('edit_post', $post_id))) {
        return;
    }
    // OK
    $definition = array('_orbis_keychain_url' => FILTER_VALIDATE_URL, '_orbis_keychain_email' => FILTER_VALIDATE_EMAIL, '_orbis_keychain_username' => FILTER_SANITIZE_STRING, '_orbis_keychain_password' => FILTER_UNSAFE_RAW);
    $data = wp_slash(filter_input_array(INPUT_POST, $definition));
    // Pasword
    $password_old = get_post_meta($post_id, '_orbis_keychain_password', true);
    $password_new = $data['_orbis_keychain_password'];
    foreach ($data as $key => $value) {
        if (empty($value)) {
            delete_post_meta($post_id, $key);
        } else {
            update_post_meta($post_id, $key, $value);
        }
    }
    // Action
    if ($post->post_status == 'publish' && !empty($password_old) && $password_old != $password_new) {
        // @see https://github.com/woothemes/woocommerce/blob/v2.1.4/includes/class-wc-order.php#L1274
        do_action('orbis_keychain_password_update', $post_id, $password_old, $password_new);
    }
}
开发者ID:joffcrabtree,项目名称:wp-orbis-keychains,代码行数:37,代码来源:post.php


示例3: 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


示例4: __construct

 public function __construct()
 {
     parent::__construct();
     //Session Enabled
     $this->checkLogin();
     //Session Disabled
     //define input filters
     $filterArgs = array('exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'key' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'description' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     //filter input
     $_postInput = filter_input_array(INPUT_POST, $filterArgs);
     //assign variables
     $this->exec = $_postInput['exec'];
     $this->key = $_postInput['key'];
     $this->description = $_postInput['description'];
     //check for eventual errors on the input passed
     $this->result['errors'] = array();
     if (empty($this->key)) {
         $this->result['errors'][] = array('code' => -2, 'message' => "Key missing");
     }
     if (array_search($this->exec, self::$allowed_exec) === false) {
         $this->result['errors'][] = array('code' => -5, 'message' => "No method {$this->exec} allowed.");
     }
     //ONLY LOGGED USERS CAN PERFORM ACTIONS ON KEYS
     if (!$this->userIsLogged) {
         $this->result['errors'][] = array('code' => -1, 'message' => "Login is required to perform this action");
     }
 }
开发者ID:reysub,项目名称:MateCat,代码行数:27,代码来源:userKeysController.php


示例5: setDados

 private function setDados()
 {
     $dto = new RelacionamentoParametroDTO();
     $_POST = filter_input_array(INPUT_POST);
     $dto->setCdCatgRelac1(Input::get('relac_1') ? 4 : null)->setCdCatgVlRelac1((int) Input::get('relac_1'))->setCdCatgRelac2(Input::get('relac_2') ? 4 : null)->setCdCatgVlRelac2((int) Input::get('relac_2'))->setCdUsuarioCriacao(Session::get('user'))->setDtUsuarioCriacao('now()')->setCdUsuarioAtualiza(Session::get('user'))->setDtUsuarioAtualiza('now()');
     return $dto;
 }
开发者ID:dnaCRM,项目名称:dnaCRM,代码行数:7,代码来源:RelacionamentoParametro.php


示例6: setDados

 public function setDados()
 {
     $dto = new MoradorEnderecoDTO();
     $_POST = filter_input_array(INPUT_POST);
     $dto->setNrSequencia(Input::get('id_m_end'))->setCdPessoaFisica(Input::get('cd_pessoa_fisica'))->setCdApartamento(Input::get('m_end_apartamento'))->setDtEntrada(Input::get('m_end_dt_entrada'))->setDtSaida(Input::get('m_end_dt_saida'))->setFgResidente(Input::get('residente') == '' ? null : Input::get('residente'))->setCdUsuarioCriacao(Session::get('user'))->setDtUsuarioCriacao('now()')->setCdUsuarioAtualiza(Session::get('user'))->setDtUsuarioAtualiza('now()');
     return $dto;
 }
开发者ID:dnaCRM,项目名称:dnaCRM,代码行数:7,代码来源:MoradorEndereco.php


示例7: __construct

 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'jpassword' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'err_typing' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_translation' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_terminology' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_language' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_style' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'original' => array('filter' => FILTER_UNSAFE_RAW));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->id_job = $postInput['job'];
     $this->password_job = $postInput['jpassword'];
     $this->id_segment = $postInput['segment'];
     $this->err_typing = $postInput['err_typing'];
     $this->err_translation = $postInput['err_translation'];
     $this->err_terminology = $postInput['err_terminology'];
     $this->err_language = $postInput['err_language'];
     $this->err_style = $postInput['err_style'];
     list($this->original_translation, $none) = CatUtils::parseSegmentSplit(CatUtils::view2rawxliff($postInput['original']), ' ');
     Log::doLog($_POST);
     if (empty($this->id_job)) {
         $this->result['errors'][] = array('code' => -1, 'message' => 'Job ID missing');
     }
     if (empty($this->id_segment)) {
         $this->result['errors'][] = array('code' => -2, 'message' => 'Segment ID missing');
     }
     if (empty($this->password_job)) {
         $this->result['errors'][] = array('code' => -3, 'message' => 'Job password missing');
     }
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:25,代码来源:setRevisionController.php


示例8: __construct

 public function __construct()
 {
     //SESSION ENABLED
     parent::sessionStart();
     parent::__construct();
     $filterArgs = array('page' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'step' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'project' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'filter' => array('filter' => FILTER_VALIDATE_BOOLEAN, 'options' => array(FILTER_NULL_ON_FAILURE)), 'pn' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'source' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'target' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'status' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'onlycompleted' => array('filter' => FILTER_VALIDATE_BOOLEAN, 'options' => array(FILTER_NULL_ON_FAILURE)));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     // assigning default values
     if (is_null($postInput['page']) || empty($postInput['page'])) {
         $postInput['page'] = 1;
     }
     if (is_null($postInput['step']) || empty($postInput['step'])) {
         $postInput['step'] = 25;
     }
     if (is_null($postInput['status']) || empty($postInput['status'])) {
         $postInput['status'] = Constants_JobStatus::STATUS_ACTIVE;
     }
     $this->lang_handler = Langs_Languages::getInstance();
     $this->page = (int) $postInput['page'];
     $this->step = (int) $postInput['step'];
     $this->project_id = $postInput['project'];
     $this->filter_enabled = (int) $postInput['filter'];
     $this->search_in_pname = (string) $postInput['pn'];
     $this->search_source = (string) $postInput['source'];
     $this->search_target = (string) $postInput['target'];
     $this->search_status = (string) $postInput['status'];
     $this->search_onlycompleted = $postInput['onlycompleted'];
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:28,代码来源:getProjectsController.php


示例9: execute

 public function execute()
 {
     $config = $this->getConfig();
     $formEntradaBodega = filter_input_array(INPUT_POST)['entradaBodega'];
     $entradaBodega = new entradaSalidaBodegaTable($config);
     $entradaBodega->setTipoDocumentoId($formEntradaBodega['tipo_documento_id']);
     $entradaBodega->setTerceroIdElabora($formEntradaBodega['tercero_id_elabora']);
     $entradaBodega->setTerceroIdSolicita($formEntradaBodega['tercero_id_solicita']);
     $entradaBodega->setFecha($formEntradaBodega['fecha']);
     $entradaBodega->setObservacion($formEntradaBodega['observacion']);
     //    $detalle = new detalleEntradaSalidaBodegaTable($config);
     $cod_art = filter_input_array(INPUT_POST)['cod_art'];
     $tpd = filter_input_array(INPUT_POST)['tpd'];
     $unm = filter_input_array(INPUT_POST)['unm'];
     $cant = filter_input_array(INPUT_POST)['cant'];
     $precio = filter_input_array(INPUT_POST)['precio'];
     $contador = filter_input_array(INPUT_POST)['cta_campos'];
     $this->objEntradaBodega = $entradaBodega->save();
     $id = $entradaBodega->consById();
     for ($i = 0; $i < $contador; $i++) {
         $detalleEntradaBodega = new detalleEntradaSalidaBodegaTable($config);
         $detalleEntradaBodega->setEntradaSalidaBodegaId($id[0]->id);
         $detalleEntradaBodega->setProductoId($cod_art[$i]);
         $detalleEntradaBodega->setTpd_id(1);
         $detalleEntradaBodega->setUnidadMedidaId($unm[$i]);
         $detalleEntradaBodega->setCantidad($cant[$i]);
         $detalleEntradaBodega->setPrecio($precio[$i]);
         // Se guarda el registro en la tabla detalle
         $this->ObjFactura = $detalleEntradaBodega->save();
     }
     header('Location: ' . $config->getUrl() . 'index.php/entradaBodega/index');
 }
开发者ID:sistemaAgricola,项目名称:agricola,代码行数:32,代码来源:crear.class.php


示例10: __construct

 public function __construct()
 {
     $vars = filter_input_array(INPUT_GET, array('ftype' => FILTER_VALIDATE_INT, 'folder_id' => FILTER_VALIDATE_INT));
     $this->ftype = $vars['ftype'];
     $this->folder_id = $vars['folder_id'];
     $this->loadFactory();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:7,代码来源:FC_Forms.php


示例11: login

 public function login()
 {
     $formKey = new $this->aReg->auth();
     /** @todo create standard filters for inputs */
     $post = filter_input_array(INPUT_POST);
     if (!isset($post['form_key']) || !$formKey->validate()) {
         // Form key error
         header('Location: ' . AMS_SEO_URL . 'user/signin');
     } else {
         if (isset($post['email'], $post['password'])) {
             $lp = $this->aReg->auth->login($post['email'], $post['password'], $this->aReg->db);
             /**
              * @todo login default actions
              * example $lp = loginprocessed return..
              * if($lp){$this->otherAction()}else{ $this->prime();}
              */
             if ($lp) {
                 //no differnce between mobile and classic views but it could be done here.
                 if ($_SESSION['layoutType'] !== 'classic') {
                     header('Location: ' . AMS_SEO_URL . 'prime');
                 } else {
                     header('Location: ' . AMS_SEO_URL . 'prime');
                 }
             } else {
                 $this->prime();
             }
         } else {
             header('Location: ' . AMS_SEO_URL . 'user/signin');
         }
     }
 }
开发者ID:CrandellWS,项目名称:ams,代码行数:31,代码来源:userController.php


示例12: execute

 public function execute()
 {
     $config = $this->getConfig();
     if (filter_has_var(INPUT_POST, 'seguridad') === TRUE) {
         $user = filter_input_array(INPUT_POST)['seguridad']['user'];
         $password = filter_input_array(INPUT_POST)['seguridad']['pass'];
         $usuario = new usuarioTable($config);
         $usuario->setUsuario($user);
         $usuario->setPassword($password);
         if ($usuario->verificarUsuario() === TRUE) {
             $datoUsuario = $usuario->getDataByUserPassword();
             if ($datoUsuario !== FALSE) {
                 $_SESSION['user']['id'] = $datoUsuario->id;
                 $_SESSION['user']['nombre'] = $datoUsuario->nombre;
                 header("Location:" . $config->getUrl() . "index.php");
                 exit;
             } else {
                 throw new Exception('Ocurrio un error usuario no existente');
             }
         } else {
             $_SESSION['usuarioInvalido'] = 'Datos de usuario son inválidos';
             header("Location:" . $config->getUrl() . "index.php/home/loginUsuario");
             exit;
         }
     }
     header("Location:" . $config->getUrl() . "index.php");
     exit;
 }
开发者ID:DeliOverHD,项目名称:Aquiles,代码行数:28,代码来源:loginUsuario.class.php


示例13: pegaInformacao

function pegaInformacao($tipo_request)
{
    switch ($tipo_request) {
        case 'POST':
            $t = filter_input_array(INPUT_POST);
            break;
        case 'GET':
            $t = filter_input_array(INPUT_GET);
            break;
        case 'COOKIE':
            $t = filter_input_array(INPUT_COOKIE);
            break;
        case 'ENV':
            $t = filter_input_array(INPUT_ENV);
            break;
        case 'SESSION':
            if (isset($_SESSION)) {
                $t = $_SESSION;
            }
            break;
    }
    if (isset($t) && $t != '') {
        $string_com_todos = '';
        foreach ($t as $chave => $valor) {
            global ${$chave};
            ${$chave} = $valor;
            $string_com_todos .= $tipo_request . ' => ' . $chave . ': ' . $valor . "\n";
            /* TESTE => */
            //echo $tipo_request.' => '.$chave.': '.$valor." <br>\n";
        }
        /* TESTE => */
        //echo '<script>alert("'.$string_com_todos.'")</script>';
    }
}
开发者ID:junkes,项目名称:SQLHelper,代码行数:34,代码来源:request.php


示例14: __construct

 /**
  * Class Constructor
  *
  * @throws LogicException
  *
  */
 public function __construct()
 {
     if (empty($this->review_order_page)) {
         throw new LogicException("Property 'review_order_page' can not be EMPTY");
     }
     if (empty($this->tokenName)) {
         throw new LogicException("Property 'tokenName' can not be EMPTY");
     }
     //SESSION ENABLED
     $this->sessionStart();
     parent::__construct(false);
     $filterArgs = array($this->tokenName => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), $this->dataKeyName => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $__getInput = filter_input_array(INPUT_GET, $filterArgs);
     /*
      *
      * Do something with Token ( send it for authentication on confirm )
      *
      *  $__getInput['tk']
      *
      */
     $this->tokenAuth = $__getInput[$this->tokenName];
     $this->data_key_content = $__getInput[$this->dataKeyName];
     Log::doLog($_GET);
     Log::doLog($_SERVER['QUERY_STRING']);
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:31,代码来源:AbstractSuccessController.php


示例15: index

 public function index()
 {
     if (null !== filter_input_array(INPUT_POST)) {
         $post = filter_input_array(INPUT_POST);
         self::logAuth($post);
     }
 }
开发者ID:vyserees,项目名称:Shop-admin,代码行数:7,代码来源:auth.php


示例16: store

 /**
  * @method store verb POST
  *
  * @return string
  */
 public function store()
 {
     $options = ['username' => ['filter' => FILTER_SANITIZE_SPECIAL_CHARS]];
     $result = filter_input_array(INPUT_POST, $options);
     $username = !empty($result['username']) ? $result['username'] : 'no-body';
     return "store: {$username}";
 }
开发者ID:Antoine07,项目名称:myFramwork,代码行数:12,代码来源:StudentController.php


示例17: __construct

 public function __construct()
 {
     $this->start_time = microtime(1) * 1000;
     parent::__construct(false);
     parent::makeTemplate("index.html");
     $filterArgs = array('jid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'start' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'page' => array('filter' => FILTER_SANITIZE_NUMBER_INT));
     $getInput = (object) filter_input_array(INPUT_GET, $filterArgs);
     $this->jid = $getInput->jid;
     $this->password = $getInput->password;
     $this->start_from = $getInput->start;
     $this->page = $getInput->page;
     $this->job = Chunks_ChunkDao::getByIdAndPassword($this->jid, $this->password);
     if (isset($_GET['step'])) {
         $this->step = $_GET['step'];
     } else {
         $this->step = 1000;
     }
     if (is_null($this->page)) {
         $this->page = 1;
     }
     if (is_null($this->start_from)) {
         $this->start_from = ($this->page - 1) * $this->step;
     }
     if (isset($_GET['filter'])) {
         $this->filter_enabled = true;
     } else {
         $this->filter_enabled = false;
     }
     $this->downloadFileName = "";
     $this->doAuth();
     $this->generateAuthURL();
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:32,代码来源:catController.php


示例18: process

 static function process($filters, $source = INPUT_POST, $required_by_default = false, $strict = true)
 {
     # parse filters
     list($filters, $required, $defaults) = self::parse_filters($filters, $required_by_default);
     # apply
     $d = is_array($source) ? filter_var_array($source, $filters) : filter_input_array($source, $filters);
     if ($d === null) {
         $d = array_fill_keys(array_keys($filters), null);
     }
     # check required and set undefined to null (rather than false)
     foreach ($filters as $field => $filter) {
         $isa = is_array($filter);
         if ($d[$field] === null || $d[$field] === false && ($isa ? $filter['filter'] : $filter) !== FILTER_VALIDATE_BOOLEAN) {
             if ($strict && isset($required[$field])) {
                 throw new UnexpectedValueException($field . ' is required');
             } elseif (isset($defaults[$field])) {
                 if ($filter !== FILTER_DEFAULT) {
                     if ($isa) {
                         $d[$field] = filter_var($defaults[$field], $filter['filter'], isset($filter['options']) ? $filter['options'] : null);
                     } else {
                         $d[$field] = filter_var($defaults[$field], $filter);
                     }
                 } else {
                     $d[$field] = $defaults[$field];
                 }
             } else {
                 $d[$field] = null;
             }
         }
     }
     return $d;
 }
开发者ID:rsms,项目名称:gitblog,代码行数:32,代码来源:gb_input.php


示例19: __construct

 public function __construct() {
     @session_start();
     self::$db = Database::__getInstance();
     $this->data = filter_input_array(INPUT_POST);
     if($this->data)
         $this->csrfCheck();
 }
开发者ID:JakubMarden,项目名称:eshop,代码行数:7,代码来源:BaseController.php


示例20: update

 public function update($model, $table_id)
 {
     $this->load->library('form_validation');
     $this->load->helper('security');
     if (filter_input_array(INPUT_POST)) {
         $this->load->model($model);
         $pk = $this->input->post('pk', true);
         $where_value = $this->input->post('value', true);
         $where_column = $this->input->post('name', true);
         $rules = array(array('field' => 'value', 'label' => 'Value', 'rules' => 'required|max_length[255]|min_length[2]|encode_php_tags|trim'));
         //validation run
         $this->load->library('form_validation');
         $this->form_validation->set_rules($rules);
         $this->form_validation->set_error_delimiters('', '');
         if (!$this->form_validation->run($rules) == FALSE) {
             $success = $this->{$model}->updateRecord($table_id, [$where_column => $where_value], $pk);
             if ($success) {
                 header("HTTP/1.1 200 OK");
                 echo 'updated';
             }
         } else {
             header('HTTP/1.0 400 Bad Request', true, 400);
             echo validation_errors();
         }
     }
 }
开发者ID:therightsol,项目名称:visaagents,代码行数:26,代码来源:Editable_admin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP filter_ip函数代码示例发布时间:2022-05-15
下一篇:
PHP filter_input函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap