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


PHP dstrlen函数代码示例

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


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

示例1: check_username_len

/**
 * 用户名长度验证
 * @param string $username
 * @return boolean
 */
function check_username_len($username)
{
    $len = dstrlen($username);
    if ($len > 15 || $len < 5) {
        return FALSE;
    } else {
        return TRUE;
    }
}
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:14,代码来源:function_helper.php

示例2: _check_post_length

 private function _check_post_length($message, $length)
 {
     if ($this->param['special'] || $this->thread['special'] || getstatus($this->thread['status'], 3) || !$length) {
         return 0;
     }
     require_once libfile('function/discuzcode');
     $langthread = lang('forum/thread');
     $content = discuzcode($message);
     $content = strip_tags($content);
     $content = str_replace(array(',', '.', '?', '!', $langthread['t_question'], $langthread['t_exclamatory'], $langthread['t_period'], $langthread['t_comma'], '~', $langthread['t_suspension']), '', $content);
     $content = preg_replace('/\\s+/', '', $content);
     $realLength = dstrlen($content);
     $checkQuote = preg_match("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", $message) > 0 || preg_match("/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/i", $message) > 0 || preg_match("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/i", $message) > 0 || preg_match("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $message) > 0;
     if ($checkQuote || $realLength >= $length) {
         return $realLength <= 0 ? 1 : $realLength;
     } else {
         return 0;
     }
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:19,代码来源:extend_thread_filter.php

示例3: check_username

function check_username($username)
{
    $guestexp = '^Guest';
    $len = dstrlen($username);
    if ($len < 3 || preg_match("/\\s+|^c:\\con\\con|[%,\\*\"\\s\\<\\>\\&]|{$guestexp}/is", $username)) {
        return FALSE;
    } else {
        return TRUE;
    }
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:10,代码来源:function_user.php

示例4: pick_reg

function pick_reg($info)
{
    $member = $info;
    extract($info);
    global $_G;
    loaducenter();
    require_once libfile('function/misc');
    require_once libfile('function/profile');
    include_once libfile('class/member');
    $activation = array();
    if (!$activation) {
        $usernamelen = dstrlen($username);
        if ($usernamelen < 3) {
            return milu_lang('too_short');
        } elseif ($usernamelen > 15) {
            return milu_lang('too_long');
        }
        $username = addslashes(trim(dstripslashes($username)));
        $email = trim($email);
    }
    if (!$activation) {
        $uid = uc_user_register($username, $password, $email, $questionid, $answer, $_G['clientip']);
        if ($uid <= 0) {
            if ($uid == -1) {
                return milu_lang('bad_word');
            } elseif ($uid == -2) {
                return milu_lang('system_bad_word');
            } elseif ($uid == -3) {
                return milu_lang('reged');
            } elseif ($uid == -4) {
                return milu_lang('wrong_email');
            } elseif ($uid == -5) {
                return milu_lang('bad_email');
            } elseif ($uid == -6) {
                return milu_lang('email_reged');
            } else {
                return milu_lang('unknow_error');
            }
        }
    } else {
        list($uid, $username, $email) = $activation;
    }
    if (DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$uid}'")) {
        if (!$activation) {
            uc_user_delete($uid);
        }
        return milu_lang('uid_reged');
    }
    $init_arr = explode(',', $_G['setting']['initcredits']);
    $groupinfo['groupid'] = $_G['setting']['newusergroupid'];
    $password = md5(random(10));
    $secques = $questionid > 0 ? random(8) : '';
    //用户资料
    $profile['constellation'] = get_constellation($birthmonth, $birthday);
    $profile['zodiac'] = get_zodiac($birthyear);
    $profile['gender'] = $gender == milu_lang('baomi') ? 0 : ($gender == milu_lang('man') ? 1 : 0);
    $profile_field_arr = array('birthyear', 'birthmonth', 'birthday', 'birthprovince', 'birthcity', 'birthdist', 'birthcommunity', 'resideprovince', 'residecity', 'residedist', 'residecommunity', 'residesuite', 'site', 'bio', 'interest', 'idcardtype', 'idcard', 'bloodtype', 'height', 'weight', 'qq', 'msn', 'taobao', 'yahoo', 'icq', 'alipay', 'lookingfor', 'position', 'occupation', 'education', 'company', 'graduateschool', 'revenue', 'telephone', 'mobile', 'constellation', 'realname', 'zodiac', 'affectivestatus');
    foreach ($profile_field_arr as $k => $v) {
        $profile[$v] = ${$v};
    }
    $lastactivity = rand($regdate, $regdate + 3600 * 24 * 2);
    if ($regipsql) {
        DB::query($regipsql);
    }
    $credits = 0;
    if (!empty($_G['setting']['creditsformula'])) {
        eval("\$credits = round(" . $_G['setting']['creditsformula'] . ");");
    }
    $userdata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => $groupinfo['groupid'], 'regdate' => $regdate, 'credits' => $credits, 'timeoffset' => 9999);
    $status_data = array('uid' => $uid, 'regip' => $regip, 'lastip' => $lastip, 'lastvisit' => $lastvisit, 'lastactivity' => $lastactivity, 'lastpost' => $lastpost, 'lastsendmail' => 0);
    $profile['uid'] = $uid;
    $field_forum['uid'] = $uid;
    $field_forum['sightml'] = $sightmlm;
    $field_home['uid'] = $uid;
    DB::insert('common_member', paddslashes($userdata));
    DB::insert('common_member_status', paddslashes($status_data));
    DB::insert('common_member_profile', paddslashes($profile));
    DB::insert('common_member_field_forum', paddslashes($field_forum));
    DB::insert('common_member_field_home', paddslashes($field_home));
    if ($verifyarr) {
        $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => daddslashes(serialize($verifyarr)), 'dateline' => $lastactivity);
        DB::insert('common_member_verify_info', $setverify);
        DB::insert('common_member_verify', array('uid' => $uid));
    }
    $count_data = array('uid' => $uid, 'oltime' => $oltime ? $oltime : 0, 'extcredits1' => $extcredits1 ? $extcredits1 : $init_arr[1], 'extcredits2' => $extcredits2 ? $extcredits2 : $init_arr[2], 'extcredits3' => $extcredits3 ? $extcredits3 : $init_arr[3], 'extcredits4' => $extcredits4 ? $extcredits4 : $init_arr[4], 'extcredits5' => $extcredits5 ? $extcredits5 : $init_arr[5], 'extcredits6' => $extcredits6 ? $extcredits6 : $init_arr[6], 'extcredits7' => $extcredits7 ? $extcredits7 : $init_arr[7], 'extcredits8' => $extcredits8 ? $extcredits8 : $init_arr[8]);
    DB::insert('common_member_count', paddslashes($count_data));
    DB::insert('common_setting', array('skey' => 'lastmember', 'svalue' => $username), false, true);
    manyoulog('user', $uid, 'add');
    $totalmembers = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member'));
    $userstats = array('totalmembers' => $totalmembers, 'newsetuser' => $username);
    checkusergroup($uid);
    //更新用户所在的用户组
    save_syscache('userstats', $userstats);
    $re_arr['uid'] = $uid;
    return $re_arr;
}
开发者ID:edmundwong,项目名称:V604,代码行数:96,代码来源:function.member.php

示例5: checkpost

function checkpost($subject, $message, $special = 0)
{
    global $_G;
    if (dstrlen($subject) > 80) {
        return 'post_subject_toolong';
    }
    if (!$_G['group']['disablepostctrl'] && !$special) {
        if ($_G['setting']['maxpostsize'] && strlen($message) > $_G['setting']['maxpostsize']) {
            return 'post_message_toolong';
        } elseif ($_G['setting']['minpostsize'] && strlen(preg_replace("/\\[quote\\].+?\\[\\/quote\\]/is", '', $message)) < $_G['setting']['minpostsize']) {
            return 'post_message_tooshort';
        }
    }
    return FALSE;
}
开发者ID:v998,项目名称:discuzx-en,代码行数:15,代码来源:function_post.php

示例6: search

 function search()
 {
     global $_G;
     $and = '';
     $url = URL . 'a=search';
     $rs = array();
     if ($_GET['kw']) {
         $string = stripsearchkey(trim($_GET['kw']));
         if (preg_match("/^%+\$|^_+\$|^\\*+\$/is", $string)) {
             msg('非法搜索关键字');
         }
         $string = safe_output($string);
         if (dstrlen($string) < 2) {
             msg('要搜索的关键字长度不能小于2');
         }
         $_GET[kw] = $string;
         $and .= " AND title like '%{$string}%' ";
         $url .= "&kw=" . urlencode_utf8($string);
         $and .= " AND `check`=1 AND `hide`=0 ";
         $and .= " AND ( end_time = 0 or  end_time > " . TIMESTAMP . ")";
         $sql = make_sql();
         $size = 60;
         $rs = D(array('and' => $and . $sql['and'], 'order' => $sql[order]), array('url' => $url . $sql[url], 'size' => $size));
         //dump($and .$sql['and'],1);
     } else {
         if ($_GET['price1'] && $_GET['price2']) {
             $sql = make_sql();
             $size = 60;
             $rs = D(array('and' => $and . $sql['and'], 'all' => true, 'order' => $sql[order], 'key' => 'search'), array('url' => $url . $sql[url], 'size' => $size));
         }
     }
     seo($string . ' - 商品搜索');
     $this->add($rs);
     $this->show();
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:35,代码来源:index.action.php

示例7: checkpost

function checkpost($subject, $message, $special = 0)
{
    global $_G;
    if (dstrlen($subject) > 255) {
        return 'post_subject_toolong';
    }
    if (!$_G['group']['disablepostctrl'] && !$special) {
        if ($_G['setting']['maxpostsize'] && strlen($message) > $_G['setting']['maxpostsize']) {
            return 'post_message_toolong';
        } elseif ($_G['setting']['minpostsize']) {
            $minpostsize = !IN_MOBILE || !$_G['setting']['minpostsize_mobile'] ? $_G['setting']['minpostsize'] : $_G['setting']['minpostsize_mobile'];
            if (strlen(preg_replace("/\\[quote\\].+?\\[\\/quote\\]/is", '', $message)) < $minpostsize || strlen(preg_replace("/\\[postbg\\].+?\\[\\/postbg\\]/is", '', $message)) < $minpostsize) {
                return 'post_message_tooshort';
            }
        }
    }
    return FALSE;
}
开发者ID:KKRainbow,项目名称:discuz-x32-php7,代码行数:18,代码来源:function_post.php

示例8: stringtopic

function stringtopic($value, $key = '', $force = false, $rlength = 0)
{
    if ($key === '') {
        $key = $value;
    }
    $basedir = !getglobal('setting/attachdir') ? './data/attachment' : getglobal('setting/attachdir');
    $url = !getglobal('setting/attachurl') ? './data/attachment/' : getglobal('setting/attachurl');
    $subdir1 = substr(md5($key), 0, 2);
    $subdir2 = substr(md5($key), 2, 2);
    $target = 'temp/' . $subdir1 . '/' . $subdir2 . '/';
    $targetname = substr(md5($key), 8, 16) . '.png';
    discuz_upload::check_dir_exists('temp', $subdir1, $subdir2);
    if (!$force && file_exists($basedir . '/' . $target . $targetname)) {
        return $url . $target . $targetname;
    }
    $value = str_replace("\n", '', $value);
    $fontfile = $fontname = '';
    $ttfenabled = false;
    $size = 10;
    $w = 130;
    $rowh = 25;
    $value = explode("\r", $value);
    if ($rlength) {
        $temp = array();
        foreach ($value as $str) {
            $strlen = dstrlen($str);
            if ($strlen > $rlength) {
                for ($i = 0; $i < $strlen; $i++) {
                    $sub = cutstr($str, $rlength, '');
                    $temp[] = $sub;
                    $str = substr($str, strlen($sub));
                    $strlen = $strlen - $rlength;
                }
            } else {
                $temp[] = $str;
            }
        }
        $value = $temp;
        unset($temp);
    }
    if (function_exists('imagettftext')) {
        $fontroot = DISCUZ_ROOT . './static/image/seccode/font/ch/';
        $dirs = opendir($fontroot);
        while ($entry = readdir($dirs)) {
            if ($entry != '.' && $entry != '..' && in_array(strtolower(fileext($entry)), array('ttf', 'ttc'))) {
                $fontname = $entry;
                break;
            }
        }
        if (!empty($fontname)) {
            $fontfile = DISCUZ_ROOT . './static/image/seccode/font/ch/' . $fontname;
        }
        if ($fontfile) {
            if (strtoupper(CHARSET) != 'UTF-8') {
                include DISCUZ_ROOT . './source/class/class_chinese.php';
                $cvt = new Chinese(CHARSET, 'utf8');
                $value = $cvt->Convert(implode("\r", $value));
                $value = explode("\r", $value);
            }
            $ttfenabled = true;
        }
    }
    foreach ($value as $str) {
        if ($ttfenabled) {
            $box = imagettfbbox($size, 0, $fontfile, $str);
            $height = max($box[1], $box[3]) - min($box[5], $box[7]);
            $len = max($box[2], $box[4]) - min($box[0], $box[6]);
            $rowh = max(array($height, $rowh));
        } else {
            $len = strlen($str) * 12;
        }
        $w = max(array($len, $w));
    }
    $h = $rowh * count($value) + count($value) * 2;
    $im = @imagecreate($w, $h);
    $background_color = imagecolorallocate($im, 255, 255, 255);
    $text_color = imagecolorallocate($im, 60, 60, 60);
    $h = $ttfenabled ? $rowh : 4;
    foreach ($value as $str) {
        if ($ttfenabled) {
            imagettftext($im, $size, 0, 0, $h, $text_color, $fontfile, $str);
            $h += 2;
        } else {
            imagestring($im, $size, 0, $h, $str, $text_color);
        }
        $h += $rowh;
    }
    imagepng($im, $basedir . '/' . $target . $targetname);
    imagedestroy($im);
    return $url . $target . $targetname;
}
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:91,代码来源:function_forum.php

示例9: register

function register()
{
    /*{{{*/
    require_once dirname(dirname(dirname(__FILE__))) . '/bigappjson.class.php';
    require_once libfile('function/misc');
    require_once libfile('function/member');
    require_once libfile('class/member');
    $userName = isset($_REQUEST["username"]) ? $_REQUEST["username"] : "";
    $password = isset($_REQUEST["password"]) ? $_REQUEST["password"] : "";
    $email = isset($_REQUEST["email"]) ? strtolower($_REQUEST["email"]) : "";
    global $_G;
    if (function_exists('iconv')) {
        $userName = iconv('UTF-8', CHARSET . '//ignore', $userName);
    } else {
        $userName = mb_convert_encoding($userName, CHARSET, 'UTF-8');
    }
    if (empty($userName) || empty($password) || empty($email)) {
        echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'empty_params'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'empty_params'))));
        die(0);
    }
    $userNamelen = dstrlen($userName);
    if ($userNamelen < 3) {
        echo BIGAPPJSON::encode(array('error_code' => 3, 'error_msg' => lang('plugin/bigapp', 'username_short'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_short'))));
        die(0);
    }
    if ($userNamelen > 15) {
        echo BIGAPPJSON::encode(array('error_code' => 4, 'error_msg' => lang('plugin/bigapp', 'username_long'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_long'))));
        die(0);
    }
    $ctlObj = new register_ctl();
    $ctlObj->setting = $_G['setting'];
    if (isset($ctlObj->setting['pwlength']) && $ctlObj->setting['pwlength']) {
        if (strlen($password) < $ctlObj->setting['pwlength']) {
            echo BIGAPPJSON::encode(array('error_code' => 5, 'error_msg' => lang('plugin/bigapp', 'password_length') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_not_equal') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]')));
            die(0);
        }
    }
    if (isset($ctlObj->setting['strongpw']) && $ctlObj->setting['strongpw']) {
        $strongpw_str = array();
        if (in_array(1, $ctlObj->setting['strongpw']) && !preg_match("/\\d+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_number');
        }
        if (in_array(2, $ctlObj->setting['strongpw']) && !preg_match("/[a-z]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_lowercase_char');
        }
        if (in_array(3, $ctlObj->setting['strongpw']) && !preg_match("/[A-Z]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_uppercase_char');
        }
        if (in_array(4, $ctlObj->setting['strongpw']) && !preg_match("/[^a-zA-Z0-9]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_charset');
        }
        if ($strongpw_str) {
            echo BIGAPPJSON::encode(array('error_code' => 6, 'error_msg' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]')));
            die(0);
        }
    }
    /*
    	if(!isset($_G['setting']['mobile']['mobileregister']) || !$_G['setting']['mobile']['mobileregister']){
    		echo BIGAPPJSON::encode(array('error_code' => 7, 'error_msg' => lang('plugin/bigapp', 'forbid_mobreg'), 
    				'Variables' => array('auth' => null),
                    'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_mobreg'))));
    		die(0);
    	}
    */
    loaducenter();
    if (!$ctlObj->setting['regclosed'] && (!$ctlObj->setting['regstatus'] || !$ctlObj->setting['ucactivation'])) {
        if (!$ctlObj->setting['regstatus']) {
            echo BIGAPPJSON::encode(array('error_code' => 8, 'error_msg' => lang('plugin/bigapp', 'forbid_registration'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_registration'))));
            die(0);
        }
    }
    if ($ctlObj->setting['regverify']) {
        if ($ctlObj->setting['areaverifywhite']) {
            $location = $whitearea = '';
            $location = trim(convertip($_G['clientip'], "./"));
            if ($location) {
                $whitearea = preg_quote(trim($ctlObj->setting['areaverifywhite']), '/');
                $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                $whitearea = '.*' . $whitearea . '.*';
                $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                if (@preg_match($whitearea, $location)) {
                    $ctlObj->setting['regverify'] = 0;
                }
            }
        }
        if ($_G['cache']['ipctrl']['ipverifywhite']) {
            foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) {
                if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                    $ctlObj->setting['regverify'] = 0;
                    break;
                }
            }
        }
    }
    if ($ctlObj->setting['regverify']) {
        $groupinfo['groupid'] = 8;
    } else {
        $groupinfo['groupid'] = $ctlObj->setting['newusergroupid'];
    }
    if (!$password || $password != addslashes($password)) {
//.........这里部分代码省略.........
开发者ID:Mushan3420,项目名称:BigApp-PHP7,代码行数:101,代码来源:platform_login.php

示例10: upload_ok

 /**
  * 
  * 更新或添加参赛记录
  * @param ccvid     int  CC视频ID
  * @param gid       int  活动ID
  * @param schedule  int  参赛排期
  */
 public function upload_ok()
 {
     $ccvid = $this->input->get_post('ccvid', true);
     $gid = intval($this->input->get_post('gid', true));
     $schedule = intval($this->input->get_post('schedule', true));
     if (dstrlen($ccvid) == 32 && $gid > 0) {
         $sid = intval($sid);
         $period = intval($period);
         $this->load->model('works_index_model', 'index_mod');
         $where = array('vid' => $ccvid, 'userid' => $this->uid);
         #参数视更新视频id 到关联表
         $video = $this->video_m->get_video($where);
         if ($video) {
             $add_index = array();
             $add_index['uid'] = $this->uid;
             $add_index['wid'] = $video['id'];
             $add_index['wtype'] = 1;
             $add_index['gid'] = $gid;
             $add_index['status'] = 1;
             $add_index['create_time'] = time();
             $w_index = array('gid' => $gid, 'uid' => $this->uid, 'schedule' => $schedule);
             $is_work_index = $this->index_mod->get_index($w_index);
             if (empty($is_work_index)) {
                 $ret_id = $this->index_mod->add_index($add_index);
                 $this->load->model('activity_model', 'activity_m');
                 $name = $this->activity_m->get_one_by_where(array('id' => $gid), 'name');
                 if ($ret_id && method_exists($this, "init_" . $name)) {
                     $this->{"init_" . $name}($gid, $ret_id, $schedule);
                 }
             }
             $updata['type'] = 1;
             $updata['info'] = 1;
             $updata['status'] = 1;
             $updata['update'] = date("Y-m-d H:i:s");
             $ret_up = $this->video_mod->up_video($updata, $where);
             if ($ret_up) {
                 $this->echo_api(1, $is_work_index);
             } else {
                 $this->echo_api(-3, "更新失败.");
             }
         } else {
             $this->echo_api(-5, "视频信息不存在.");
         }
     } else {
         if ($gid > 0) {
             $this->echo_api(-2, "CC视频ID不存在.");
         } else {
             $this->echo_api(-4, "活动ID不存在.");
         }
     }
 }
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:58,代码来源:video.php

示例11: goods

 function goods()
 {
     global $_G;
     $sql = make_sql();
     $url = 'm=ajax&a=goods';
     $size = $_G[setting][cate_page] ? $_G[setting][cate_page] : 120;
     if ($_GET['field']) {
         $sql['field'] = trim($_GET['field']);
     }
     $and = '';
     if ($_GET['kw']) {
         $string = stripsearchkey(trim($_GET['kw']));
         if (preg_match("/^%+\$|^_+\$|^\\*+\$/is", $string)) {
             msg('非法搜索关键字');
         }
         $string = safe_output($string);
         if (dstrlen($string) < 2) {
             msg('要搜索的关键字长度不能小于2');
         }
         $_GET[kw] = $string;
         $and .= " AND title like '%{$string}%' ";
         $url .= "&kw=" . urlencode_utf8($string);
     }
     if ($_GET[tag]) {
         $tag = trim_html($tag, 1);
         $tag = daddslashes($_GET[tag]);
         $and .= "AND FIND_IN_SET('" . $tag . "', keywords) ";
         $url .= "&tag=" . urlencode_utf8($tag);
         $sql['and'] .= $and;
         $sql['url'] .= $url;
     }
     $rs = D(array('and' => $and . $sql['and'], 'all' => false, 'order' => $sql[order]), array('url' => $url . $sql[url], 'size' => $size));
     $goods = array();
     foreach ($rs['goods'] as $k => $v) {
         $tmp = array();
         $tmp['picurl'] = $v['picurl'];
         $tmp['url'] = $v['url'];
         $tmp['id_url'] = $v['id_url'];
         $tmp['num_iid'] = $v['num_iid'];
         $tmp['aid'] = $v['aid'];
         $tmp['yh_price'] = $v['yh_price'];
         $tmp['sum'] = $v['sum'];
         $tmp['like'] = $v['like'];
         $tmp['title'] = $v['title'];
         $tmp['username'] = $v['username'];
         $goods[] = $tmp;
     }
     json(array('data' => $goods, 'status' => 'success'));
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:49,代码来源:ajax.action.php

示例12: replaceparting

     $skype = replaceparting(dhtmlspecialchars(trim($_G['sr_skype'])));
     $tel = replaceparting(dhtmlspecialchars(trim($_G['sr_tel'])));
 } else {
     $qq = dhtmlspecialchars(trim($_G['sr_qq']));
     $tel = dhtmlspecialchars(trim($_G['sr_tel']));
 }
 $address = dhtmlspecialchars(trim($_G['sr_address']));
 $mappos = dhtmlspecialchars(trim($_G['sr_mappos']));
 $weburl = 'http://' . str_replace('http://', '', dhtmlspecialchars(trim($_G['sr_weburl'])));
 if (dstrlen($propaganda) > 1000) {
     showmessage(srlang('post_propaganda_toolong'));
 }
 if (dstrlen($introduction) > 4000) {
     showmessage(srlang('post_introduction_toolong'));
 }
 if (dstrlen($contact) > 1000) {
     showmessage(srlang('post_contact_toolong'));
 }
 if ($cateid < 1) {
     showmessage(srlang('nocateid'));
 }
 if (empty($name)) {
     showmessage(srlang('noname'));
 }
 $caid = intval($_G['sr_caid']);
 if ($caid < 1 && $bid < 1) {
     showmessage(srlang('inputposter'));
 }
 $attachment = C::t('#sanree_brand#sanree_brand_attachment')->fetch_firstbyaid($caid);
 if (!$attachment) {
     showmessage(srlang('inputposter'));
开发者ID:herosrx,项目名称:shops,代码行数:31,代码来源:sanree_brand_published.php

示例13: sub_str

function sub_str($str, $start, $end)
{
    $str = preg_replace("/\\s+/", '', $str);
    $start = preg_replace("/\\s+/", '', $start);
    if ($end != -1) {
        $end = preg_replace("/\\s+/", '', $end);
    }
    $s = strpos($str, $start);
    $str1 = substr($str, $s + dstrlen($start));
    $e = $end == -1 ? dstrlen($str1) : strpos($str1, $end);
    return substr($str1, 0, $e);
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:12,代码来源:core.function.php

示例14: api_get

 private function api_get($add_page)
 {
     global $_G;
     $url = URL . 'm=list';
     if ($_G['fid'] > 0) {
         $url .= "&fid=" . $_G['fid'];
     }
     $channel = $_G['channel'];
     $cid = 0;
     $arr = array();
     if ($_GET['cid']) {
         $cid = intval($_GET['cid']);
         $cates = (include libfile('config/taobao_cate'));
         $cate = array();
         foreach ($cates as $k => $v) {
             if ($v['cid'] == $cid) {
                 $cate = $v;
                 break;
             } elseif ($v['sub']) {
                 foreach ($v['sub'] as $k1 => $v2) {
                     if ($v2['cid'] == $cid) {
                         $cate = $v2;
                         break;
                     }
                 }
             }
         }
         if (!$cate['cid']) {
             msg('分类ID不存在');
         }
         $title = $cate['name'];
     } elseif ($channel) {
         $cid = intval($channel['classname']);
         $title = $channel[name];
     }
     if ($cid > 0) {
         $arr['cid'] = $cid;
     }
     if ($_GET['kw']) {
         $string = stripsearchkey(trim($_GET['kw']));
         if (preg_match("/^%+\$|^_+\$|^\\*+\$/is", $string)) {
             msg('非法搜索关键字');
         }
         $string = safe_output($string);
         if (dstrlen($string) < 2) {
             msg('要搜索的关键字长度不能小于2');
         }
         $_GET[kw] = $string;
         $arr['keyword'] = $string;
         $url .= "&kw=" . $string;
         $title .= " " . $string;
         unset($arr['cid']);
     }
     if ($_GET['sort']) {
         $order_in = array('price_asc', 'sales_desc', 'credit_desc');
         if (in_array($_GET['sort'], $order_in)) {
             $arr['sort'] = $_GET['sort'];
             $url .= "&sort = " . $_GET['sort'];
             unset($_GET['sort']);
         }
     }
     if (!$_GET[kw]) {
         unset($_GET['kw']);
     }
     if (!$arr[keyword] && !$arr['cid']) {
         $arr[keyword] = '特价';
     }
     $arr['start_price'] = 1;
     $arr['end_price'] = 99999;
     if ($_GET['price1']) {
         $_GET['price1'] = $arr['start_price'] = floatval($_GET['price1']);
         $url .= "&price1=" . $arr['start_price'];
     }
     if ($_GET['price2']) {
         $_GET['price2'] = $arr['end_price'] = floatval($_GET['price2']);
         $url .= "&price2=" . $arr['end_price'];
     }
     if ($_GET['sort']) {
         $sort_arr = array("price_desc", "price_asc", "credit_desc", "credit_asc", "commission_num_desc", "commission_rate_asc");
         if (in_array($_GET['sort'], $sort_arr)) {
             $arr['sort'] = $_GET['sort'];
             $url .= "&sort=" . $arr['sort'];
         }
     }
     //分页大小,优站 40   淘客 40 - 100
     $size = $channel['page'] > 0 ? intval($channel['page']) : $_G['setting'][cate_page];
     if ($size > 100) {
         $size = 100;
     }
     $arr[page_no] = $add_page ? $_G[page] + $add_page : $_G[page];
     $arr[page_size] = $size;
     $key = md5(http_build_query($arr));
     $size = 40;
     $rs = memory('get', $key);
     //接口类型  1 = 优站  2= 淘客
     if (!$rs) {
         if ($goods) {
             $rs = array('showpage' => $showpage, 'count' => $count, 'goods' => $goods);
             memory('set', $key, $rs, 3600);
         }
//.........这里部分代码省略.........
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:101,代码来源:list.action.php

示例15: checkProposalField

function checkProposalField($param)
{
    if (empty($param['contact'])) {
        $reault = array(-1, '联系方式不能为空');
        return $reault;
    }
    $param['contact'] = trim($param['contact']);
    if (!is_numeric($param['contact']) || strlen($param['contact']) > 15) {
        $reault = array(-2, '联系方式必须是整形且长度不超过15个数字');
        return $reault;
    }
    if (empty($param['funtions']) || dstrlen($param['funtions']) > 30) {
        $reault = array(-3, '请输入功能点且长度不大于15个中文字符');
        return $reault;
    }
    if (empty($param['backgrounds']) || dstrlen($param['backgrounds']) > 2000) {
        $reault = array(-4, '请输入需求背景且长度不大于1000');
        return $reault;
    }
    if (empty($param['description']) || dstrlen($param['description']) > 2000) {
        $reault = array(-5, '请输入功能描述且长度不大于1000');
        return $reault;
    }
    $reault = array(1, '成功');
    return $reault;
}
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:26,代码来源:bug.php


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