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


PHP Base_Common::ip2long方法代码示例

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


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

示例1: pageViewAction

 /**
  *问题浏览量更新
  */
 public function pageViewAction()
 {
     //基础元素,必须参与验证
     $View['PageId'] = abs(intval($this->request->PageId));
     $View['ViewIP'] = urldecode(trim($this->request->ViewIP));
     $View['Time'] = abs(intval($this->request->Time));
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = '5173';
     $sign_to_check = base_common::check_sign($View, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证时间戳,时差超过600秒即认为非法
         if (abs($View['Time'] - time()) <= 600) {
             $View['ViewIP'] = Base_Common::ip2long($View['ViewIP']);
             $InsertLog = $this->oView->addViewLog($View);
             if ($InsertLog) {
                 $result = array('return' => 1, 'comment' => "添加成功");
             } else {
                 $result = array('return' => 2, 'comment' => "添加失败");
             }
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     echo json_encode($result);
 }
开发者ID:eappl,项目名称:prototype,代码行数:34,代码来源:ViewController.php

示例2: insertPvAction

 /**
  *账号生成
  */
 public function insertPvAction()
 {
     //基础元素,必须参与验证
     $PV['PageId'] = abs(intval($this->request->PageId));
     $PV['Time'] = abs(intval($this->request->Time));
     $PV['IP'] = $this->request->IP ? $this->request->IP : "127.0.0.1";
     $PV['Browser'] = $this->request->Browser;
     $PV['UserSourceId'] = abs(intval($this->request->UserSourceId));
     $PV['UserSourceDetail'] = abs(intval($this->request->UserSourceDetail));
     $PV['UserSourceProjectId'] = abs(intval($this->request->UserSourceProjectId));
     $PV['UserSourceActionId'] = abs(intval($this->request->UserSourceActionId));
     $PV['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = base_common::check_sign($PV, $p_sign);
     //不参与验证的元素
     $PV['IP'] = Base_Common::ip2long($PV['IP']);
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证时间戳,时差超过600秒即认为非法
         if (abs($PV['Time'] - time()) <= 600) {
             unset($PV['ReturnType']);
             if ($PV['UserSourceId'] == 9 && $PV['UserSourceDetail'] == 24) {
                 $insertLog = true;
             } else {
                 $insertLog = $this->oPV->insertPvLog($PV);
             }
             if ($insertLog) {
                 $result = array('return' => 1, 'comment' => "记录成功");
             } else {
                 $result = array('return' => 0, 'comment' => "记录失败");
             }
         } else {
             $result = array('return' => 2, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 2, 'comment' => "验证失败,请检查URL");
     }
     $PV['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     if ($PV['ReturnType'] == 1) {
         echo json_encode($result);
     }
 }
开发者ID:eappl,项目名称:prototype,代码行数:48,代码来源:PvController.php

示例3: getServerByIpAction

 /**
  *获取服务器列表登录
  */
 public function getServerByIpAction()
 {
     //基础元素,必须参与验证
     $Config['ServerIp'] = $this->request->ServerIp;
     $Config['Time'] = abs(intval($this->request->Time));
     $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = trim($this->request->sign);
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Config, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证时间戳,时差超过600秒即认为非法
         if (abs($Config['Time'] - time()) <= 600) {
             if ($Config['ServerIp']) {
                 $ServerIp = Base_Common::ip2long($Config['ServerIp']);
                 $ServerInfo = $this->oServer->getByIp($ServerIp);
                 if ($ServerInfo['ServerId']) {
                     $result = array('return' => 1, 'ServerInfo' => $ServerInfo, 'comment' => '找到服务器');
                 } else {
                     $result = array('return' => 2, 'comment' => '你所查询的IP不属于任何服务器');
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "请输入服务器IP");
             }
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     if ($Config['ReturnType'] == 1) {
         echo json_encode($result);
     } else {
         $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']);
         if ($result['return'] == 1) {
             $r = $r . "|" . $result['ServerInfo']['ServerId'] . "|" . iconv('UTF-8', 'GBK', $result['ServerInfo']['name']);
         }
         echo $r;
     }
 }
开发者ID:032404cxd,项目名称:prototype_main,代码行数:46,代码来源:ServerController.php

示例4: createOrderAction

 /**
  *生成订单
  */
 public function createOrderAction()
 {
     //基础元素,必须参与验证
     $Order['PayUserId'] = abs(intval($this->request->PayUserId));
     $Order['AcceptUserId'] = abs(intval($this->request->AcceptUserId));
     $Order['OrderTime'] = abs(intval($this->request->OrderTime));
     $Order['ServerId'] = abs(intval($this->request->ServerId)) ? abs(intval($this->request->ServerId)) : 101001001;
     $Order['PassageId'] = abs(intval($this->request->PassageId)) ? abs(intval($this->request->PassageId)) : 0;
     $Order['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : "";
     $Order['Coin'] = abs(intval($this->request->Coin)) ? abs(intval($this->request->Coin)) : 0;
     $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     $Order['OrderIP'] = $this->request->OrderIP ? $this->request->OrderIP : "127.0.0.1";
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     //print_R($Order);
     $sign_to_check = Base_common::check_sign($Order, $p_sign);
     //不参与验证的元素
     $Order['OrderIP'] = Base_Common::ip2long($Order['OrderIP']);
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         if ($Order['ServerId']) {
             //验证用户名有效性
             if ($Order['AcceptUserId']) {
                 if ($Order['PassageId']) {
                     //验证时间戳,时差超过600秒即认为非法
                     if (abs($Order['OrderTime'] - time()) <= 600) {
                         //查询用户
                         $AcceptUserInfo = $this->oUser->GetUserById($Order['AcceptUserId']);
                         if ($AcceptUserInfo['UserId']) {
                             //如果指定支付方
                             if ($Order['PayUserId']) {
                                 //查询用户
                                 $PayUserInfo = $this->oUser->GetUserById($Order['PayUserId']);
                             }
                             //如果不指定支付方或者支付方确定存在
                             if ($PayUserInfo['UserId'] || $Order['PayUserId'] == 0) {
                                 //获取服务器信息
                                 $ServerInfo = $this->oServer->getRow($Order['ServerId']);
                                 if ($ServerInfo['ServerId']) {
                                     if ($ServerInfo['AppId'] && $ServerInfo['PartnerId']) {
                                         $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']);
                                         //验证游戏-平台信息
                                         $PartnerInfo = $this->oPartnerApp->getRow($bind);
                                         if ($PartnerInfo['AppId'] && $PartnerInfo['PartnerId']) {
                                             $AppInfo = $this->oApp->getRow($PartnerInfo['AppId']);
                                             if ($AppInfo['AppId']) {
                                                 //获取支付方式信息
                                                 $PassageInfo = $this->oPassage->getRow($Order['PassageId']);
                                                 if ($PassageInfo['passage_id']) {
                                                     $Order['AppId'] = $ServerInfo['AppId'];
                                                     $Order['PartnerId'] = $ServerInfo['PartnerId'];
                                                     $Order['Amount'] = $PassageInfo['finance_rate'] * $Order['Coin'];
                                                     $Order['Credit'] = $PassageInfo['finance_rate'] * $Order['Coin'];
                                                     $Order['ExchangeRate'] = $AppInfo['exchange_rate'];
                                                     $Order['AppCoin'] = $AppInfo['exchange_rate'] * $Order['Coin'];
                                                     $Order['OrderStatus'] = 0;
                                                     $Order['UserSourceId'] = $AcceptUserInfo['UserSourceId'];
                                                     $Order['UserSourceDetail'] = $AcceptUserInfo['UserSourceDetail'];
                                                     $Order['UserSourceProjectId'] = $AcceptUserInfo['UserSourceProjectId'];
                                                     $Order['UserSourceActionId'] = $AcceptUserInfo['UserSourceActionId'];
                                                     $Order['UserRegTime'] = $AcceptUserInfo['UserRegTime'];
                                                     unset($Order['ReturnType']);
                                                     $createOrder = $this->oOrder->createOrder($Order);
                                                     if (intval($createOrder)) {
                                                         $result = array('return' => 1, 'OrderId' => $createOrder, 'comment' => "下单成功");
                                                     } else {
                                                         $result = array('return' => 2, 'comment' => "下单失败");
                                                     }
                                                 } else {
                                                     $result = array('return' => 0, 'comment' => "您所选择的支付方式不存在");
                                                 }
                                             } else {
                                                 $result = array('return' => 0, 'comment' => "您所选择的游戏不存在");
                                             }
                                         } else {
                                             $result = array('return' => 0, 'comment' => "您所选择的游戏-平台不存在");
                                         }
                                     } else {
                                         $result = array('return' => 0, 'comment' => "您所选择的服务器配置不完整");
                                     }
                                 } else {
                                     $result = array('return' => 0, 'comment' => "您所选择的服务器不存在");
                                 }
                             } else {
                                 $result = array('return' => 0, 'comment' => "支付方用户不存在");
                             }
                         } else {
                             $result = array('return' => 2, 'comment' => "接收方用户不存在");
                         }
                     } else {
                         $result = array('return' => 0, 'comment' => "时间有误");
                     }
                 } else {
                     $result = array('return' => 0, 'comment' => "请选择支付方式");
                 }
//.........这里部分代码省略.........
开发者ID:032404cxd,项目名称:prototype_main,代码行数:101,代码来源:OrderController.php

示例5: createKa91OrderAction

 public function createKa91OrderAction()
 {
     //基础元素,必须参与验证
     $Order['UserName'] = $this->request->UserName;
     $Order['OrderTime'] = abs(intval($this->request->OrderTime));
     $Order['ServerId'] = abs(intval($this->request->ServerId)) ? abs(intval($this->request->ServerId)) : 101001001;
     $Order['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : "";
     $Order['Coin'] = abs(intval($this->request->Coin)) ? abs(intval($this->request->Coin)) : 0;
     $Order['OrderIP'] = $this->request->OrderIP ? $this->request->OrderIP : "127.0.0.1";
     $Order['PayIP'] = $this->request->PayIP ? $this->request->PayIP : "127.0.0.1";
     $Order['PayTime'] = abs(intval($this->request->PayTime));
     $Order['StageOrder'] = $this->request->StageOrder;
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Order, $p_sign);
     //不参与验证的元素
     $Order['OrderIP'] = Base_Common::ip2long($Order['OrderIP']);
     $Order['PayIP'] = Base_Common::ip2long($Order['PayIP']);
     if (in_array($_SERVER["REMOTE_ADDR"], array('61.145.117.183', '61.145.117.184', '219.136.252.38', '121.9.211.6'))) {
         //验证URL是否来自可信的发信方
         if ($sign_to_check == $sign) {
             if ($Order['ServerId']) {
                 //验证用户名有效性
                 if ($Order['UserName']) {
                     //验证时间戳,时差超过600秒即认为非法
                     if (abs($Order['PayTime'] - time()) <= 600) {
                         //查询用户
                         $UserInfo = $this->oUser->GetUserByName($Order['UserName']);
                         if ($UserInfo['UserId']) {
                             $Order['PayUserId'] = $UserInfo['UserId'];
                             $Order['AcceptUserId'] = $UserInfo['UserId'];
                             //获取服务器信息
                             $ServerInfo = $this->oServer->getRow($Order['ServerId']);
                             if ($ServerInfo['ServerId']) {
                                 if ($ServerInfo['AppId'] && $ServerInfo['PartnerId']) {
                                     $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']);
                                     //验证游戏-平台信息
                                     $PartnerInfo = $this->oPartnerApp->getRow($bind);
                                     if ($PartnerInfo['AppId'] && $PartnerInfo['PartnerId']) {
                                         $AppInfo = $this->oApp->getRow($PartnerInfo['AppId']);
                                         if ($AppInfo['AppId']) {
                                             //获取支付方式信息
                                             $PassageInfo = $this->oPassage->getByPassage("Ka91");
                                             if ($PassageInfo['passage_id']) {
                                                 $checkStageOrder = $this->oPay->getKa91StageOrder($Order['StageOrder']);
                                                 if ($checkStageOrder['StageOrder']) {
                                                     $result = array('return' => 1, 'OrderId' => $checkStageOrder['OrderId'], 'comment' => "已经执行过,无需重复执行");
                                                 } else {
                                                     $Order['PassageId'] = $PassageInfo['passage_id'];
                                                     $Order['AppId'] = $ServerInfo['AppId'];
                                                     $Order['PartnerId'] = $ServerInfo['PartnerId'];
                                                     $Order['Amount'] = $PassageInfo['finance_rate'] * $Order['Coin'];
                                                     $Order['Credit'] = $PassageInfo['finance_rate'] * $Order['Coin'];
                                                     $Order['ExchangeRate'] = $AppInfo['exchange_rate'];
                                                     $Order['AppCoin'] = $AppInfo['exchange_rate'] * $Order['Coin'];
                                                     $Order['OrderStatus'] = 1;
                                                     $Order['UserSourceId'] = $UserInfo['UserSourceId'];
                                                     $Order['UserSourceDetail'] = $UserInfo['UserSourceDetail'];
                                                     $Order['UserSourceProjectId'] = $UserInfo['UserSourceProjectId'];
                                                     $Order['UserSourceActionId'] = $UserInfo['UserSourceActionId'];
                                                     $Order['UserRegTime'] = $UserInfo['UserRegTime'];
                                                     $Pay['PayUserId'] = $Order['PayUserId'];
                                                     $Pay['AcceptUserId'] = $Order['AcceptUserId'];
                                                     $Pay['PassageId'] = $Order['PassageId'];
                                                     $Pay['SubPassageId'] = $Order['SubPassageId'];
                                                     $Pay['PayIP'] = $Order['PayIP'];
                                                     $Pay['AppId'] = $Order['AppId'];
                                                     $Pay['PartnerId'] = $Order['PartnerId'];
                                                     $Pay['PayTime'] = $Order['PayTime'];
                                                     $Pay['PayedTime'] = $Order['PayTime'];
                                                     $Pay['Coin'] = $Order['Coin'];
                                                     $Pay['Amount'] = $Order['Amount'];
                                                     $Pay['Credit'] = $Order['Credit'];
                                                     $Pay['StageOrder'] = $Order['StageOrder'];
                                                     $Pay['UserSourceId'] = $Order['UserSourceId'];
                                                     $Pay['UserSourceDetail'] = $Order['UserSourceDetail'];
                                                     $Pay['UserSourceProjectId'] = $Order['UserSourceProjectId'];
                                                     $Pay['UserSourceActionId'] = $Order['UserSourceActionId'];
                                                     $Pay['UserRegTime'] = $Order['UserRegTime'];
                                                     unset($Order['StageOrder'], $Order['UserName']);
                                                     $Ka91Pay = $this->oPay->createKa91Pay($Order, $Pay);
                                                     if (intval($Ka91Pay)) {
                                                         $result = array('return' => 1, 'OrderId' => $Ka91Pay, 'comment' => "充值成功");
                                                         $this->oExchange->createExchangeQueueByOrder(array('OrderId' => $Ka91Pay));
                                                     } else {
                                                         $result = array('return' => 2, 'comment' => "充值失败");
                                                     }
                                                 }
                                             } else {
                                                 $result = array('return' => 0, 'comment' => "您所选择的支付方式不存在");
                                             }
                                         } else {
                                             $result = array('return' => 0, 'comment' => "您所选择的游戏不存在");
                                         }
                                     } else {
                                         $result = array('return' => 0, 'comment' => "您所选择的游戏-平台不存在");
                                     }
                                 } else {
//.........这里部分代码省略.........
开发者ID:032404cxd,项目名称:prototype_main,代码行数:101,代码来源:Ka91Controller.php

示例6: createPayAction

 public function createPayAction()
 {
     //基础元素,必须参与验证
     $Pay['OrderId'] = $this->request->OrderId;
     $Pay['PassageId'] = abs(intval($this->request->PassageId));
     $Pay['SubPassageId'] = $this->request->SubPassageId ? $this->request->SubPassageId : "";
     $Pay['PayTime'] = abs(intval($this->request->PayTime)) ? abs(intval($this->request->PayTime)) : time();
     $Pay['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     $Pay['PayIP'] = $this->request->PayIP ? $this->request->PayIP : "127.0.0.1";
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Pay, $p_sign);
     //不参与验证的元素
     $Pay['PayIP'] = Base_Common::ip2long($Pay['PayIP']);
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //检查订单号
         if ($Pay['OrderId']) {
             if (abs($Pay['PayTime'] - time()) <= 600) {
                 //查询订单
                 $OrderInfo = $this->oOrder->getRow($Pay['OrderId']);
                 //如果订单未作废
                 if ($OrderInfo['OrderId']) {
                     if ($OrderInfo['OrderStatus'] == 0) {
                         //如果指定支付方
                         if ($OrderInfo['PayUserId']) {
                             //查询用户
                             $PayUserInfo = $this->oUser->GetUserById($OrderInfo['PayUserId']);
                         }
                         //如果不指定支付方或者支付方确定存在
                         if ($PayUserInfo['UserId'] || $Order['PayUserId'] == 0) {
                             //检查收款方用户
                             $AcceptUserInfo = $this->oUser->GetUserById($OrderInfo['AcceptUserId']);
                             if ($AcceptUserInfo['UserId']) {
                                 if ($Pay['PassageId'] != $OrderInfo['PassageId']) {
                                     $PassageInfo = $this->oPassage->getRow($Pay['PassageId']);
                                 } else {
                                     $PassageInfo = $this->oPassage->getRow($OrderInfo['PassageId']);
                                 }
                                 //获取支付方式信息
                                 if ($PassageInfo['passage_id']) {
                                     //检查服务器配置
                                     $ServerInfo = $this->oServer->getRow($OrderInfo['ServerId']);
                                     if ($ServerInfo['ServerId']) {
                                         if ($ServerInfo['PartnerId'] && $ServerInfo['AppId']) {
                                             $bind = array($ServerInfo['PartnerId'], $ServerInfo['AppId']);
                                             //验证游戏-运营商信息
                                             $PartnerAppInfo = $this->oPartnerApp->getRow($bind);
                                             if ($PartnerAppInfo['AppId'] && $PartnerAppInfo['PartnerId']) {
                                                 //验证游戏信息
                                                 $AppInfo = $this->oApp->getRow($ServerInfo['AppId']);
                                                 if ($AppInfo['AppId']) {
                                                     //检测运营商信息
                                                     $PartnerInfo = $this->oPartner->getRow($ServerInfo['PartnerId']);
                                                     if ($PartnerInfo['PartnerId']) {
                                                         //如果关联支付订单存在
                                                         if ($OrderInfo['PayId']) {
                                                             $result = array('return' => 0, 'comment' => "该订单已经支付完毕");
                                                         } else {
                                                             $OrderUpdateArr = array('PayIp' => $Pay['PayIP'], 'PassageId' => $Pay['PassageId'], 'PayTime' => $Pay['PayTime']);
                                                             $OrderUpdate = $this->oOrder->updateOrder($Pay['OrderId'], $OrderInfo['AcceptUserId'], $OrderUpdateArr);
                                                             $PassageClassName = "Lm_Pay_Passage_" . $PassageInfo['passage'];
                                                             $oPayPassage = new $PassageClassName();
                                                             $PayUrl = $oPayPassage->createPay($AppInfo, $PartnerInfo, $ServerInfo, $PassageInfo, $OrderInfo, $Pay);
                                                             $result = array('return' => 1, 'PayUrl' => $PayUrl, 'StageUrl' => $PassageInfo['StageUrl'], 'comment' => "该订单可以继续支付");
                                                         }
                                                     } else {
                                                         $result = array('return' => 0, 'comment' => "所选择的游戏不存在");
                                                     }
                                                 } else {
                                                     $result = array('return' => 0, 'comment' => "所选择的游戏不存在");
                                                 }
                                             } else {
                                                 $result = array('return' => 0, 'comment' => "所选择的游戏-运营商不存在");
                                             }
                                         } else {
                                             $result = array('return' => 0, 'comment' => "所选择的服务器配置不完整");
                                         }
                                     } else {
                                         $result = array('return' => 0, 'comment' => "所选择的服务器不存在");
                                     }
                                 } else {
                                     $result = array('return' => 0, 'comment' => "支付方式不存在");
                                 }
                             } else {
                                 $result = array('return' => 0, 'comment' => "收款方用户不存在");
                             }
                         } else {
                             $result = array('return' => 0, 'comment' => "支付方用户不存在");
                         }
                     } else {
                         if ($OrderInfo['OrderStatus'] == -1) {
                             $result = array('return' => 0, 'comment' => "该订单已经作废");
                         } elseif ($OrderInfo['OrderStatus'] > 1) {
                             $result = array('return' => 0, 'comment' => "该订单已经支付完毕");
                         }
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:eappl,项目名称:prototype,代码行数:101,代码来源:PayController.php

示例7: checkIpAction

 public function checkIpAction()
 {
     $type = trim($this->request->type);
     //LocalIP 或者 WebIP
     $ip = Base_Common::ip2long($this->request->ip);
     $MachineId = $this->request->MachineId ? abs($this->request->MachineId) : 0;
     if (!empty($ip)) {
         if ($MachineId) {
             //有MachineId 表示是修改页面的
             $array = array($type => $ip);
             $checkIPList = $this->oMachine->getByParam($array, "MachineId," . $type);
             if (count($checkIPList) == 0 || count($checkIPList) == 1 && $checkIPList[0]["MachineId"] == $MachineId) {
                 echo "yes";
             } else {
                 echo "no";
             }
         } else {
             $return = $this->oMachine->getRowByKey($type, $ip);
             if ($return) {
                 echo "no";
             } else {
                 echo "yes";
             }
         }
     }
 }
开发者ID:eappl,项目名称:prototype,代码行数:26,代码来源:MachineController.php

示例8: updateAction

 /**
  * 修改数据
  * @return unknown_type
  */
 public function updateAction()
 {
     /**
      * 记录日志
      */
     $log = "区服修改入库\n\nServerIp:\n" . $this->request->getServer('SERVER_ADDR') . "\n\nGET:\n" . var_export($_GET, true) . "\n\nPOST:\n" . var_export($_POST, true);
     $this->oLogManager->push('log', $log);
     //检查权限
     $this->manager->checkMenuPermission($this->sign, Widget_Manager::MENU_PURVIEW_UPDATE);
     $bind = $this->request->from('ServerId', 'name', 'AppId', 'PartnerId', 'LoginStart', 'NextStart', 'NextEnd', 'PayStart', 'PayEnd', 'ServerIp', 'SocketPort', 'ServerSocketPort', 'IpListWhite', 'IpListBlack', 'is_show', 'GMIp', 'GMSocketPort');
     $bind['LoginStart'] = strtotime($this->request->LoginStart);
     $bind['NextEnd'] = strtotime($this->request->NextEnd);
     $bind['NextStart'] = strtotime($this->request->NextStart);
     $bind['PayEnd'] = strtotime($this->request->PayEnd);
     $bind['PayStart'] = strtotime($this->request->PayStart);
     $bind['ServerIp'] = Base_Common::ip2long($bind['ServerIp']);
     $bind['GMIp'] = Base_Common::ip2long($bind['GMIp']);
     if (!empty($bind['IpListWhite'])) {
         $t = explode(',', $bind['IpListWhite']);
         foreach ($t as $key => $value) {
             $Comment['IpListWhite'][Base_Common::ip2long(trim($value))] = 1;
         }
         ksort($Comment['IpListWhite']);
     }
     if (!empty($bind['IpListBlack'])) {
         $t = explode(',', $bind['IpListBlack']);
         foreach ($t as $key => $value) {
             $Comment['IpListBlack'][Base_Common::ip2long(trim($value))] = 1;
         }
         ksort($Comment['IpListBlack']);
     }
     $bind['Comment'] = json_encode($Comment);
     unset($bind['IpListWhite'], $bind['IpListBlack']);
     //名称
     if (empty($bind['name'])) {
         echo json_encode(array('errno' => 2));
         return false;
     }
     //停服时间
     if (!empty($bind['NextStart']) && !empty($bind['NextEnd'])) {
         if ($bind['NextStart'] <= $bind['NextEnd']) {
             echo json_encode(array('errno' => 3));
             return false;
         }
     }
     //支付时间
     if (!empty($bind['PayStart']) && !empty($bind['PayEnd'])) {
         if ($bind['PayStart'] <= $bind['PayEnd']) {
             echo json_encode(array('errno' => 4));
             return false;
         }
     }
     $res = $this->oServer->update($this->request->old_ServerId, $bind);
     if ($res) {
         $response = array('errno' => 0, 'app' => $bind['AppId'], 'partner' => $bind['PartnerId']);
         $this->oServer->reBuildServerConfig();
     } else {
         $response = array('errno' => 9);
     }
     echo json_encode($response);
     return true;
 }
开发者ID:eappl,项目名称:prototype,代码行数:66,代码来源:ServerController.php

示例9: updateUserPasswordAction

 /**
  *更新密码
  */
 public function updateUserPasswordAction()
 {
     //基础元素,必须参与验证
     $User['UserId'] = abs(intval($this->request->UserId));
     $User['UserPassWordOld'] = $this->request->UserPassWordOld;
     $User['UserPassWord'] = $this->request->UserPassWord;
     $User['UserPassWordR'] = $this->request->UserPassWordR;
     $User['Time'] = abs(intval($this->request->Time));
     $User['PartnerId'] = abs(intval($this->request->PartnerId)) ? abs(intval($this->request->PartnerId)) : 1;
     $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     $start_time = microtime(true);
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = base_common::check_sign($User, $p_sign);
     //不参与验证的元素
     $User['UserRegIP'] = Base_Common::ip2long($_SERVER["REMOTE_ADDR"]);
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证用户名有效性
         if ($User['UserId']) {
             //验证时间戳,时差超过600秒即认为非法
             if (abs($User['Time'] - time()) <= 600) {
                 //验证密码长度不小于6
                 if (strlen($User['UserPassWord']) >= 6) {
                     //验证两次输入密码是否相同
                     if ($User['UserPassWordR'] == $User['UserPassWord']) {
                         //验证原密码输入
                         if ($User['UserPassWordOld']) {
                             //验证原密码是否与新密码相同
                             if ($User['PassWordOld'] != md5($User['UserPassWord'])) {
                                 //获取用户信息
                                 $UserInfo = $this->oUser->GetUserById($User['UserId']);
                                 if ($UserInfo['UserId']) {
                                     if ($UserInfo['UserPassWord'] == $User['UserPassWordOld']) {
                                         $PartnerInfo = $this->oPartner->getRow($User['PartnerId']);
                                         if ($PartnerInfo['PartnerId']) {
                                             $update = $this->oUser->updateUser($User['UserId'], array('UserPassWord' => md5($User['UserPassWord'])));
                                             if (intval($update) == 1) {
                                                 $result = array('return' => 1, 'comment' => "密码更新成功");
                                             } else {
                                                 $result = array('return' => 0, 'comment' => "更新失败");
                                             }
                                         } else {
                                             $result = array('return' => 2, 'comment' => "用户所属平台数据不存在");
                                         }
                                     } else {
                                         $result = array('return' => 0, 'comment' => "原密码输入错误");
                                     }
                                 } else {
                                     $result = array('return' => 0, 'comment' => "用户不存在");
                                 }
                             } else {
                                 $result = array('return' => 0, 'comment' => "新密码不能与原密码相同");
                             }
                         } else {
                             $result = array('return' => 0, 'comment' => "请输入原密码");
                         }
                     } else {
                         $result = array('return' => 0, 'comment' => "两次输入的密码不相符");
                     }
                 } else {
                     $result = array('return' => 0, 'comment' => "密码长度过短");
                 }
             } else {
                 $result = array('return' => 2, 'comment' => "时间有误");
             }
         } else {
             $result = array('return' => 0, 'comment' => "请输入用户ID");
         }
     } else {
         $result = array('return' => 2, 'comment' => "验证失败,请检查URL");
     }
     $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     if ($User['ReturnType'] == 1) {
         echo json_encode($result);
     } else {
         $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']);
         if ($result['return'] == 1) {
             $r = $r . "|" . $result['UserId'];
         }
         echo $r;
     }
 }
开发者ID:032404cxd,项目名称:prototype_main,代码行数:88,代码来源:UserController.php

示例10: loginByNameAction

 /**
  *用户名方式登录
  */
 public function loginByNameAction()
 {
     //基础元素,必须参与验证
     $User['UserName'] = $this->request->UserName;
     $User['UserPassWord'] = $this->request->UserPassWord;
     $User['LoginTime'] = abs(intval($this->request->LoginTime));
     $User['ServerId'] = abs(intval($this->request->ServerId));
     $User['UserLoginIP'] = trim($this->request->UserLoginIP);
     $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = base_common::check_sign($User, $p_sign);
     $User['UserLoginIP'] = Base_Common::ip2long($User['UserLoginIP']);
     //不参与验证的元素
     $start = microtime(true);
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证用户名有效性
         if ($User['UserName']) {
             if ($User['ServerId']) {
                 //验证时间戳,时差超过600秒即认为非法
                 if (abs($User['LoginTime'] - time()) <= 600) {
                     //查询用户
                     $UserInfo = $this->oUser->GetUserByName($User['UserName']);
                     unset($User['UserName']);
                     $User['UserId'] = $UserInfo['UserId'];
                     $result = $this->oLogin->UserLogin($User, $UserInfo);
                 } else {
                     $result = array('return' => 0, 'comment' => "时间有误");
                 }
             } else {
                 $result = array('return' => 2, 'comment' => "请选择服务器");
             }
         } else {
             $result = array('return' => 2, 'comment' => "请输入用户名");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     $end = microtime(true);
     if ($User['ReturnType'] == 1) {
         echo json_encode($result);
     } else {
         $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']);
         if ($result['return'] == 1) {
             $r = $r . "|" . $result['LoginId'] . "|" . $result['UserId'] . "|" . $result['adult'];
         }
         echo $r;
     }
 }
开发者ID:eappl,项目名称:prototype,代码行数:56,代码来源:LoginController.php


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