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


PHP Querys::escape方法代码示例

本文整理汇总了PHP中Querys::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP Querys::escape方法的具体用法?PHP Querys::escape怎么用?PHP Querys::escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Querys的用法示例。


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

示例1: editRegistro

 /**
  * Metodo editRegistro
  *
  * @access public
  * @param integer $registro_id
  * @param array $data
  * @return void
  */
 public function editRegistro($registro_id, $data)
 {
     $querys = new Querys();
     // Transforma senha em MD5
     $data[$this->tabela_senha] = $querys->escape(md5($data[$this->tabela_senha]));
     // CPF sem ponto e traço
     $valor = $data[$this->tabela_cpf];
     $valor = str_replace(".", "", $valor);
     $valor = str_replace(",", "", $valor);
     $valor = str_replace("-", "", $valor);
     $valor = str_replace("/", "", $valor);
     $data[$this->tabela_cpf] = $valor;
     // Retorna todos os campos da tabela
     $result = $this->getCampos();
     // Monta sql
     $sql = "UPDATE " . $this->tabela . " SET ";
     foreach ($result['nome'] as $key => $campo) {
         if (isset($data[$result['nome'][$key]]) && !empty($data[$result['nome'][$key]])) {
             if ($result['tipo'][$key] == 'int') {
                 $sql .= $result['nome'][$key] . " = '" . (int) $data[$result['nome'][$key]] . "', ";
             } else {
                 if ($result['tipo'][$key] == 'real') {
                     $sql .= $result['nome'][$key] . " = " . floatval($data[$result['nome'][$key]]) . ", ";
                 } else {
                     $sql .= $result['nome'][$key] . " = '" . $querys->escape($data[$result['nome'][$key]]) . "', ";
                 }
             }
         }
     }
     $sql = substr(trim($sql), 0, -1);
     $sql .= " WHERE " . $this->tabela_id . " = " . (int) $registro_id;
     $result = $querys->query($sql);
     return $result;
 }
开发者ID:ExtraProgrammers,项目名称:PrivateGSIASorteios,代码行数:42,代码来源:Cadastros.php

示例2: addRegistro

 function addRegistro($data)
 {
     $querys = new Querys();
     // Data cadastro atual
     $data[$this->tabela_data_cadastro] = date('Y-m-d H:i:s');
     // Transforma senha em MD5
     $data[$this->tabela_senha] = $querys->escape(md5($data[$this->tabela_senha]));
     // Retorna todos os campos da tabela
     $result = $this->getCampos();
     // Monta sql
     $sql = "INSERT INTO " . $this->tabela . " SET ";
     foreach ($result['nome'] as $key => $campo) {
         if (isset($data[$result['nome'][$key]]) && !empty($data[$result['nome'][$key]])) {
             if ($result['tipo'][$key] == 'int') {
                 $sql .= $result['nome'][$key] . " = '" . (int) $data[$result['nome'][$key]] . "', ";
             } else {
                 if ($result['tipo'][$key] == 'real') {
                     $sql .= $result['nome'][$key] . " = " . floatval($data[$result['nome'][$key]]) . ", ";
                 } else {
                     $sql .= $result['nome'][$key] . " = '" . $querys->escape($data[$result['nome'][$key]]) . "', ";
                 }
             }
         }
     }
     $sql = substr(trim($sql), 0, -1);
     $result = $querys->query($sql);
     return $result;
 }
开发者ID:ExtraProgrammers,项目名称:PrivateGSIASorteios,代码行数:28,代码来源:Sorteios.php

示例3: editRegistro

 /**
  * Metodo editRegistro
  *
  * @access public
  * @param integer $registro_id
  * @param array $data
  * @return void
  */
 public function editRegistro($registro_id, $data)
 {
     $querys = new Querys();
     // Insere a data de ultima alteração
     $data[$this->tabela_data_alteracao] = date('Y-m-d H:i:s');
     // Retorna todos os campos da tabela
     $result = $this->getCampos();
     // Monta sql
     $sql = "UPDATE " . $this->tabela . " SET ";
     foreach ($result['nome'] as $key => $campo) {
         if (isset($data[$result['nome'][$key]]) && !empty($data[$result['nome'][$key]])) {
             if ($result['tipo'][$key] == 'int') {
                 $sql .= $result['nome'][$key] . " = '" . (int) $data[$result['nome'][$key]] . "', ";
             } else {
                 if ($result['tipo'][$key] == 'real') {
                     $sql .= $result['nome'][$key] . " = " . floatval($data[$result['nome'][$key]]) . ", ";
                 } else {
                     $sql .= $result['nome'][$key] . " = '" . $querys->escape($data[$result['nome'][$key]]) . "', ";
                 }
             }
         }
     }
     $sql = substr(trim($sql), 0, -1);
     $sql .= " WHERE " . $this->tabela_transaction_id . " = '" . $registro_id . "'";
     $result = $querys->query($sql);
     return $result;
 }
开发者ID:ExtraProgrammers,项目名称:PrivateGSIASorteios,代码行数:35,代码来源:Vendas.php

示例4: loginUser

 /**
  * Metodo loginUser
  *
  * @access public
  * @param string $login
  * @param string $senha
  * @return booleam
  */
 public function loginUser($login, $senha)
 {
     $db = new Querys();
     // Verifica se usuario está logado, caso contrario verifica aluno.
     $usuario_query = $db->query("SELECT \n\t\t\t\t\t\t\t\t\t\t\t* \n\t\t\t\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\t\t\t\tgsia_accounts\n\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\tact_account_email = '" . $db->escape($login) . "' AND \n\t\t\t\t\t\t\t\t\t\t\tact_account_senha = '" . $db->escape(md5($senha)) . "'");
     if ($usuario_query->num_rows) {
         $this->act_accounts_id = $usuario_query->row['act_accounts_id'];
         $this->act_account_email = $usuario_query->row['act_account_email'];
         $this->act_account_cpf = $usuario_query->row['act_account_cpf'];
         $this->act_account_nome = $usuario_query->row['act_account_nome'];
         $this->act_account_senha = $usuario_query->row['act_account_senha'];
         $session = new Session();
         $session->StartSession();
         $session->data['user']['act_accounts_id'] = $this->act_accounts_id;
         $session->data['user']['user_login'] = $this->act_account_email;
         $session->data['user']['user_cpf'] = $this->act_account_cpf;
         $session->data['user']['user_name'] = $this->act_account_nome;
         $session->data['user']['act_account_senha'] = $this->act_account_senha;
         return true;
     } else {
         return false;
     }
 }
开发者ID:ExtraProgrammers,项目名称:PrivateGSIASorteios,代码行数:31,代码来源:User.php


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