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


PHP S::sqlEscape方法代码示例

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


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

示例1: getCompanyIdByName

 /**
  * 根据公司名称获取公司ID
  * @param string $companyName
  * @return array
  */
 function getCompanyIdByName($companyName)
 {
     if (!$companyName) {
         return array();
     }
     return $this->_db->get_value("SELECT companyid FROM  {$this->_tableName} WHERE companyname = " . S::sqlEscape($companyName) . "");
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:12,代码来源:companydb.class.php

示例2: vote

function vote($readvote)
{
    global $db, $votetype, $ifview, $votedb, $votesum, $action, $viewvoter, $tid, $admincheck, $vote_close;
    $votearray = unserialize($readvote['voteopts']);
    $votetype = $readvote['mostvotes'] > 1 ? 'checkbox' : 'radio';
    $votesum = 0;
    $votedb = $voter = array();
    $ifview = $viewvoter == 'yes' ? 'no' : 'yes';
    foreach ($votearray as $option) {
        $votesum += $option[1];
    }
    if ($viewvoter == 'yes') {
        $query = $db->query("SELECT username,vote FROM pw_voter WHERE tid=" . S::sqlEscape($tid) . " LIMIT 500");
        while ($rt = $db->fetch_array($query)) {
            $voter[$rt['vote']][] = $rt[username];
        }
    }
    foreach ($votearray as $key => $value) {
        $vote = array();
        $vote['percent'] = $votesum ? round(100 * $value[1] / $votesum, 2) : 0;
        if ($readvote['previewable'] == 0 || $readvote['havevote'] || $vote_close) {
            $vote['width'] = floor(500 * $value[1] / ($votesum + 1));
            $vote['num'] = $value[1];
        } else {
            $vote['width'] = 0;
            $vote['num'] = '*';
        }
        $vote['name'] = $value[0];
        $vote['voter'] = $voter[$key];
        $votedb[$key] = $vote;
    }
}
开发者ID:jechiy,项目名称:PHPWind,代码行数:32,代码来源:readvote.php

示例3: getNewData

 /**
  * 获得最新公告
  * @param int $num
  */
 function getNewData($num)
 {
     global $timestamp;
     $num = (int) $num;
     $query = $this->_db->query("SELECT * FROM {$this->_tableName} WHERE ifopen = '1' AND \n\t\t\tstartdate <= " . S::sqlEscape($timestamp) . " AND enddate=0 OR enddate>" . S::sqlEscape($timestamp) . " ORDER BY aid DESC LIMIT 0,{$num}");
     return $this->_getAllResultFromQuery($query);
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:11,代码来源:announcedb.class.php

示例4: _getSearchSQL

 function _getSearchSQL($array)
 {
     if ($array['username']) {
         return ' AND username=' . S::sqlEscape($array['username']);
     }
     return ' ';
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:7,代码来源:purviewdb.class.php

示例5: update

 function update($uploaddb)
 {
     $fieldService = L::loadClass('ActivityField', 'activity');
     if ($this->tid) {
         $defaultAttach = $userAttach = array();
         foreach ($uploaddb as $key => $value) {
             if ($value['id']) {
                 $attach = array();
                 $attach = $fieldService->getField($value['id']);
                 $this->attachs[$attach['fieldname']] = $value['fileuploadurl'];
                 if ($attach['fieldname'] && $attach['ifdel'] == 1) {
                     $userAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 } elseif ($attach['fieldname'] && !$attach['ifdel']) {
                     $defaultAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 }
             }
         }
         $defaultValueTableName = getActivityValueTableNameByActmid();
         $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
         if ($defaultAttach) {
             $this->db->update("UPDATE {$defaultValueTableName} SET " . S::sqlSingle($defaultAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
         if ($userAttach) {
             $this->db->update("UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($userAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
     } else {
         foreach ($uploaddb as $key => $value) {
             $this->attachs['fileuploadurl'] = $value['fileuploadurl'];
         }
     }
     return true;
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:32,代码来源:activityupload.class.php

示例6: syncredit

 function syncredit($arr)
 {
     if (is_array($arr)) {
         foreach ($arr as $uid => $setv) {
             $updateMemberData = array();
             foreach ($setv as $cid => $value) {
                 if (is_numeric($cid)) {
                     $value = intval($value);
                     /**
                     						$this->db->pw_update(
                     							"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"UPDATE pw_membercredit SET value=" . S::sqlEscape($value) .  ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))
                     						);
                     						**/
                     $this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
                 } elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) {
                     $cid == 'rvrc' && ($value *= 10);
                     $updateMemberData[$cid] = intval($value);
                 }
             }
             if ($updateMemberData) {
                 $userService = L::loadClass('UserService', 'user');
                 /* @var $userService PW_UserService */
                 $userService->update($uid, array(), $updateMemberData);
             }
         }
     }
     return new ApiResponse(1);
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:30,代码来源:class_Credit.php

示例7: update

 function update($uploaddb)
 {
     global $windid, $winduid, $timestamp, $pintro;
     foreach ($uploaddb as $key => $value) {
         $this->attachs[] = array('aid' => $this->aid, 'pintro' => $pintro[$value['id']] ? $pintro[$value['id']] : substr($value['name'], 0, strrpos($value['name'], '.')), 'path' => $value['fileuploadurl'], 'uploader' => $windid, 'uptime' => $timestamp, 'ifthumb' => $value['ifthumb']);
     }
     if ($this->attachs) {
         $this->db->update("INSERT INTO pw_cnphoto (aid,pintro,path,uploader,uptime,ifthumb) VALUES " . S::sqlMulti($this->attachs));
         $this->pid = $this->db->insert_id();
         $cnalbum = $this->db->get_one("SELECT * FROM pw_cnalbum WHERE aid=" . S::sqlEscape($this->aid));
         if ($this->atype) {
             if (!$cnalbum['private']) {
                 updateDatanalyse($this->pid, 'groupPicNew', $timestamp);
             }
         } else {
             $statistics = L::loadClass('Statistics', 'datanalyse');
             $statistics->photouser($winduid, count($this->attachs));
         }
         if (isset($cnalbum['lastphoto']) && !$cnalbum['lastphoto']) {
             $lastphoto = $this->getLastPhotoThumb();
             $lastphotosqlAdd = ",lastphoto= " . S::sqlEscape($lastphoto);
         }
         $this->db->update("UPDATE pw_cnalbum SET photonum=photonum+" . S::sqlEscape(count($this->attachs)) . ",lasttime=" . S::sqlEscape($timestamp) . $lastphotosqlAdd . " WHERE aid=" . S::sqlEscape($this->aid));
     }
     return true;
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:26,代码来源:photoupload.class.php

示例8: isFriend

function isFriend($uid, $friend)
{
    global $db;
    if ($db->get_value("SELECT uid FROM pw_friends WHERE uid=" . S::sqlEscape($uid) . ' AND friendid=' . S::sqlEscape($friend) . " AND status='0'")) {
        return true;
    }
    return false;
}
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:8,代码来源:pcjoin.php

示例9: update

 function update($uploaddb)
 {
     $attaches = array();
     foreach ($uploaddb as $v) {
         $attaches['attach' . $v['id']] = $v['fileuploadurl'];
     }
     $attaches && $this->db->pw_update("SELECT * FROM pw_auth_certificate WHERE uid=" . S::sqlEscape($this->uid), "UPDATE pw_auth_certificate SET " . S::sqlSingle($attaches) . ' WHERE uid=' . $this->uid, "INSERT INTO pw_auth_certificate SET " . S::sqlSingle($attaches) . ',state=0,uid=' . $this->uid);
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:8,代码来源:certificateupload.class.php

示例10: getUserGroups

 function getUserGroups($type)
 {
     if (!$type) {
         return false;
     }
     $query = $this->_db->query("SELECT gid FROM {$this->_tableName} WHERE gptype=" . S::sqlEscape($type));
     return array_keys($this->_getAllResultFromQuery($query, 'gid'));
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:8,代码来源:usergroupsdb.class.php

示例11: updataById

 function updataById($tplid, $array)
 {
     $array = $this->_checkData($array);
     if (!$array) {
         return null;
     }
     $this->_db->update("UPDATE " . $this->_tableName . " SET " . S::sqlSingle($array, false) . " WHERE tplid=" . S::sqlEscape($tplid));
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:8,代码来源:tpldb.class.php

示例12: getByIdentify

 function getByIdentify($identify)
 {
     $temp = $this->_db->get_one("SELECT * FROM " . $this->_tableName . " WHERE identify=" . S::sqlEscape($identify));
     if (!$temp) {
         return array();
     }
     return $this->_unserializeData($temp);
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:8,代码来源:medalinfodb.class.php

示例13: getUserIdsByCompanyId

 /**
  * 根据公司ID获取用户id
  * @param int companyId
  * @return array
  */
 function getUserIdsByCompanyId($companyId)
 {
     if (!$companyId) {
         return array();
     }
     $query = $this->_db->query("SELECT uid FROM  {$this->_tableName} WHERE companyid = " . S::sqlEscape($companyId) . "");
     return $this->_getAllResultFromQuery($query, 'uid');
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:13,代码来源:usercareerdb.class.php

示例14: getTypesByStid

 /**
  * 根据分类stid查name
  * 
  * @param stid 分类id
  * @return array 查询结果数组
  */
 function getTypesByStid($stid)
 {
     $stid = intval($stid);
     if (!$stid) {
         return null;
     }
     return $this->_db->get_one('SELECT name FROM ' . $this->_tableName . ' WHERE ifable <> 0 AND stid= ' . S::sqlEscape($stid));
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:14,代码来源:sharelinkstypedb.class.php

示例15: getGroupcateCreditset

 function getGroupcateCreditset($type)
 {
     $creditset = $this->db->get_value("SELECT creditset FROM pw_cnclass WHERE fid=" . S::sqlEscape($this->classid));
     $creditset = unserialize($creditset);
     $creditset = array_filter($creditset[$type], "group_filter");
     $creditset = is_array($creditset) ? $creditset : array();
     return $creditset;
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:8,代码来源:group.class.php


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