public function manage() { if ($this->checkAuthority()) { $this->getPublicInfo(); $page = trimall($this->_get('charge', 'strip_tags', 'category')); switch ($page) { case 'category': $this->display('manage_category'); break; case 'message': $this->display('manage_message'); break; case 'follow': $this->display('manage_follow'); break; case 'fan': $this->display('manage_fan'); break; case 'web': $this->display('manage_web'); break; case 'profile': $this->display('manage_profile'); break; default: $this->error('出错了'); } } else { $this->error('请先登录', U('/login')); } }
function findurl($keywords) { $find = '鲁大学生网'; $url_tmpl = "http://www.baidu.com/s?word=%s&pn=%d"; $result = array(); foreach ($keywords as $k => $v) { $i = 0; while ($i <= 1000) { $url = sprintf($url_tmpl, urlencode($v), $i); $contents = trimall(getpage($url)); $pattern = '/title":"' . $find . '(.*?)url":"(.*?)"/si'; preg_match($pattern, $contents, $matches); $site_url = isset($matches[2]) ? $matches[2] : null; if ($site_url) { $ua = getua(); $page_content = getpage($site_url, array('ua' => $ua)); $result[] = array('page' => $i / 10 + 1, 'keyword' => $v, 'url' => $site_url); break; } else { $i += 10; } } } return $result; }
/** * 用户token获取 **/ public function userLogin() { $username = check_empty(trimall(strip_tags($this->input->post('username', TRUE))), FALSE, '1002'); $password = check_empty(trimall(strip_tags($this->input->post('password', TRUE))), FALSE, '1003'); //f61e83b9c803be5003ceddacfc6010ba $namelen = strlen($username); if ($namelen < 4 || $namelen > 16) { response_code('1002'); } $passlen = strlen($password); if ($passlen != 32) { response_code('1003'); } $user = $this->model->get_user_auth_by_name($username); if (!$user) { response_code('1004'); } //密码错误 if (md5($password . $user['salt']) != $user['user_pass']) { response_code('1004'); } if ($user['role'] == 'innholder') { $inn = $this->model->get_user_inn($user['user_id']); $user['inn_id'] = $inn['inn_id']; } $data['token'] = $this->create_token($user); response_data($data); }
function clean_array_null($v) { $v = trimall($v); if (!empty($v)) { return true; } return false; }
/** * 注册 */ public function register() { if (IS_POST) { $data = array(); $smscode = trim($_POST['smscode']); if (empty($smscode)) { $this->error('验证码为空'); } $data['mobile'] = str_rp(trim($_POST['mobile'])); if ($smscode == session('smscode') && session('codetype') == 'register' && session('mobile') == $data['mobile']) { $spread = ''; $data['pwd'] = re_md5($_POST['pwd']); $inviter = str_rp(trimall($_POST['inviter'])); if ($inviter) { $inviter = explode('_', $inviter); if (is_array($inviter)) { $data['inviter_type'] = intval($inviter[0]); $data['inviter_id'] = intval($inviter[1]); $spread['inviter_id'] = $data['inviter_id']; $spread['inviter_type'] = $data['inviter_type']; $spread['invited_type'] = 1; $spread['spread_stage'] = 0; $spread['spread_time'] = NOW_TIME; $spread['spread_reward'] = 2; } } $data['register_time'] = NOW_TIME; $api = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php'; $ipparam['format'] = 'js'; $ipparam['ip'] = get_client_ip(); $res = get_api($api, $ipparam, 'array'); if (!empty($res['city'])) { $data['city'] = $res['city']; } $seller_id = $this->model->add($data); if ($seller_id) { unset($data); //推广赏金 if (is_array($spread) && !empty($spread)) { $spread['invited_id'] = $seller_id; M('SpreadLog')->add($spread); } session(null); session('seller_id', $seller_id); $this->success("注册成功!", U('Member/index')); exit; } } else { $this->error('验证码错误'); } } elseif (IS_GET) { $this->check_login(); $this->display(); } }
/** * 判断是否有不合法的词 * @param $string 验证字符串 * @return boolean 检测结果 * @author 麦当苗儿 <*****@*****.**> */ function check_badkey($string) { //$badkey = "敏感词|敏感词B|敏感词C"; $badkey = C('BAD_KEY'); if (preg_match("/{$badkey}/i", trimall($string))) { $ret = true; } else { $ret = false; } return $ret; }
/** * * 获取允许自定义积分规则 ... */ public function getNoSetDiyRules() { $creditRules = new creditrules(); $Members = new members(); $appid = trimall($this->input['app_uniqueid']); if (empty($appid)) { $this->errorOutput('请传应用标识'); } $appDiyRule = $Members->getDiyRulesInfo($appid); $diy = $creditRules->getDiyRules('operation,rname,opened'); foreach ($diy as $k => $v) { if (!array_key_exists($k, $appDiyRule)) { $this->addItem_withkey($k, $v); } } $this->output(); }
/** * 订单退订入口 */ public function cancel() { $order_num = input_num($this->input->get('oid'), 10000, FALSE, FALSE, '3001'); $comment = trimall($this->input->post('comment', TRUE)); $order = $this->model->get_order_detail_by_order_num($order_num, '', $this->token['inn_id'], FALSE); if (!$order || $order['seller_inn'] != $this->token['inn_id']) { response_msg('3002'); } if (!in_array($order['state'], array('A', 'P', 'U'))) { response_msg('3004'); } $done = array('user_id' => $this->token['user_id'], 'comment' => $comment); if ($this->model->order_cancel($order, $done)) { response_msg('1'); } response_msg('4000'); }
/** * * 获取已经定义的应用积分规则信息 ... */ public function getAppDiyRulesInfo($iSret = false) { $app_uniqueid = trimall($this->input['app_uniqueid']); if (!$app_uniqueid && !$iSret) { $this->errorOutput(NO_APPUNIQUEID); } $AppDiyRulesInfo = $this->Members->getDiyRulesInfo($app_uniqueid); if ($iSret) { return $AppDiyRulesInfo; } if (is_array($AppDiyRulesInfo)) { foreach ($AppDiyRulesInfo as $k => $v) { unset($v['appids'], $v['gids']); $this->addItem_withkey($k, $v); } } else { $this->addItem($AppDiyRulesInfo); } $this->output(); }
/** * 发起新的申诉 */ public function create() { if (IS_POST) { $data['rp_class_id'] = intval($_POST['rp_class_id']); $data['order_sn'] = str_rp(trimall($_POST['order_sn'])); $data['content'] = str_rp(trim($_POST['content'])); $data['addtime'] = NOW_TIME; $data['seller_id'] = $this->mid; $where['order_sn'] = $data['order_sn']; $where['seller_id'] = $data['seller_id']; $data['member_id'] = M('Order')->where($where)->getField('buyer_id'); $data['from_to'] = -1; $data['handle_status'] = 0; if ($data['member_id']) { $map['order_sn'] = $data['order_sn']; $map['from_to'] = -1; $count = $this->model->where($map)->count(); if ($count) { $this->error('您已经提交过相关申诉,请耐心等待.'); die; } $res = $this->model->add($data); if ($res) { $detail['report_id'] = $res; $detail['content'] = '你对买家发起申诉'; $detail['addtime'] = NOW_TIME; M('ReportDetail')->add($detail); $this->success('申诉成功.'); } else { $this->error('抱歉,申诉申请失败.请联系客服.'); } } else { $this->error('抱歉,没有相关订单信息.'); } } elseif (IS_GET) { $rp_class = $this->classModel->where(array('rp_class_belong' => 1))->order('rp_class_sort desc')->select(); $this->assign('rp_class', $rp_class); $this->h3_title = '发起新的申诉'; $this->display(); } }
/** * * 重置密码发送验证码接口 ... */ public function rePasswordSendSms() { $memberId = 0; if ($memberName = trimall($this->input['member_name'])) { if (hg_check_email_format($memberName)) { $this->errorOutput('请填写正确的用户名'); } if (hg_verify_mobile($memberName)) { $memberId = $this->Members->get_member_id($memberName, false, false, 'shouji'); if ($memberId) { $isMobile = 1; $platform_id = $memberName; } } if (!$memberId) { $memberId = $this->Members->get_member_id($memberName, false, false, 'm2o'); } if (!$memberId) { $memberId = $this->Members->get_member_id($memberName, false, false, 'uc'); } if (!$memberId) { $this->errorOutput(NO_MEMBER); } if (!$isMobile) { if ($mobile = trimall($this->input['mobile'])) { $checkBind = new check_Bind(); $platform_id = $checkBind->check_Bind($memberId, 'shouji'); if ($platform_id && $platform_id != $mobile) { $this->errorOutput('对不起,您填写的手机号不正确,请重新输入!'); } elseif (empty($platform_id)) { $this->errorOutput('对不起,您需找回的帐号未绑定手机号!'); } } else { $this->errorOutput('请输入正确的手机号,并获取验证码!'); } } $this->send_sms(); } else { $this->errorOutput(NO_MEMBER_NAME); } }
/** *新增规则 * @see adminUpdateBase::create() */ public function create() { if (!($app_uniqueid = trimall($this->input['app_uniqueid']))) { $this->errorOutput('应用标识未传值'); } if (!($operation = trimall($this->input['operation']))) { $this->errorOutput('积分规则操作key未传值'); } $data = $this->filter_data(); //获取提交的数据 //验证标识是否重复 $checkResult = $this->membersql->verify('credit_rules_custom_app', array('appid' => $app_uniqueid, 'operation' => $operation)); if ($checkResult) { $this->errorOutput('此应用积分规则已被自定义'); } if ($data) { $creditsRulesDiy = $this->Members->getDiyRulesInfo($app_uniqueid); $newDiyRules = array_merge($creditsRulesDiy, array($operation => $data)); $reDiyApp = $this->Members->credits_rules_diy_app($app_uniqueid, $newDiyRules); $this->diyOutPut($reDiyApp); } }
function keyword_sel($res, $cont) { $keyword_result = array(); $ee = 0; foreach ($res as $row) { $keyword = explode("|", delhtml(trimall($row['con']))); $sel_sign = $this->sel_word($keyword, $cont); //有匹配数据时 if ($sel_sign) { $keyword_result[$ee]['id'] = $row['id']; $keyword_result[$ee]['title'] = $row['title']; $keyword_result[$ee]['url'] = $row['url']; $keyword_result[$ee]['con'] = $row['con']; $keyword_result[$ee]['intr'] = $row['intr']; $ee++; } else { //无匹配数据时下一个数组中对应的关键字 $sel_sign = $this->sel_word($keyword, $cont); } } return $keyword_result; }
private function check_forum_post($type) { $forum = array(); $forum['city'] = check_empty(trimall(strip_tags($this->input->post('city'))), ''); $forum['lat'] = checkLocationPoint($this->input->post('lat'), 'lat', ''); //坐标可不传 $forum['lon'] = checkLocationPoint($this->input->post('lon'), 'lon', ''); if (empty($forum['lat']) || empty($forum['lon'])) { $forum = array(); } $forum['forum_name'] = check_empty(trimall(strip_tags($this->input->post('title'))), '', '6014'); $forum['type'] = $type; $tags = check_empty(trimall(strip_tags($this->input->post('tags'))), ''); if ($tags) { $detail['tags'] = array(); $tags = explode(',', $tags); foreach ($tags as $key => $row) { if (!$row) { continue; } if (mb_strlen($row) > 6) { response_json('6033', '标签:"' . $row . '" 字数过长'); } $detail['tags'][] = $row; } if (count($detail['tags']) > 3) { response_code('6032'); } $detail['tags'] = implode(',', $detail['tags']); } else { $detail['tags'] = ''; } $detail['note'] = check_empty(strip_tags($this->input->post('note')), ''); $detail['pictures'] = trimall(strip_tags($this->input->post('images', TRUE))); if ($type == 'jianren') { $detail['line'] = check_empty(trimall(strip_tags($this->input->post('line', TRUE))), FALSE, '6016'); if (empty($forum['forum_name'])) { $forum['forum_name'] = $detail['line']; } $start_time = check_empty($this->input->post('start_time'), FALSE, '6017'); if (substr_count($start_time, '-') != 2) { response_code('6024'); } list($year, $month, $day) = explode('-', $start_time); if (!$year || !$month || !$day || !checkdate($month, $day, $year)) { response_code('6024'); } $start_time = strtotime($start_time); if (!$start_time || $start_time < TIME_NOW - 86500 || $start_time > TIME_NOW + 31536000) { response_code('6024'); } $detail['start_time'] = $start_time; $detail['day'] = input_int($this->input->post('day'), 0, 250, FAlSE, '6015'); } else { $detail['pictures'] = check_empty($detail['pictures'], FALSE, '6013'); } if (empty($forum['forum_name'])) { response_code('6014'); } return array('forum' => $forum, 'detail' => $detail); }
/** * 维修进度 */ public function progress() { $rp_sn = trimall($_GET['sn']); $where['rp_sn'] = $rp_sn; $where['member_id'] = $this->mid; $info = D('Repair')->relation(true)->where($where)->find(); unset($info['RepairLog']); $info['RepairLog'] = M('RepairLog')->where(array('rp_id' => $info['rp_id'], 'is_view' => 1))->order('log_time')->select(); $this->assign('info', $info); $this->display(); }
/** * * 找回密码验证方法(支持验证输入的手机号是否已经绑定) ... */ public function reSetPasswordUser() { $type = isset($this->input['type']) ? intval($this->input['type']) : -1; //找回类型 $identifierUserSystem = new identifierUserSystem(); $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier(); //多用户系统 $memberId = 0; $isEmail = 0; $isMobile = 0; if ($memberName = trimall($this->input['member_name'])) { if (hg_check_email_format($memberName)) { $memberId = $this->Members->get_member_id($memberName, false, false, 'email', $identifier); if ($memberId) { $isEmail = 1; $platform_id = $memberName; } } elseif (hg_verify_mobile($memberName)) { $memberId = $this->Members->get_member_id($memberName, false, false, 'shouji', $identifier); if ($memberId) { $isMobile = 1; $platform_id = $memberName; } } if (!$memberId) { $memberId = $this->Members->get_member_id($memberName, false, false, 'm2o', $identifier); } if (!$memberId) { $memberId = $this->Members->get_member_id($memberName, false, false, 'uc', $identifier); } if (!$memberId) { $this->errorOutput(NO_MEMBER); } if ($type == 1) { if (!$isEmail) { if ($email = trimall($this->input['email'])) { $checkBind = new check_Bind(); $platform_id = $checkBind->check_Bind($memberId, 'email'); if ($platform_id && $platform_id != $email) { $this->errorOutput(EMAIL_BIND_ACCOUNT_ERROR); } else { if (!$platform_id) { $this->errorOutput(EMAIL_NO_BIND_ACCOUNT); } } } else { $this->errorOutput(EMAIL_INPUT_BIND_ACCOUNT); } } } elseif ($type == 0) { if (!$isMobile) { if ($mobile = trimall($this->input['mobile'])) { $checkBind = new check_Bind(); $platform_id = $checkBind->check_Bind($memberId, 'shouji'); if ($platform_id && $platform_id != $mobile) { $this->errorOutput(MOBILE_BIND_ACCOUNT_ERROR); } elseif (empty($platform_id)) { $this->errorOutput(MOBILE_NO_BIND_ACCOUNT); } } else { $this->errorOutput(MOBILE_INPUT_BIND_ACCOUNT); } } } else { $this->errorOutput(REPASSWORD_TYPE_ERROR); } $this->input['member_name'] = $platform_id; $this->reset_password(); } else { $this->errorOutput(NO_MEMBER_NAME); } }
private function check_inn_info() { $innInfo = array(); $innInfo['inn_name'] = check_empty(trimall(strip_tags($this->input->post('inn_name', TRUE))), FALSE, '1010'); $innInfo['dest_id'] = input_int($this->input->post('dest_id'), 1, FALSE, FALSE, '1011'); $innInfo['local_id'] = input_int($this->input->post('local_id'), 1, FALSE, FALSE, '1012'); $profit = check_empty($this->input->post('profit'), FALSE, '1013'); $innInfo['profit'] = sprintf("%.2f", $profit); if ($innInfo['profit'] < 0 || $innInfo['profit'] > 100) { response_code('1013'); } $innInfo['inner_contacts'] = check_empty(trimall(strip_tags($this->input->post('inner_contacts'))), FALSE, '1014'); $innInfo['inner_moblie_number'] = input_mobilenum($this->input->post('inner_moblie_number'), '1015'); //默认为用户账号(手机号) $bdlon = number_format(check_empty($this->input->post('bdlon'), FALSE, '1016'), 7, '.', ""); $bdlat = number_format(check_empty($this->input->post('bdlat'), FALSE, '1016'), 7, '.', ""); $gps = BD09LLtoWGS84($bdlon, $bdlat); $innInfo['lon'] = $gps[0]; $innInfo['lat'] = $gps[1]; $innInfo['bdgps'] = $bdlon . ',' . $bdlat; /* $innInfo['bank_info'] = check_empty(trimall(strip_tags($this->input->post('bank_info'))),FALSE,'1017'); $innInfo['bank_account_no'] = input_num(trimall($this->input->post('bank_account_no')),FALSE,FALSE,FALSE,'1018'); $innInfo['bank_account_no'] = check_luhn($innInfo['bank_account_no'],'1018'); $innInfo['bank_account_name'] = check_empty(trimall(strip_tags($this->input->post('bank_account_name'))),FALSE,'1019'); */ $innInfo['bank_info'] = $this->input->post('bank_info', TRUE); $innInfo['bank_account_no'] = $this->input->post('bank_account_no', TRUE); $innInfo['bank_account_name'] = $this->input->post('bank_account_name', TRUE); $innInfo['inner_telephone'] = check_empty(trimall(strip_tags($this->input->post('inner_telephone'))), ''); $innInfo['inn_address'] = check_empty(trimall(strip_tags($this->input->post('inn_address'))), FALSE, '1020'); return $innInfo; }
/** * 积分规则自定义函数(应用自定义规则),如果某个应用的某个定义规则需要删除,则不传即可。否则不需要删除的,都需要重新传一次 */ public function credits_rules_diy_app($appid, $rules_diy) { /** * *配置属性:字段类型(支持检测类型):type 目前仅支持整形和字符型;支持属性:min 最小(值或者字符串个数)限制,max最大(值或者字符串个数)限制,legal允许填的合法值(例如某个字段只限制0或者1,就设置array(0,1))... *备注:每项参数进行参数检测之前都要进行根据type内容进行强制类型转换 * @var array() */ $configDiyField = array('rname' => array('type' => 'string', 'min' => '1', 'max' => '10'), 'opened' => array('type' => 'int', 'legal' => array(0)), 'cyclelevel' => array('type' => 'int', 'min' => '0', 'max' => '4'), 'cycletype' => array('type' => 'int', 'min' => '0', 'max' => '4'), 'cycletime' => array('type' => 'int', 'min' => '0'), 'rewardnum' => array('type' => 'int', 'min' => '0'), 'credit1' => array('type' => 'int'), 'credit2' => array('type' => 'int')); $appid = trimall($appid); if (empty($appid)) { return array('status' => 0); } $op = array(); if ($rules_diy && is_array($rules_diy)) { $op = array_keys($rules_diy); //取更新的积分规则key $rules = $this->getcreditrule($op, true); //获取积分规则 /**处理提交的数据开始**/ foreach ($rules_diy as $k => $v) { if (is_array($v) && $rules[$k]['iscustom']) { foreach ($v as $kk => $vv) { if (array_key_exists($kk, $configDiyField) && isset($rules[$k][$kk])) { if ($configDiyField[$kk]['type'] == 'string') { $rules_diy[$k][$kk] = $vv = (string) $vv; } elseif ($configDiyField[$kk]['type'] == 'int') { $rules_diy[$k][$kk] = $vv = (int) $vv; } if (is_string($vv)) { $strlen = mb_strlen($vv, 'UTF8'); if (isset($configDiyField[$kk]['min']) && !($strlen >= $configDiyField[$kk][min])) { return array('status' => -1); //值小于最小限制 } if (isset($configDiyField[$kk]['max']) && !($strlen <= $configDiyField[$kk][max])) { return array('status' => -2); //值大于最大限制 } if (isset($configDiyField[$kk]['legal']) && !in_array($vv, $configDiyField[$kk]['legal'])) { return array('status' => -3); //值不合法,不在可设置范围 } } if (is_int($vv)) { if (isset($configDiyField[$kk]['min']) && !($vv >= $configDiyField[$kk][min])) { return array('status' => -1); //值小于最小限制 } if (isset($configDiyField[$kk]['max']) && !($vv <= $configDiyField[$kk][max])) { return array('status' => -2); //值大于最大限制 } if (isset($configDiyField[$kk]['legal']) && !in_array($vv, $configDiyField[$kk]['legal'])) { return array('status' => -3); //值不合法,不在可设置范围 } } } else { unset($rules_diy[$k][$kk]); //unset掉不允许定义的字段,防止非法数据 } } } else { unset($rules_diy[$k]); //unset掉不允许定义的规则,防止非法数据 } } /**处理提交的数据结束**/ } $old_rules = array(); $insert = array(); $sql = "SELECT appids,operation FROM " . DB_PREFIX . "credit_rules WHERE appids <>''"; $query = $this->db->query($sql); while ($row = $this->db->fetch_array($query)) { if ($row['appids'] && is_string($row['appids'])) { $appids = explode(',', $row['appids']); } else { $appids = array(); } $old_rules[$row['operation']] = $appids; } foreach ($old_rules as $key => $val) { if (in_array($key, $op)) { if (!in_array($appid, $val)) { $insert[$key] = $val; $insert[$key][] = $appid; } else { $insert[$key] = $val; } } elseif (!in_array($key, $op)) { if (in_array($appid, $val)) { $insert[$key] = $val; $arr_key = array_search($appid, $insert[$key]); array_splice($insert[$key], $arr_key, 1); } elseif (!in_array($gid, $val)) { $insert[$key] = $val; } } if (empty($insert[$key])) { $insert[$key] = array(); } } if (is_array($op)) { foreach ($op as $key) { if (empty($insert[$key])) { $insert[$key][] = $appid; } } } foreach ($insert as $key => $val) { $appidss = is_array($val) && $val ? implode(',', $val) : ''; $this->membersql->update('credit_rules', array('appids' => $appidss), array('operation' => trim($key))); } if (empty($rules_diy)) { $this->membersql->delete('credit_rules_custom_app', array('appid' => $appid)); } else { $appDiyRules = $this->getDiyRulesInfo($appid); $oldOp = array_keys($appDiyRules); $delOp = array_diff($oldOp, $op); if (is_array($delOp) && $delOp) { $this->membersql->delete('credit_rules_custom_app', array('appid' => $appid, 'operation' => $delOp)); } $rules_update = array(); if (is_array($rules_diy)) { foreach ($rules_diy as $k => $rule) { foreach ($rule as $key => $val) { $rules_update[$k][$key] = $val; } $rules_update[$k]['appids'] = implode(',', $insert[$k]); } } $insertkey = array('appid' => $appid); $insertData = array(); foreach ($rules_update as $k => $v) { $insertkey['operation'] = $k; if (array_key_exists($k, $appDiyRules) && $v) { $insertData['rules'] = maybe_serialize($v); $this->membersql->update('credit_rules_custom_app', $insertData, $insertkey); } elseif ($v) { $insertData = $insertkey; $insertData['rules'] = maybe_serialize($v); $this->membersql->create('credit_rules_custom_app', $insertData); } } } return array('status' => 1, 'rules' => $rules_update); }
include_once '../functions/functions.php'; //some function *** required // online players $onlinecallback = isset($_GET['onlinecallback']) ? trim($_GET['onlinecallback']) : ''; // *** required for jsonp and json $path = "E:/Steam/SteamApps/common/Unturned/"; // where is your game root do not delete the last "/" use "/" instead of "\" $file = $path . "Unturned_Data/Managed/mods/OnlinePlayers/OnlinePlayers.txt"; // do not change this if (empty($_GET['port'])) { $data = array('status' => 'error arg p or port can not empty'); $data = json_encode($data); } else { $port = $_GET['port']; exec("netstat -aon|findstr" . " " . $port, $port_return); if (!empty($port_return)) { $exp = explode("*:*", $port_return[0]); $data['status']['pid'] = trimall($exp[1]); $data['status']['server_status'] = 'running'; if (alexReadFile($file)) { $fileArr = explode("\r\n", trim(alexReadFile($file))); $data = end($fileArr); } } else { $data['status']['pid'] = "NULL"; $data['status']['server_status'] = "stopped"; $data = json_encode($data); } } echo $onlinecallback . $data; // this line required ****
function addDomain() { $data = array('cid' => p('uid'), 'uid' => uid(), 'bidlimit' => p('bidlimit'), 'reserveprice' => p('reserveprice'), 'credit' => DOMAIN_SELL_CREDIT_LOCK, 'domainname' => trimall(p('domainname')), 'register' => htmlspecialchars(p('register')), 'expiration' => strtotime(p('expiration')), 'tradeway' => implode(',', p('tradeway')), 'deadline' => strtotime(p('deadline')), 'totalbonus' => p('totalbonus'), 'percentbonus' => p('percentbonus'), 'description' => htmlspecialchars(p('description')), 'checked' => 1, 'pubdate' => time()); $this->db->insert($this->table, $data); return $this->db->insert_id(); }
private function check_user_info_value() { $nickname = $this->input->post('nickname', TRUE); $headimg = $this->input->post('headimg', TRUE); $signature = $this->input->post('signature', TRUE); $birthday = $this->input->post('birthday', TRUE); $sex = $this->input->post('sex', TRUE); $user = array(); if ($nickname) { $user['nick_name'] = check_empty(trimall(strip_tags($nickname)), FALSE, '1023'); } if ($headimg) { $user['headimg'] = check_empty(trimall(strip_tags($headimg)), FALSE, '1024'); } if ($signature) { $user['signature'] = check_empty(trimall(strip_tags($signature)), FALSE, '1025'); } if ($birthday) { $birthday = check_birthday($birthday); if (!$birthday) { response_code('1022'); } $user['birthday'] = $birthday; } if ($sex) { $user['sex'] = input_string($sex, array('F', 'M'), FALSE, '1021'); } return $user; }
/** * * 获取需要的条件 */ private function get_condition() { //搜索标签 if ($this->input['searchtag_id']) { $searchtag = $this->searchtag_detail(intval($this->input['searchtag_id'])); foreach ((array) $searchtag['tag_val'] as $k => $v) { if (in_array($k, array('_id'))) { //防止左边栏分类搜索无效 continue; } $this->input[$k] = $v; } } //搜索标签 if (isset($this->input['k']) && !empty($this->input['k']) || (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0')) { if (isset($this->input['k']) && !empty($this->input['k'])) { $key = trim($this->input['k']); } elseif (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0') { $key = trim($this->input['key']); } $binary = ''; //不区分大小些 if (defined('IS_BINARY') && !IS_BINARY) { $binary = 'binary '; } $condition .= ' AND ' . $binary . ' title like \'%' . $key . '%\''; $memberMySet = new memberMySet(); $markInfo = $memberMySet->show($condition, 0, 0, 'mark', 'mark', '', 0); $this->memberMyData->setParams('mark', $markInfo, 'myd'); } else { $this->input['mark'] && ($TParams = $this->memberMyData->setMark(trim($this->input['mark']))); if ($TParams == -3) { $this->errorOutput(PROHIBIT_CN); } elseif ($TParams == -4) { $this->errorOutput(MARK_CHARACTER_ILLEGAL); } elseif ($TParams == -5) { $this->errorOutput(MARK_ERROR); } else { if (trim($this->input['mark']) == $TParams) { $this->memberMyData->setParams('mark', null, 'myd'); } } } $this->memberMyData->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member_myset as mms ON myd.mark=mms.mark'); if (isset($this->input['member_name']) && ($member_name = trimall($this->input['member_name']))) { $members = new members(); $member_id = $members->get_member_id($member_name, false); $member_id && $this->memberMyData->setParams('member_id', $member_id, 'myd'); !$member_id && $this->errorOutput(NO_MEMBER); } $this->memberMyData->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON myd.member_id=m.member_id'); if (isset($this->input['search']) && ($search = $this->input['search'])) { $this->memberMyData->setParamType('search', 'fuzzy', 1, 'myd'); $this->memberMyData->setParams('search', $search, 'myd'); } if ($this->input['start_time']) { $start_time = strtotime(trim(urldecode($this->input['start_time']))); $condition = " AND myd.create_time >= " . $start_time; $this->memberMyData->setSql()->where($condition); } if ($this->input['end_time']) { $end_time = strtotime(trim(urldecode($this->input['end_time']))); $condition = " AND myd.create_time <= " . $end_time; $this->memberMyData->setSql()->where($condition); } if (isset($this->input['date_search']) && !empty($this->input['date_search'])) { $today = strtotime(date('Y-m-d')); $tomorrow = strtotime(date('y-m-d', TIMENOW + 24 * 3600)); switch (intval($this->input['date_search'])) { case 1: //所有时间段 break; case 2: //昨天的数据 $yesterday = strtotime(date('y-m-d', TIMENOW - 24 * 3600)); $condition = " AND myd.create_time > '" . $yesterday . "' AND myd.create_time < '" . $today . "'"; $this->memberMyData->setSql()->where($condition); break; case 3: //今天的数据 $condition = " AND myd.create_time > '" . $today . "' AND myd.create_time < '" . $tomorrow . "'"; $this->memberMyData->setSql()->where($condition); break; case 4: //最近3天 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600)); $condition = " AND myd.create_time > '" . $last_threeday . "' AND myd.create_time < '" . $tomorrow . "'"; $this->memberMyData->setSql()->where($condition); break; case 5: //最近7天 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600)); $condition = " AND myd.create_time > '" . $last_sevenday . "' AND myd.create_time < '" . $tomorrow . "'"; $this->memberMyData->setSql()->where($condition); break; default: //所有时间段 break; } } $this->memberMyData->setAs('myd'); }
function GetWeiboContentLength($weiboContent, $title, $type) { switch ($type) { case "1": $max = 125 * 2; break; case "2": $max = 125 * 2; break; case "3": $max = 115 * 2; break; default: $max = 138 * 2; break; } $encode = 'gb2312'; // 英国出游三条路线让你感受“醉人”的英国圣诞节又将和大家不期而至了,对于今年刚到英国留学留学的同学来说,这绝对是一个出游的好机会。一般大学圣诞 $str_num = mb_strlen($weiboContent, $encode); // return cutstr(delhtml(($title)),($max-$str_num)); // return $max."%%%".$str_num."####".($max-$str_num)."****"; // return csubstr_end(delhtml($title),0,($max-$str_num),"gbk"); return csubstr_end(delhtml(trimall($title)), 0, $max - $str_num, "gb2312"); // return csubstr_end(delhtml(trimall($title)),($max-$str_num)); }
private function checkRegMemberName() { $this->memberName = trimall($this->input['member_name']); if (!$this->type || $this->settings['autoRegReviseType']) { if (hg_verify_mobile($this->memberName)) { $this->type = 'shouji'; $this->input['mobile'] = $this->memberName; } else { if (hg_check_email_format($this->memberName)) { $this->type = 'email'; $this->input['email'] = $this->memberName; } else { if (!$this->type) { $this->type = 'm2o'; } } } } return $this->memberName; }
private function check_user_data($class) { if ($class == 'address') { $address = array(); $address['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1014'); $address['location_id'] = input_int($this->input->post('local_id'), 100000, 1000000, FALSE, '1015'); $address['address'] = check_empty(trimall(strip_tags($this->input->post('address'))), FALSE, '1016'); $this->load->model('home_model'); $local = check_empty($this->home_model->get_local_info($address['location_id']), FALSE, '1015'); $address['location'] = $local['sheng']['name'] . $local['shi']['name'] . $local['city']['name']; return $address; } else { if ($class == 'identify') { $identify = array(); $identify['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1014'); $identify['idcard'] = input_identity_number($this->input->post('idcard'), '1019'); return $identify; } else { response_code('4001'); } } }
/** * 文件的读取,进行文件的处理 * @param String $pregExp 需要读出的文件 * @param String $pregExp 需要写入的文件 * @return * */ function fileHandler($fielRead, $fileWiter, $posts) { $baseCss = file_get_contents($fielRead); $formatCss = trimall(str_replace("'", '"', $baseCss)); $pregExp = getPreg(); $getArr = matchCss($pregExp, $formatCss, $posts); $ArrMerged = array_merge($getArr, array_diff(fileFmt($fileWiter), $getArr)); $ArrMerged = str_replace("}", "}\n", $ArrMerged); print_r($ArrMerged); file_put_contents($fileWiter, $ArrMerged); }
public function test() { pr("pubtest test action"); $st = ' fdf fff '; var_dump(trimall($st)); }
public function domain_check($str) { if (!empty($str)) { $str = trimall($str); $allowedExt = '.com|.net|.org|.me|.de|.lu|.biz|.pw|.name|.asia|.info|.mobi|.ac|.ag|.am|.at|.be|.bz|.ca|.cc|.ch|.' . 'cm|.cn.com|.co|.cx|.cz|.dk|.es|.eu|.fm|.fr|.gd|.gs|.hk|.hn|.ht|.im|.in|.io|.it|.jp|.ki|.la|.lc|.li|.lt|.md|.mn|.ms|.mu|.mx|.nl|.' . 'nu|.pe|.pl|.re|.ru|.sc|.se|.sg|.sh|.tk|.tl|.tm|.tv|.tw|.us|.vc|.vg|.se.com|.no.com|.qc.com|.sa.com|.za.com|.com.sb|.' . 'net.sb|.org.sb|.lv|.com.|.gl|.ws|.com.ht|.net.ht|.tel|.com.im|.so|.com.so|.net.so|.gy|.mg|.com.de|.ph|.ec|.' . 'com.sg|.pt |.cn|.com.cn|.net.cn|.org.cn|.tj.cn|.nx.cn|.hi.cn|.jx.cn|.nm.cn|.ac.cn|.mo.cn|.sn.cn|.hn.cn|.' . 'js.cn|.cq.cn|.xj.cn|.sc.cn|.sd.cn|.ln.cn|.bj.cn|.yn.cn|.gs.cn|.gd.cn|.zj.cn|.he.cn|.tw.cn|.gz.cn|.ha.cn|.' . 'jl.cn|.sh.cn|.qh.cn|.gx.cn|.ah.cn|.sx.cn|.fj.cn|.hk.cn|.xz.cn|.hb.cn|.hl.cn'; $ext = substr($str, strpos($str, '.')); if (!in_array($ext, explode('|', $allowedExt)) || strpos($str, '>') !== false || strpos($str, '<') !== false || strpos($str, '/') !== false || strpos($str, ':') !== false) { $this->form_validation->set_message('domain_check', $ext . '域名格式不正确。'); return FALSE; } lm('domain_model'); $domain = $this->domain_model->getDomainByNameArray($str); if (empty($domain)) { return true; } else { if (element('deadline', $domain) > time()) { $this->form_validation->set_message('domain_check', '域名正在拍卖中,不能重复添加。'); return FALSE; } if (time() - element('deadline', $domain) < 30 * 86400) { //get domain report lm('bid_report_model'); $bidReport = $this->bid_report_model->getDidReportQuery(element('did', $domain))->row_array(); if (element('optstatus', $bidReport) != DOMAIN_BID_REPORT_OPTSTATUS_DONE) { $this->form_validation->set_message('domain_check', '该域名尚未处理结束,不能拍卖。'); return FALSE; } if (element('status', $bidReport) != DOMAIN_SELL_BUYERBREAK) { $this->form_validation->set_message('domain_check', '同一域名,不能在30日内重复拍卖。'); return FALSE; } } } return true; } return FALSE; }
private function check_group_info_value($type = 'edit') { $group_name = $this->input->post('groupname', TRUE); $group_img = $this->input->post('groupimg', TRUE); $note = $this->input->post('note', TRUE); $join_method = $this->input->post('joinmethod'); $group = array(); if ($type == 'edit') { if ($group_name) { $group['group_name'] = check_empty(trimall(strip_tags($group_name)), FALSE, '6020'); } if ($group_img) { $group['group_img'] = check_empty(trimall(strip_tags($group_img)), FALSE, '6021'); } if ($note) { $group['note'] = check_empty(trimall(strip_tags($note)), FALSE, '6022'); } if ($join_method) { $group['join_method'] = input_string($join_method, array('able', 'verify', 'noable'), FALSE, '6023'); } } else { $group['group_name'] = check_empty(trimall(strip_tags($group_name)), FALSE, '6020'); $group['group_img'] = check_empty(trimall(strip_tags($group_img)), FALSE, '6021'); $group['note'] = check_empty(trimall(strip_tags($note)), FALSE, '6022'); $group['join_method'] = input_string($join_method, array('able', 'verify', 'noable'), FALSE, '6023'); } return $group; }
public function testpy() { $fh = fopen('/html/NginxServer/tips/application/controllers/aaa.txt', 'r'); $con_arr = array(); while (!feof($fh)) { $data = fgets($fh); if ($data) { $con_arr[] = $data; } } include '/html/NginxServer/tips/application/libraries/pinyin.php'; // $this->load->library('stringtopy'); // $a = new StringToPY(); $res = array(); foreach ($con_arr as $word) { //$tr = $a->encode($word, 'all'); $tr = pinyin($word); $tr = trimall($tr); $sp_len = strlen($tr); //var_dump($word.'-'.$tr); $res[] = $tr; } var_dump(implode('-', $res)); }