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


PHP Sanitize::sql方法代码示例

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


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

示例1: edit

 function edit()
 {
     if (!isset($_SESSION['User'])) {
         $this->redirect('/users/login');
     }
     $this->set('error', false);
     $this->pageTitle = 'Edit My Account';
     if (empty($this->data)) {
         $this->User->id = $_SESSION['User']['id'];
         $this->data = $this->User->read();
         $this->data['User']['password'] = "";
         $this->set('utz', $this->data['User']['tz']);
         $this->data['User']['name'] = preg_replace("/&#(\\d{2,5});/e", '$this->Unicode->unicode2utf(${1})', html_entity_decode($this->data['User']['name']));
         $this->data['User']['website'] = preg_replace("/&#(\\d{2,5});/e", '$this->Unicode->unicode2utf(${1})', html_entity_decode($this->data['User']['website']));
         $this->data['User']['location'] = preg_replace("/&#(\\d{2,5});/e", '$this->Unicode->unicode2utf(${1})', html_entity_decode($this->data['User']['location']));
         if (GMAP_API_KEY != null) {
             if ($this->data['User']['lat']) {
                 $this->set('map', 'mapInit(' . $this->data['User']['lat'] . ',' . $this->data['User']['long'] . ',' . $this->data['User']['zoom'] . ')');
             } else {
                 $this->set('map', 'mapInit()');
             }
         }
     } else {
         $user = $this->User->findById($_SESSION['User']['id']);
         $this->User->id = $user['User']['id'];
         $this->set('utz', $user['User']['tz']);
         $clean = new Sanitize();
         $temp = array('password' => $this->data['User']['password'], 'confpassword' => $this->data['User']['confpassword'], 'lat' => $clean->sql($this->data['User']['lat']), 'long' => $clean->sql($this->data['User']['long']), 'tz' => $clean->sql($this->data['User']['tz']));
         //Nuke everything else
         $clean->cleanArray($this->data);
         $this->data['User']['email'] = $user['User']['email'];
         $this->data['User']['password'] = $temp['password'];
         $this->data['User']['confpassword'] = $temp['confpassword'];
         $this->data['User']['lat'] = floatval($temp['lat']);
         $this->data['User']['long'] = floatval($temp['long']);
         $this->data['User']['tz'] = intval($temp['tz']);
         $this->data['User']['role'] = $user['User']['role'];
         if (!preg_match("/^(http|https)\\:\\/\\//i", $this->data['User']['website']) && !empty($this->data['User']['website'])) {
             $this->User->invalidate('website');
         }
         if ($this->data['User']['password'] === $this->data['User']['confpassword'] && !empty($this->data['User']['password'])) {
             $pass = $this->Hash->password($this->data['User']['password'], $user['User']['email']);
             $this->data['User']['password'] = $pass['pass'];
             $this->data['User']['salt'] = $pass['salt'];
         } else {
             if (empty($this->data['User']['password']) && empty($this->data['User']['confpassword'])) {
                 $this->data['User']['password'] = $user['User']['password'];
                 $this->data['User']['salt'] = $user['User']['salt'];
             } else {
                 $this->set('error', true);
                 $this->User->invalidate('password');
                 $this->User->invalidate('confpassword');
             }
         }
         if ($this->User->validates($this->data)) {
             if ($this->User->save($this->data)) {
                 $sess = $this->User->findById($user['User']['id']);
                 $this->redirect('/users/');
             }
         } else {
             $this->validateErrors($this->User);
             $this->data['User']['password'] = null;
             $this->data['User']['confpassword'] = null;
             $this->render();
         }
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:67,代码来源:users_controller.php

示例2: invited

 function invited($icode = null, $conf = null)
 {
     $this->pageTitle = "Confirm Invite";
     if ($icode == 'cancel') {
         $this->Session->delete('invite');
         $this->Session->delete('invitestep');
         $this->redirect('/');
     } else {
         $clean = new Sanitize();
         $icode = $clean->sql($icode);
         $party = $this->Party->findByInvitecode($icode);
         if (empty($party['Party']['id'])) {
             $this->Session->setFlash('Could not find a party matching that invite code, please check it and try again.', 'errorFlash');
         } else {
             if (!empty($_SESSION['User']['id']) && !empty($_SESSION['invitestep']) && $conf == 'confirm') {
                 $this->Party->addGuest($_SESSION['User']['id'], $_SESSION['invite']);
                 $this->Session->setFlash('You have been successfully added to this party.', 'infoFlash');
                 $this->redirect('/parties/view/' . $party['Party']['id']);
             } else {
                 if (!empty($_SESSION['User']['id'])) {
                     $this->set('confirm_only', true);
                     $this->set('party', $party);
                     $this->set('icode', $icode);
                     $this->Session->write('invitestep', 'true');
                     $this->Session->write('invite', $icode);
                 } else {
                     $this->Session->write('invite', $icode);
                     $this->set('party', $party);
                     $this->set('icode', $icode);
                 }
             }
         }
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:34,代码来源:parties_controller.php


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