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


PHP hg_rand_num函数代码示例

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


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

示例1: doDir

 private function doDir($dir = '')
 {
     if (!is_dir($dir)) {
         return false;
     }
     //解析输入的目录的最后一级
     $lastDirName = basename(rtrim($dir, '/'));
     if (!$lastDirName) {
         return false;
     }
     //判断upload目录里面的第一级存不存在所输入的目录名称
     if (is_dir(UPLOAD_DIR . $lastDirName)) {
         //随机产生一个目录名称
         $lastDirName = $lastDirName . TIMENOW . hg_rand_num(5);
     }
     //先将目录移动到upload目录
     $cmd = 'cp -r ' . $dir . ' ' . UPLOAD_DIR . $lastDirName;
     exec($cmd, $out, $status);
     //目录复制后删除原来目录
     if (!$status) {
         $cmd = 'rm -Rf ' . $dir;
         exec($cmd);
     }
     return $lastDirName;
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:submitVideoByDir.php

示例2: get_ori_img

 /**
  * 获取裁剪的原图
  */
 public function get_ori_img()
 {
     //原头像图
     $file_name = $this->user['id'] . ".jpg";
     $path = AVATAR_URL . ceil($this->user['id'] / NUM_IMG) . "/" . $file_name . "?" . hg_rand_num(7);
     echo $path;
 }
开发者ID:h3len,项目名称:Project,代码行数:10,代码来源:avatar.php

示例3: upload

 public function upload()
 {
     if (!$this->input['video_id']) {
         $this->errorOutput(NOID);
     }
     $sql = " SELECT video_base_path,video_path,video_filename,id FROM " . DB_PREFIX . "vodinfo WHERE id IN (" . $this->input['video_id'] . ")";
     $q = $this->db->query($sql);
     $video = array();
     while ($r = $this->db->fetch_array($q)) {
         $video[] = $r;
     }
     //实例化ftp,并连接
     $ftp_config = array('hostname' => $this->input['hostname'], 'username' => $this->input['username'], 'password' => $this->input['password']);
     $ftp = new Ftp();
     if (!$ftp->connect($ftp_config)) {
         $this->errorOutput('CAN NOT CONNECT FTP SERVER');
     }
     foreach ($video as $k => $v) {
         $target_dir = date('Y', TIMENOW) . '/' . date('m', TIMENOW) . '/' . TIMENOW . hg_rand_num(6) . '/';
         $target_path = $target_dir . $v['video_filename'];
         $video_filepath = $v['video_base_path'] . $v['video_path'] . $v['video_filename'];
         if (!$ftp->mkdir($target_dir)) {
             $this->errorOutput('CAN NOT MAKE DIR');
         }
         if (!$ftp->upload($video_filepath, $target_path)) {
             $this->errorOutput('CAN NOT UPLOAD FILE');
         }
         $pathinfo = pathinfo($target_path);
         $filename = basename($pathinfo['basename'], '.' . $pathinfo['extension']);
         $this->addItem(array('path' => $target_path, 'id' => $v['id'], 'dir' => $pathinfo['dirname'], 'filename' => $filename));
     }
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:ftp_upload.php

示例4: update

 public function update()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     $update_data = array('name' => $this->input['name'], 'update_time' => TIMENOW);
     //如果传了图片
     if ($_FILES['water_pic']) {
         $original = $_FILES['water_pic']['name'];
         $filetype = strtolower(strrchr($original, '.'));
         //随机产生一个文件名
         $filename = TIMENOW . hg_rand_num(6) . $filetype;
         if (!@move_uploaded_file($_FILES['water_pic']['tmp_name'], TARGET_DIR . 'water/' . $filename)) {
             $this->errorOutput(FAILMOVE);
         }
         $add_data = array('hostwork' => defined('TARGET_VIDEO_DOMAIN') && TARGET_VIDEO_DOMAIN ? ltrim(TARGET_VIDEO_DOMAIN, 'http://') : $this->settings['videouploads']['host'], 'base_path' => TARGET_DIR . 'water/', 'img_path' => $filename);
         //还要将原来图片文件删除掉
         $oldWter = $this->mode->detail($this->input['id']);
         if ($oldWter) {
             unlink($oldWter['base_path'] . $oldWter['img_path']);
         }
     }
     if ($add_data) {
         $update_data = array_merge($update_data, $add_data);
     }
     $ret = $this->mode->update($this->input['id'], $update_data);
     if ($ret) {
         $this->addLogs('更新水印', $ret, '', '更新水印' . $this->input['id']);
         $this->addItem('success');
         $this->output();
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:32,代码来源:water_config_update.php

示例5: run

 public function run()
 {
     //判断有没有登陆
     if (!$this->user['user_id']) {
         $this->errorOutput(NO_LOGIN);
     }
     //获取嘉宾信息
     $_memberInfo = $this->member_mode->detail('', " AND member_id = '" . $this->user['user_id'] . "' ");
     if (!$_memberInfo) {
         $this->errorOutput(YOU_HAVE_NOT_ACTIVATED);
     }
     //根据激活码id查询出激活码
     $code = $this->activate->detail($_memberInfo['activate_code_id']);
     if (!$code) {
         $code = array('guest_type_text' => $this->settings['guest_type'][1]);
     }
     //获取该嘉宾在用户中心的头像
     $avatar = array();
     if ($member_info = $this->getMemberInfoFromMemberCenter($this->user['user_id'])) {
         if ($member_info[0]) {
             $member_info = $member_info[0];
             if ($member_info['avatar'] && is_array($member_info['avatar'])) {
                 $avatar = $member_info['avatar'];
             }
         }
     }
     //更新库里面的头像
     $_avatar = $avatar && is_array($avatar) ? addslashes(serialize($avatar)) : '';
     if ($this->member_mode->update($_memberInfo['id'], array('avatar' => $_avatar))) {
         //构建名片数据
         $_vcard_data = array('id' => $_memberInfo['id'], 'name' => $_memberInfo['name'], 'company' => $_memberInfo['company'], 'job' => $_memberInfo['job'], 'telephone' => $_memberInfo['telephone'], 'email' => $_memberInfo['email'], 'avatar' => $avatar, 'guest_type_text' => $code['guest_type_text']);
         //引入二维码类
         if (!class_exists('QRcode')) {
             include_once CUR_CONF_PATH . 'lib/qrcode.class.php';
         }
         $_pic_name = $_memberInfo['vcard_pic_name'];
         $_isupdate = 0;
         //如果库里面二维码图片的名称都没有就产生图片名
         if (!$_pic_name) {
             $_pic_name = md5(TIMENOW . hg_rand_num(6)) . '.png';
             //随机产生图片文件名
             $_isupdate = 1;
         }
         if (!hg_mkdir(VCARD_DIR) || !is_writeable(VCARD_DIR)) {
             $this->errorOutput(NO_WRITE);
         }
         QRcode::png(json_encode($_vcard_data), VCARD_DIR . $_pic_name);
         //更新库里面的图片名称
         if ($_isupdate) {
             $this->member_mode->update($_memberInfo['id'], array('vcard_pic_name' => $_pic_name));
             $_memberInfo['vcard_pic_name'] = $_pic_name;
         }
     }
     $this->addItem(array('return' => 1));
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:56,代码来源:update_avatar.php

示例6: getPlan

 private function getPlan($channel_id, $dates)
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "program_plan p LEFT JOIN " . DB_PREFIX . "program_plan_relation r ON r.plan_id=p.id WHERE 1 and p.channel_id=" . $channel_id . " AND r.week_num=" . date("N", strtotime($dates)) . " ORDER BY p.start_time ASC";
     $q = $this->db->query($sql);
     $program_plan = array();
     while ($r = $this->db->fetch_array($q)) {
         $program_plan[] = array('id' => hg_rand_num(10), 'channel_id' => $r['channel_id'], 'start_time' => strtotime($dates . " " . date("H:i:s", $r['start_time'])), 'toff' => $r['toff'], 'theme' => $r['program_name'], 'subtopic' => '', 'type_id' => 1, 'dates' => $dates, 'weeks' => date('W', strtotime($dates . " " . date("H:i:s", $r['start_time']))), 'describes' => '', 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip(), 'is_show' => 1, 'start' => date("H:i", strtotime($dates . " " . date("H:i:s", $r['start_time']))), 'end' => date("H:i", strtotime($dates . " " . date("H:i:s", $r['start_time'])) + $r['toff']), 'is_plan' => 1);
     }
     return $program_plan;
 }
开发者ID:h3len,项目名称:Project,代码行数:10,代码来源:program_record_do.php

示例7: buildDirStruct

 /**
  * 生成目录结构
  *
  * @access public
  * @param  无
  * @return array
  */
 public static function buildDirStruct($user_id = '')
 {
     $dirNames = TIMENOW . hg_rand_num(2);
     $dir = date('Y/m/d/', TIMENOW);
     if ($user_id) {
         $dir = $user_id . '/' . $dir;
     } else {
         $dir = 'system/' . $dir;
         //系统图标
     }
     return array($dirNames, $dir);
 }
开发者ID:h3len,项目名称:Project,代码行数:19,代码来源:Common.php

示例8: getInfo

 function getInfo($start, $end, $dates, $type = 0)
 {
     //$type 存在表示space color 存在,否 null存在
     $info = array('id' => hg_rand_num(10), 'name' => '新话题', 'dates' => $dates, 'start' => date('H:i:s', $start), 'end' => date('H:i:s', $end), 'channel_id' => $this->input['channel_id']);
     if ($type) {
         $info['color'] = '#DF6564,#FEF2F2';
         $info['space'] = 1;
     } else {
         $info['null'] = 1;
     }
     return $info;
 }
开发者ID:h3len,项目名称:Project,代码行数:12,代码来源:topic_update.php

示例9: show

 public function show()
 {
     if (!$this->user['user_id']) {
         $this->errorOutput(NO_LOGIN);
     }
     //获取嘉宾激活信息
     $_memberInfo = $this->member_mode->detail('', " AND member_id = '" . $this->user['user_id'] . "' ");
     if (!$_memberInfo) {
         $this->errorOutput(YOU_HAVE_NOT_ACTIVATED);
     }
     //根据激活码id查询出激活码
     $code = $this->activate->detail($_memberInfo['activate_code_id']);
     if (!$code) {
         $code = array('id' => 0, 'guest_type' => 1, 'guest_type_text' => $this->settings['guest_type'][1]);
     }
     //判断名片二维码存不存在,不存在就要生成一张
     if (!file_exists(VCARD_DIR . $_memberInfo['vcard_pic_name']) || !is_file(VCARD_DIR . $_memberInfo['vcard_pic_name'])) {
         //构建名片数据
         $_vcard_data = array('id' => $_memberInfo['id'], 'name' => $_memberInfo['name'], 'company' => $_memberInfo['company'], 'job' => $_memberInfo['job'], 'telephone' => $_memberInfo['telephone'], 'email' => $_memberInfo['email'], 'avatar' => $_memberInfo['avatar'] ? @unserialize($_memberInfo['avatar']) : array(), 'guest_type_text' => $code['guest_type_text']);
         //引入二维码类
         if (!class_exists('QRcode')) {
             include_once CUR_CONF_PATH . 'lib/qrcode.class.php';
         }
         $_pic_name = $_memberInfo['vcard_pic_name'];
         $_isupdate = 0;
         //如果库里面二维码图片的名称都没有就产生图片名
         if (!$_pic_name) {
             $_pic_name = md5(TIMENOW . hg_rand_num(6)) . '.png';
             //随机产生图片文件名
             $_isupdate = 1;
         }
         if (!hg_mkdir(VCARD_DIR) || !is_writeable(VCARD_DIR)) {
             $this->errorOutput(NO_WRITE);
         }
         QRcode::png(json_encode($_vcard_data), VCARD_DIR . $_pic_name);
         //更新库里面的图片名称
         if ($_isupdate) {
             $this->member_mode->update($_memberInfo['id'], array('vcard_pic_name' => $_pic_name));
             $_memberInfo['vcard_pic_name'] = $_pic_name;
         }
     }
     //获取自己已经交换名片的个数
     $_memberInfo['exchange_nums'] = $this->member_mode->get_exchanged_nums($_memberInfo['id']);
     $_memberInfo['vcard_url'] = $data['vcard_url'] = 'http://' . $this->settings['App_meeting']['host'] . '/' . $this->settings['App_meeting']['dir'] . 'data/vcard/' . $_memberInfo['vcard_pic_name'];
     $_memberInfo['avatar'] = $_memberInfo['avatar'] ? unserialize($_memberInfo['avatar']) : array();
     $_memberInfo['guest_type'] = $code['guest_type'];
     $_memberInfo['guest_type_text'] = $code['guest_type_text'];
     $this->addItem($_memberInfo);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:50,代码来源:get_card_info.php

示例10: pick

 public function pick()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     //判断配置的提取的到哪个目录
     if (!file_exists(PICK_UP_DIR) || !is_writeable(PICK_UP_DIR)) {
         $this->errorOutput(DIR_NOT_EXISTS_OR_NOT_WRITEABLE);
     }
     //查询出需要提取的视频信息
     $sql = " SELECT * FROM " . DB_PREFIX . "vodinfo WHERE id IN (" . $this->input['id'] . ")";
     $q = $this->db->query($sql);
     $video = array();
     $videoInfo = array();
     while ($r = $this->db->fetch_array($q)) {
         $videoInfo[] = $r;
         $video_tmp = explode('.', $r['video_filename']);
         $video[] = array('id' => $r['id'], 'path' => rtrim($r['video_base_path'], '/') . '/' . $r['video_path'] . $r['video_filename'], 'title' => $r['starttime'] ? $r['title'] . '(' . date('Y-m-d', $r['starttime']) . ')' : $r['title'], 'type' => $video_tmp[1]);
     }
     //判断视频存不存在
     if (!$video) {
         $this->errorOutput(VIDEO_NOT_EXISTS);
     }
     //创建目录
     $targetDir = date('YmdHis', TIMENOW) . hg_rand_num(2) . '/';
     if (!hg_mkdir(PICK_UP_DIR . $targetDir) || !is_writeable(PICK_UP_DIR . $targetDir)) {
         $this->errorOutput(NOWRITE);
     }
     //copy视频到指定的目录
     foreach ($video as $k => $v) {
         $targetVideoPath = PICK_UP_DIR . $targetDir . $v['title'] . '.' . $v['type'];
         if (file_exists($targetVideoPath)) {
             $targetVideoPath = PICK_UP_DIR . $targetDir . $v['title'] . '(' . $v['id'] . ').' . $v['type'];
         }
         @copy($v['path'], $targetVideoPath);
     }
     //将视频的json信息放入该目录下
     file_put_contents(PICK_UP_DIR . $targetDir . 'videoinfo.json', json_encode($videoInfo));
     //将视频的xml信息放入该目录下
     //$xml = arrtoxml($videoInfo);
     //file_put_contents(PICK_UP_DIR . $targetDir . 'videoinfo.xml', $xml);
     //返回信息
     $ret = array('path' => PICK_UP_DIR . $targetDir);
     $this->addItem($ret);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:46,代码来源:pickUpVideos.php

示例11: detail

 public function detail()
 {
     $id = intval($this->input['id']);
     if (!$id) {
         $this->output();
     }
     if (!class_exists('programTemplate')) {
         include CUR_CONF_PATH . 'lib/program_template.class.php';
     }
     $objProTemplate = new programTemplate();
     $ret = $objProTemplate->getOneById($id);
     if (!empty($ret['data'])) {
         $date = date('Y-m-d');
         $noon = strtotime($date . ' 12:00');
         $program = array();
         if (is_array($ret['data']) && count($ret['data']) > 0) {
             foreach ($ret['data'] as $k => $v) {
                 $v['start_time'] = strtotime($data . ' ' . $v['start']);
                 if ($v['start_time'] < $noon) {
                     $v['pos'] = hg_get_pos($v['start_time'] - strtotime($date));
                     $v['slider'] = hg_get_slider($v['start_time'] - strtotime($date));
                     $key = 'am';
                 } else {
                     $v['pos'] = hg_get_pos($v['start_time'] - strtotime($date . " 12:00"));
                     $v['slider'] = hg_get_slider($v['start_time'] - strtotime($date . " 12:00"));
                     $key = 'pm';
                 }
                 $v['id'] = $v['key'] = hg_rand_num(4);
                 $program[$key][] = $v;
             }
             $ret['data'] = $program;
         }
     }
     if ($ret) {
         $this->addItem($ret);
     }
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:38,代码来源:program_template.php

示例12: header

 * 活动报名
 * */
header('Content-Type:text/html; charset=utf-8');
define('M2O_ROOT_PATH', './');
require M2O_ROOT_PATH . 'global.php';
require_once M2O_ROOT_PATH . 'lib/class/http.class.php';
function show_message($message)
{
    if ($_SERVER['HTTP_REFERER']) {
        echo "<script>alert('" . $message . "');window.location.href='" . $_SERVER["HTTP_REFERER"] . "';</script>";
    } else {
        echo "<script>alert('" . $message . "')</script>";
    }
    exit;
}
$data = array();
if (!$_REQUEST['activityid'] || !$_REQUEST['type'] || !$_REQUEST['type_name']) {
    show_message('没有选择活动');
}
if (!$_REQUEST['nick_name']) {
    show_message('请填写姓名');
}
$data = array('type' => $_REQUEST['type'], 'type_name' => $_REQUEST['type_name'], 'platform_id' => uniqid() . hg_rand_num(), 'nick_name' => $_REQUEST['nick_name'], 'activityid' => $_REQUEST['activityid'], 'member_info' => $_REQUEST['member_info'], 'a' => 'login', 'appid' => APPID, 'appkey' => APPKEY);
$url = $gGlobalConfig['App_members']['protocol'] . $gGlobalConfig['App_members']['host'] . '/' . $gGlobalConfig['App_members']['dir'] . 'login.php';
$http = new Http();
$ret = $http->post($url, $data, false);
//print_r($ret);
if (empty($ret) || $ret['ErrorCode']) {
    show_message($ret['ErrorText']);
}
show_message('提交成功');
开发者ID:h3len,项目名称:Project,代码行数:31,代码来源:signup.php

示例13: getOrderNumberByUserID

 public static function getOrderNumberByUserID($user_id = '')
 {
     return date('is', TIMENOW) . hg_rand_num(1) . $user_id . hg_rand_num(1);
 }
开发者ID:h3len,项目名称:Project,代码行数:4,代码来源:Common.php

示例14: getPlan

 /**
  * 获取该频道串联单计划信息
  * @name getPlan
  * @access private
  * @author lijiaying
  * @category hogesoft
  * @copyright hogesoft
  * @param $channel_id int 频道ID
  * @param $dates string 格式化日期(Y-m-d)
  * @return $change_plan array 该频道串联单计划信息内容
  */
 private function getPlan($channel_id, $dates)
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "change_plan p ";
     $sql .= " LEFT JOIN " . DB_PREFIX . "change_plan_relation r ON r.plan_id=p.id";
     $sql .= " WHERE 1 and p.channel_id=" . $channel_id . " AND r.week_num=" . date("N", strtotime($dates));
     $sql .= " ORDER BY p.start_time ASC";
     $q = $this->db->query($sql);
     $change_plan = array();
     while ($r = $this->db->fetch_array($q)) {
         $week_days = $r['week_days'];
         $week_d = date('N', strtotime($dates));
         $week = date('W', $r['program_start_time']);
         $this_week = date('W', TIMENOW);
         $offset_week = ($this_week - $week) * 24 * 3600 * 7;
         if ($week_days == $week_d) {
             $program_start_time = date('Y-m-d H:i:s', $r['program_start_time'] + $offset_week);
         } else {
             if ($week_days > $week_d) {
                 $program_start_time = date('Y-m-d H:i:s', $r['program_start_time'] - 86400 * ($week_days - $week_d) + $offset_week);
             } else {
                 if ($week_days < $week_d) {
                     $program_start_time = date('Y-m-d H:i:s', $r['program_start_time'] + 86400 * ($week_d - $week_days) + $offset_week);
                 }
             }
         }
         $change_plan[] = array('id' => hg_rand_num(12), 'channel_id' => $r['channel_id'], 'change_time' => strtotime($dates . " " . date("H:i:s", $r['start_time'])), 'toff' => $r['toff'], 'file_toff' => time_format($r['file_toff']), 'stream_uri' => $r['stream_uri'], 'channel2_id' => $r['channel2_id'], 'channel2_name' => $r['channel2_name'], 'program_end_time' => $r['program_start_time'] ? date('Y-m-d H:i:s', strtotime($program_start_time) + $r['toff']) : '', 'program_start_time' => $r['program_start_time'] ? $program_start_time : '', 'week_days' => $r['week_days'], 'type' => $r['type'], 'dates' => $dates, 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip(), 'end_time' => date("H:i:s", $r['start_time'] + $r['toff']), 'start_time' => date("H:i:s", $r['start_time']), 'e_time' => $r['program_start_time'] ? date('H:i:s', strtotime($program_start_time) + $r['toff']) : '', 's_time' => $r['program_start_time'] ? date('m-d H:i:s', strtotime($program_start_time)) : '', 'is_plan' => 1);
     }
     return $change_plan;
 }
开发者ID:h3len,项目名称:Project,代码行数:40,代码来源:channel_chg_plan.php

示例15: getInfo

 private function getInfo($start, $end, $dates, $new = 1, $type = 0)
 {
     $toff = $end - $start;
     if ($end - $start > 3600) {
         $toff = 3600;
     }
     $info = array('id' => hg_rand_num(10), 'channel_id' => $this->input['channel_id'], 'start_time' => $start, 'toff' => $toff, 'theme' => '精彩节目', 'subtopic' => '', 'type_id' => 1, 'dates' => $dates, 'weeks' => date('W', $start), 'describes' => '', 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip(), 'is_show' => 1, 'color' => '#DF6564,#FEF2F2', 'start' => date("H:i", $start), 'end' => date("H:i", $start + $toff), 'week_set' => date('W', $start), 'item' => 0, 'new' => $new, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id'], 'appid' => $this->user['appid'], 'appname' => $this->user['appname']);
     if ($start <= TIMENOW) {
         $info['outdate'] = 1;
     } else {
         $info['outdate'] = 0;
     }
     if ($type) {
         $info['space'] = 1;
     }
     return $info;
 }
开发者ID:h3len,项目名称:Project,代码行数:17,代码来源:program.php


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