本文整理汇总了PHP中tool::get_long_ip方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::get_long_ip方法的具体用法?PHP tool::get_long_ip怎么用?PHP tool::get_long_ip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tool
的用法示例。
在下文中一共展示了tool::get_long_ip方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Template loading and setup routine.
*/
public function __construct()
{
parent::__construct();
// checke request is ajax
$this->ajax_request = request::is_ajax();
// Load the template
$this->template = new View($this->template);
if ($this->auto_render == TRUE) {
Event::add('system.post_controller', array($this, '_render'));
}
/**
* 判断用户登录情况
*/
if (isset($_REQUEST['session_id'])) {
$session = Session::instance($_REQUEST['session_id']);
$manager = role::get_manager($_REQUEST['session_id']);
} else {
$session = Session::instance();
$manager = role::get_manager();
}
/* 当前请求的URL */
$current_url = urlencode(url::current(TRUE));
//zhu
if (isset($manager['id'])) {
$active_time = $session->get('Opococ_manager_active_time');
//用户最后操作时间
$session->set('Opococ_manager_active_time', time());
//用户最后操作时间
$login_ip = $session->get('Opococ_manager_login_ip');
//用户登录的IP
//操作超时
if (time() - $active_time > Kohana::config('login.time_out')) {
$session->delete('Opococ_manager');
$session->delete('Opococ_manager_active_time');
$session->delete('Opococ_manager_login_ip');
remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
}
//用户IP(登录状态更换IP需要重新登录)
$ip = tool::get_long_ip();
if ($ip != $login_ip) {
remind::set(Kohana::lang('o_global.login_again'), 'login?request_url=' . $current_url);
}
$this->manager = $manager;
$this->manager_id = $manager['id'];
$this->manager_name = $manager['name'];
$this->manager_is_admin = role::is_root($manager['name']) ? 1 : $manager['is_admin'];
$this->template->manager_data = $manager;
} else {
remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
}
}
示例2: do_add
/**
* 添加用户地址
*/
function do_add($user_id)
{
//权限验证
role::check('user_edit');
if ($_POST) {
$data = $_POST;
tool::filter_strip_tags($data);
$data['user_id'] = $user_id;
$data['ip'] = tool::get_long_ip();
$data['date_upd'] = date('Y-m-d H:i:s');
if (Myaddress::instance()->add($data)) {
remind::set(Kohana::lang('o_global.add_success'), request::referrer(), 'success');
} else {
remind::set(Kohana::lang('o_global.add_error'), request::referrer(), 'error');
}
}
}
示例3: do_add
/**
* 添加订单
*/
function do_add()
{
/*权限检查*/
role::check('order_add');
if ($_POST) {
$post = new Validation($_POST);
$post->pre_filter('trim');
$post->add_rules('shipping_firstname', 'required', 'length[1,200]');
$post->add_rules('shipping_lastname', 'required', 'length[1,200]');
$post->add_rules('shipping_country', 'required', 'length[1,200]');
$post->add_rules('shipping_state', 'length[1,200]');
$post->add_rules('shipping_city', 'required', 'length[1,200]');
$post->add_rules('shipping_address', 'required', 'length[1,200]');
$post->add_rules('shipping_zip', 'required', 'length[1,200]');
$post->add_rules('shipping_phone', 'required', 'length[1,200]');
$post->add_rules('shipping_mobile', 'length[1,200]');
$post->add_rules('billing_firstname', 'length[1,200]');
$post->add_rules('billing_lastname', 'length[1,200]');
$post->add_rules('billing_country', 'length[1,200]');
$post->add_rules('billing_state', 'length[1,200]');
$post->add_rules('billing_city', 'length[1,200]');
$post->add_rules('billing_address', 'length[1,200]');
$post->add_rules('billing_zip', 'length[1,200]');
$post->add_rules('billing_phone', 'length[1,200]');
$post->add_rules('billing_mobile', 'length[1,200]');
$post->add_rules('good_price', 'required', 'length[1,200]');
$post->add_rules('shipping_price', 'required', 'length[1,200]');
if (!$post->validate()) {
$errors = $post->errors();
log::write('form_error', $errors, __FILE__, __LINE__);
remind::set(Kohana::lang('o_order.user_address_wrong'), 'order/order_add/add_again', 'error');
}
/* 添加主订单详情*/
$order_data = array();
$user_id = $this->input->post('user_id');
$email = $this->input->post('email');
$carrier = $this->input->post('carrier');
$currency_code = $this->input->post('code');
if ($user_id && $email && $currency_code) {
/* 订单用户信息*/
$order_data['user_id'] = $user_id;
$order_data['email'] = $email;
/* 订单币种信息*/
$currency = Mycurrency::instance()->get_by_code($currency_code);
$order_data['currency'] = $currency_code;
$order_data['conversion_rate'] = $currency['conversion_rate'];
/* 订单国家*/
$order_data['shipping_country'] = Mycountry::instance($post->shipping_country)->get('iso_code');
$order_data['billing_country'] = Mycountry::instance($post->billing_country)->get('iso_code');
/* 订单时间和IP信息*/
$order_data['data_add'] = date('Y-m-d H:i:s', time());
$order_data['IP'] = tool::get_long_ip();
/* 订单号生成*/
$order_num = '';
do {
$temp = sprintf("%14.0f", date('ymd') . "00000" + rand(0, 99999) . "0000");
$exist_data = array();
$exist_data['order_num'] = $temp;
if (!Myorder::instance()->exist($exist_data)) {
$order_num = $temp;
break;
}
} while (1);
$order_data['order_num'] = $order_num;
$order_data['order_status'] = '1';
$order_data['pay_status'] = '1';
$order_data['ship_status'] = '1';
$order_data['user_status'] = 'NULL';
$order_data['order_source'] = 'manual';
$order_data['total'] = $post->good_price + $post->shipping_price;
$order_data['total_products'] = $post->good_price;
$order_data['total_shipping'] = $post->shipping_price;
$order_data['total_real'] = $order_data['total'] / $order_data['conversion_rate'];
$order_data['total_discount'] = '0.00';
$order_data['total_paid'] = '0.00';
$order_data['shipping_firstname'] = $post->shipping_firstname;
$order_data['shipping_lastname'] = $post->shipping_lastname;
$order_data['shipping_state'] = $post->shipping_state;
$order_data['shipping_city'] = $post->shipping_city;
$order_data['shipping_address'] = $post->shipping_address;
$order_data['shipping_zip'] = $post->shipping_zip;
$order_data['shipping_phone'] = $post->shipping_phone;
$order_data['shipping_mobile'] = $post->shipping_mobile;
$order_data['billing_firstname'] = $post->billing_firstname;
$order_data['billing_lastname'] = $post->billing_lastname;
$order_data['billing_state'] = $post->billing_state;
$order_data['billing_city'] = $post->billing_city;
$order_data['billing_address'] = $post->billing_address;
$order_data['billing_zip'] = $post->billing_zip;
$order_data['billing_phone'] = $post->billing_phone;
$order_data['billing_mobile'] = $post->billing_mobile;
$order_data['carrier'] = $carrier;
$order_data['active'] = 1;
} else {
remind::set(Kohana::lang('o_order.data_trans_wrong'), 'order/order_add', 'error');
}
/* 添加订单,返回订单数据*/
//.........这里部分代码省略.........
示例4: recharge_virtual_money
/**
* 虚拟充值
* @param unknown_type $id
*/
function recharge_virtual_money($id)
{
//权限检查 得到所有可管理站点ID列表
role::check('user_recharge');
if ($_POST) {
//标签过滤
tool::filter_strip_tags($_POST);
$userobj = user::get_instance();
$usermoney = $userobj->get_user_virtual_money($id);
if ($_POST['money'] > 0) {
$money_type_name = '竞波币';
//记录日志
$data_log = array();
$data_log['order_num'] = date('YmdHis') . rand(0, 99999);
$data_log['user_id'] = $id;
$data_log['log_type'] = 6;
//参照config acccount_type 设置
$data_log['is_in'] = 0;
$data_log['price'] = $_POST['money'];
$data_log['user_money'] = $usermoney;
$data_log['memo'] = $_POST['memo'];
account_virtual_log::get_instance()->add($data_log);
//$um = user_money::get_instance()->update_money($data_log['is_in'], $data_log['user_id'], $data_log['price'], $data_log['log_type'], $data_log['order_num'], $money_type, $data_log['memo']);
//添加日志
$logs_data = array();
$logs_data['manager_id'] = $this->manager_id;
$logs_data['user_log_type'] = 29;
$logs_data['ip'] = tool::get_long_ip();
$logs_data['memo'] = "成功为用户{$id}充值{$money_type_name}{$_POST['money']}";
ulog::instance()->add($logs_data);
remind::set($money_type_name . '充值成功', request::referrer(), 'success');
}
}
$this->template->content = new View("user/user_recharge_virtual");
$this->template->content->data = Myuser::instance($id)->get();
}
示例5: set_bonus
public function set_bonus($id, $page = 1)
{
/* 权限检查 订单列表 */
role::check('order_list');
if (empty($id)) {
remind::set(Kohana::lang('o_global.bad_request'), 'order/ticketnum/');
}
$ticketobj = ticket::get_instance();
$result = $ticketobj->get($id);
if (empty($result)) {
remind::set(Kohana::lang('o_global.bad_request'), 'order/ticketnum/');
}
//提交操作
if (!empty($_POST)) {
tool::filter_strip_tags($_POST);
$bonus = $_POST['money'];
$num = $_POST['num'];
$password = $_POST['password'];
$flag = $ticketobj->update_bonus($id, $bonus, $num, $password, $this->manager_id);
$addchar = '成功';
if (!$flag) {
$addchar = '失败';
}
//添加日志
$logs_data = array();
$logs_data['manager_id'] = $this->manager_id;
$logs_data['user_log_type'] = 28;
$logs_data['ip'] = tool::get_long_ip();
$logs_data['memo'] = "为id:{$result['id']}的彩票录入奖金:{$bonus}{$addchar}";
ulog::instance()->add($logs_data);
if ($flag) {
remind::set("成功为id:{$result['id']}的彩票录入奖金:{$bonus}", '/order/ticketnum/index/hasticket/?page=' . $page, 'success');
} else {
remind::set("为id:{$result['id']}的彩票录入奖金:{$bonus}失败", '/order/ticketnum/?page=' . $page, 'error');
}
}
if ($result['status'] != 1 && !($result['status'] == 2 && $result['bonus'] == -9999)) {
remind::set(Kohana::lang('o_global.bad_request'), 'order/ticketnum/');
}
//获取更多信息
$result['plan'] = plan::get_instance()->get_plan_by_tid($result['plan_id'], $result['ticket_type']);
$result['user'] = user::get_instance()->get($result['plan']['user_id']);
$result['manager'] = '';
if (!empty($result['manager_id'])) {
$manager = Mymanager::instance($result['manager_id'])->get();
$result['manager'] = $manager['username'];
}
$this->template->content = new View("order/order_set_bonus", $result);
}
示例6: put
/**
* 商户编辑留言
*/
public function put()
{
$request_data = $this->input->post();
if ($_POST) {
//数据验证
$validation = Validation::factory($request_data)->add_rules('id', 'required', 'digit')->add_rules('title', 'required', 'length[0,100]')->add_rules('email', 'required', 'email')->add_rules('status', 'required', 'digit')->add_rules('content', 'required', 'length[0,65535]');
if (!$validation->validate()) {
remind::set(Kohana::lang('o_global.input_error'), request::referrer());
}
$message = MessageService::get_instance()->get($request_data['id']);
if (empty($message['id'])) {
remind::set(Kohana::lang('o_global.access_denied'), request::referrer());
}
$set_data = array('title' => $request_data['title'], 'content' => $request_data['content'], 'email' => $request_data['email'], 'status' => $request_data['status'], 'ip' => tool::get_long_ip(), 'create_timestamp' => date('Y-m-d H:i:s'));
MessageService::get_instance()->set($message['id'], $set_data);
remind::set(Kohana::lang('o_manage.message_edit_success'), 'manage/message', 'success');
} else {
remind::set(Kohana::lang('o_manage.message_edit_error'), 'manage/message/edit?id=' . $message['id']);
}
}
示例7: exportinfo
public function exportinfo()
{
/* 权限检查 订单列表 */
role::check('user_draw_money_review');
if (empty($_POST)) {
remind::set(Kohana::lang('o_global.bad_request'), 'order/user_draw_money/index/hascharge');
}
$request_data = $this->input->post();
if (empty($request_data['order_ids'])) {
remind::set(Kohana::lang('o_global.bad_request'), 'order/user_draw_money/index/hascharge');
}
$user_draw_moeny = User_draw_moneyService::get_instance();
$query_struct = array();
$query_struct['where']['id'] = $request_data['order_ids'];
$results = $user_draw_moeny->query_assoc($query_struct);
$expexcel = array();
$m = 0;
$expexcel[$m] = array('日期', '总金额', '总笔数', '支付宝帐号', '', '', '', '', '', '');
$all_money = 0;
$all_count = 0;
$infos = array();
foreach ($results as $key => $value) {
$row = array();
$row[] = ' ' . $value['id'];
$row[] = $value['truename'];
$row[] = ' ' . $value['account'];
$row[] = $value['bank_name'];
$row[] = $value['province'];
$row[] = $value['city'];
$row[] = $value['bank_found'];
$row[] = $value['money'];
$row[] = ' 2';
$row[] = $value['memo'];
//str_replace("\n", ";", $value['memo']);
$all_money = $all_money + $value['money'];
$infos[] = $row;
$all_count++;
}
$alipay_config = Kohana::config('site_config.site.alipay_account');
$m++;
$expexcel[$m][] = date('Y-m-d');
$expexcel[$m][] = ' ' . $all_money;
$expexcel[$m][] = ' ' . $all_count;
$expexcel[$m][] = $alipay_config;
$expexcel[$m][] = '';
$expexcel[$m][] = '';
$expexcel[$m][] = '';
$expexcel[$m][] = '';
$expexcel[$m][] = '';
$expexcel[$m][] = '';
$m++;
$expexcel[$m] = array('商户流水号', '收款银行户名', '收款银行帐号', '收款开户银行', '收款银行所在省份', '收款银行所在市', '收款支行名称', '金额', '对公对私标志', '备注');
$expexcel = array_merge($expexcel, $infos);
myexcel::get_instance()->get_excel_from_rows($expexcel, '会员提现财务导出');
//添加日志
$logs_data = array();
$logs_data['manager_id'] = $this->manager_id;
$logs_data['user_log_type'] = 30;
$logs_data['ip'] = tool::get_long_ip();
$logs_data['memo'] = "成功导出选定款项款项,id:" . implode(',', $request_data['order_ids']);
ulog::instance()->add($logs_data);
exit;
}
示例8: check_time_out
protected function check_time_out()
{
/**
* 判断用户登录情况
*/
if (isset($_REQUEST['session_id'])) {
$session = Session::instance($_REQUEST['session_id']);
$manager = role::get_manager($_REQUEST['session_id']);
} else {
$session = Session::instance();
$manager = role::get_manager();
}
if ($manager) {
$active_time = $session->get('Opococ_manager_active_time');
//用户最后操作时间
$session->set('Opococ_manager_active_time', time());
//用户最后操作时间
$login_ip = $session->get('Opococ_manager_login_ip');
//用户登录的IP
//操作超时
if (time() - $active_time > Kohana::config('login.time_out')) {
$session->delete('Opococ_manager');
$session->delete('Opococ_manager_active_time');
$session->delete('Opococ_manager_login_ip');
return false;
}
//用户IP(登录状态更换IP需要重新登录)
$ip = tool::get_long_ip();
if ($ip != $login_ip) {
return false;
}
$this->manager = $manager;
$this->manager_id = $manager['id'];
$this->manager_name = $manager['name'];
$this->manager_is_admin = $manager['is_admin'];
$this->template->manager_data = $manager;
} else {
return false;
}
return true;
}
示例9: log_in
/**
* user log in
*
* @param <String> $username
* @param <String> $password
* @param <String> $ip
*/
public static function log_in($username, $password, $ip = NULL)
{
$manager = Mymanager::instance()->get_by_username($username);
if ($manager['id']) {
if ($manager['password'] == md5($password)) {
if (is_null($ip)) {
$ip = tool::get_long_ip();
}
$data = array();
$data['login_time'] = tool::db_date();
$data['login_num'] = $manager['login_num'] + 1;
$data['login_ip'] = $ip;
return Mymanager::instance()->update($data);
} else {
return false;
}
} else {
return false;
}
}
示例10: chk
public function chk($id)
{
if (empty($id)) {
return false;
}
$where = array();
$where['id'] = $id;
$rpt = ORM::factory('ag_settle_month', $id);
if ($rpt->loaded) {
if ($rpt->flag != 2) {
return 1;
} else {
if ($rpt->agent_type == 2) {
return 2;
}
}
$userid = $rpt->user_id;
$logtypexx = 9;
$rpt->flag = 3;
$rpt->date_add = date('Y-m-d H:i:s', time());
$rpt->save();
$userobj = user::get_instance();
$usermoney = $userobj->get_user_money($userid);
$money_type = 'BONUS_MONEY';
$money_type_set = Kohana::config('money_type');
if (array_key_exists($money_type, $money_type_set)) {
$money_type_name = $money_type_set[$money_type];
//记录日志
$data_log = array();
$data_log['order_num'] = 0;
$data_log['user_id'] = $userid;
$data_log['log_type'] = $logtypexx;
//参照config acccount_type 设置
$data_log['is_in'] = 0;
$data_log['price'] = $rpt->bonus;
$data_log['user_money'] = $usermoney;
$data_log['memo'] = '月结返利';
if ($rpt->bonus < 0) {
$data_log['price'] = $rpt->bonus * -1;
$data_log['is_in'] = 1;
if ($rpt->taxflag == 90) {
$data_log['memo'] = '月结扣税';
} else {
$data_log['memo'] = '其他';
}
}
$user_money = user_money::get_instance();
$um = $user_money->update_money($data_log['is_in'], $data_log['user_id'], $data_log['price'], $data_log['log_type'], $data_log['order_num'], $money_type, $data_log['memo']);
if (!$um) {
$rpt->flag = 91;
$rpt->date_add = date('Y-m-d H:i:s', time());
$rpt->save();
return 4;
} else {
//添加日志
$logs_data = array();
$logs_data['manager_id'] = 0;
// $this->manager_id;
$logs_data['user_log_type'] = 29;
$logs_data['ip'] = tool::get_long_ip();
$logs_data['memo'] = "成功为代理商{$id}返利{$money_type_name}{$rpt->bonus}";
ulog::instance()->add($logs_data);
// remind::set($money_type_name.'返利成功',request::referrer(),'success');
$rpt->flag = 4;
$rpt->date_add = date('Y-m-d H:i:s', time());
$rpt->save();
}
}
} else {
return 3;
}
}
示例11: get_agent_detail
public static function get_agent_detail()
{
$result = array();
$version = '';
$major_version = '';
$minor_version = '';
$browser_type = '';
$agent = $_SERVER['HTTP_USER_AGENT'];
$preparens = '';
$parens = '';
$left_position = strpos($agent, '(');
if ($left_position >= 0) {
$preparens = trim(substr($agent, 0, $left_position));
$parens = substr($agent, $left_position + 1, strlen($agent));
if (strpos($parens, ')') >= 0) {
$parens = substr($parens, 0, strpos($parens, ')'));
}
} else {
$preparens = $agent;
}
$browser_version = $preparens;
$token = trim(strtok($parens, ';'));
while ($token) {
if (preg_match('/MSIE/i', $token) || preg_match('/Opera/i', $token)) {
$browser_version = $token;
}
$token = strtok(';');
}
$msie_index = strpos($browser_version, 'MSIE');
if ($msie_index >= 0) {
$browser_version = substr($browser_version, $msie_index, strlen($browser_version));
}
$leftover = '';
if (substr($browser_version, 0, strlen('Mozilla')) == 'Mozilla') {
$browser_type = 'Netscape';
$leftover = substr($browser_version, strlen('Mozilla') + 1, strlen($browser_version));
} elseif (substr($browser_version, 0, strlen('Lynx')) == 'Lynx') {
$browser_type = 'Lynx';
$leftover = substr($browser_version, strlen('Lynx') + 1, strlen($browser_version));
} elseif (substr($browser_version, 0, strlen('MSIE')) == 'MSIE') {
$browser_type = 'IE';
$leftover = substr($browser_version, strlen('MSIE') + 1, strlen($browser_version));
} elseif (substr($browser_version, 0, strlen('Microsoft Internet Explorer')) == 'Microsoft Internet Explorer') {
$browser_type = 'IE';
$leftover = substr($browser_version, strlen('Microsoft Internet Explorer') + 1, strlen($browser_version));
} elseif (substr($browser_version, 0, strlen('Opera')) == 'Opera') {
$browser_type = 'Opera';
$leftover = substr($browser_version, strlen('Opera') + 1, strlen($browser_version));
}
$leftover = trim($leftover);
$i = strpos($leftover, ' ');
if ($i > 0) {
$version = substr($leftover, 0, $i);
} else {
$version = $leftover;
}
$j = strpos($version, '.');
if ($j >= 0) {
$major_version = substr($version, 0, $j);
$minor_version = substr($version, $j + 1, strlen($version));
} else {
$major_version = $version;
}
$result['agent_detail'] = $agent;
$result['version'] = $browser_version;
$result['major_version'] = $major_version;
$result['minor_version'] = $minor_version;
$result['type'] = $browser_type;
$result['ip'] = tool::get_long_ip();
return $result;
}