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


PHP tool::get_str_ip方法代码示例

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


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

示例1: do_active

 /**
  * 改变状态
  */
 function do_active($id)
 {
     //权限验证
     role::check('user_charge');
     if (!$id) {
         remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
     }
     $db = Database::instance();
     $data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false));
     if ($data['id'] <= 0 || $data['status'] > 0) {
         remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
     }
     $logodata = array();
     $logodata['manager_id'] = $this->manager_id;
     $logodata['ip'] = tool::get_str_ip();
     $logodata['user_log_type'] = 27;
     $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()';
     $logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money'];
     $sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' ";
     if ($db->query($sql)) {
         //充值用户Money
         $sql_reward = "UPDATE users \r\n                            SET user_money = user_money+" . $data['price'] . "\r\n                            WHERE id='" . $data['user_id'] . "'\r\n                          ";
         $db->query($sql_reward);
         //操作log
         ulog::add($logodata);
         remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success');
     } else {
         //操作log
         ulog::add($logodata, 1);
         remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error');
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:35,代码来源:user_charge.php

示例2: add

 /**
  * 更新或添加信息
  *
  * @param  array $data 数据包
  * @return true or false
  */
 public function add($data)
 {
     $obj = ORM::factory('account_virtual_log');
     if (!$obj->validate($data)) {
         return FALSE;
     }
     !empty($data['order_num']) && ($obj->order_num = $data['order_num']);
     $obj->user_id = $data['user_id'];
     $obj->log_type = $data['log_type'];
     empty($data['is_in']) && ($data['is_in'] = 0);
     $obj->is_in = $data['is_in'];
     $obj->price = $data['price'];
     $obj->user_money = $data['user_money'];
     $obj->memo = $data['memo'];
     $obj->method = serialize(array('url' => 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"], 'method' => $_SERVER['REQUEST_METHOD']));
     $obj->ip = tool::get_str_ip();
     $obj->save();
     if ($obj->saved) {
         //更新用户表金额
         $userobj = user::get_instance();
         if ($data['is_in'] == 0) {
             $usermoney = $obj->user_money + $obj->price;
         } else {
             $usermoney = $obj->user_money - $obj->price;
         }
         $userobj->update_virtual_money($data['user_id'], $usermoney);
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:37,代码来源:account_virtual_log.php

示例3: change_password

 public static function change_password($manager_id = 0, $status = 0)
 {
     $user_log_type_id = 26;
     $ip = tool::get_str_ip();
     $data = array();
     $data['manager_id'] = $manager_id;
     $data['ip'] = $ip;
     $data['user_log_type'] = $user_log_type_id;
     $data['status'] = $status;
     return Myuser_log::instance()->add($data);
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:11,代码来源:ulog.php

示例4: minus_money

 public function minus_money($user_id, $money, $arrmoney, $logtype, $order_num = NULL, $memo = NULL)
 {
     $user_id = intval($user_id);
     $logtype = intval($logtype);
     //参数检测
     if ($user_id <= 0 || $logtype < 0 || $money < 0 || !is_array($arrmoney) || empty($arrmoney)) {
         return -1;
     }
     $testmoney = 0;
     foreach ($arrmoney as $row) {
         $testmoney += $row;
     }
     if ($money != $testmoney) {
         return -2;
     }
     //获取用户所有总资金
     $userobj = user::get_instance();
     $user_moneys = $userobj->get_user_moneys($user_id);
     $old_user_moneys = $user_moneys;
     //当出现异常
     if (empty($user_moneys)) {
         return -3;
     }
     $logobj = ORM::factory('account_log');
     $data = array();
     $data['order_num'] = $order_num;
     $data['log_type'] = $logtype;
     $data['user_id'] = $user_id;
     $data['price'] = $money;
     $data['user_money'] = $user_moneys['all_money'];
     $data['is_in'] = 1;
     $data['memo'] = $memo;
     $data['method'] = serialize(array('url' => 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"], 'method' => $_SERVER['REQUEST_METHOD']));
     $data['ip'] = tool::get_str_ip();
     //$data['user_money'] = $data['user_money'] - $money;
     if ($data['user_money'] < 0) {
         return -4;
     }
     if (!$logobj->validate($data, FALSE)) {
         return -5;
     }
     $logobj->save();
     if (!$logobj->saved) {
         return -6;
     }
     if (!empty($arrmoney['USER_MONEY'])) {
         $user_moneys['user_money'] = $user_moneys['user_money'] - $arrmoney['USER_MONEY'];
     }
     if (!empty($arrmoney['BONUS_MONEY'])) {
         $user_moneys['bonus_money'] = $user_moneys['bonus_money'] - $arrmoney['BONUS_MONEY'];
     }
     if (!empty($arrmoney['FREE_MONEY'])) {
         $user_moneys['free_money'] = $user_moneys['free_money'] - $arrmoney['FREE_MONEY'];
     }
     //更新会员资金
     if (!$userobj->update_moneys($user_id, $user_moneys)) {
         return -7;
     }
     //当资金记录有变化时则记录详细日志
     $this->add_detail_log($user_moneys, $old_user_moneys, $user_id, $logobj->id);
     return $money;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:62,代码来源:user_money.php

示例5: edit

 /**
  * 修改用户信息
  */
 function edit($id)
 {
     //权限检查 得到所有可管理站点ID列表
     role::check('user_edit');
     if ($_POST) {
         //标签过滤
         tool::filter_strip_tags($_POST);
         if (Myuser::instance($id)->set_money($_POST['invite_user_id'], $_POST['reward_money'])) {
             $arr['guest_user_id'] = intval($_POST['user_id']);
             $arr['user_id'] = intval($_POST['invite_user_id']);
             $arr['reward_money'] = intval($_POST['reward_money']);
             $arr['memo'] = '邀请用户奖励';
             $arr['reward_type'] = 'invite';
             $arr['time_stamp'] = date("Y-m-d H:i:s", time());
             User_inviteService::get_instance()->insert($arr);
             $logodata = array();
             $logodata['manager_id'] = $this->manager_id;
             $logodata['ip'] = tool::get_str_ip();
             $logodata['user_log_type'] = 28;
             $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()';
             $logodata['memo'] = "邀请奖励审核通过, 奖励:" . $_POST['reward_money'];
             ulog::add($logodata);
             remind::set(Kohana::lang('o_global.update_success'), request::referrer(), 'success');
         } else {
             remind::set(Kohana::lang('o_global.update_error'), request::referrer(), 'error');
         }
     }
     $this->template->content = new View("user/user_invite_edit");
     $id = intval($id);
     $data = Myuser::instance($id)->get();
     $data['invite'] = Myuser::instance($data['invite_user_id'])->get();
     $sql = " SELECT COUNT(id) AS id FROM user_reward  WHERE guest_user_id = " . $data['id'] . " AND user_id = " . $data['invite']['id'] . "  AND reward_type = 'invite' ";
     $data['reward'] = User_inviteService::get_instance()->get_one($sql);
     $data['reward'] = $data['reward']['id'];
     $this->template->content->data = $data;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:39,代码来源:user_invite.php

示例6: get_user_charge_order

 public function get_user_charge_order($user_id, $price)
 {
     $obj = ORM::factory('user_charge_order');
     $ordernum = '';
     do {
         $ordernum = date('YmdHis') . rand(0, 99999);
         if (!$this->charge_exist($ordernum)) {
             break;
         }
     } while (1);
     $obj->status = 0;
     $obj->user_id = $user_id;
     $obj->money = $price;
     $obj->order_num = $ordernum;
     $obj->ip = tool::get_str_ip();
     $obj->save();
     return $ordernum;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:18,代码来源:user.php


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