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


PHP ConvertUtil::convertIp方法代码示例

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


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

示例1: foreach

    foreach ($history as $log) {
        ?>
    
									<?php 
        $row = json_decode($log["message"], true);
        ?>
    
									<tr>
										<td>
											<?php 
        echo ConvertUtil::formatDate($log["logtime"], "u");
        ?>
</td>
										<td>
											<?php 
        echo StringUtil::cutStr(!empty($row["address"]) ? $row["address"] : ConvertUtil::convertIp($row["ip"]), 7);
        ?>
</td>
										<td>
											<?php 
        echo $row["ip"];
        ?>
</td>
										<td>
											<?php 
        echo $terminal[$row["terminal"]];
        ?>
</td>
									</tr>
								<?php 
    }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:index.php

示例2: actionIp

 public function actionIp()
 {
     $formSubmit = EnvUtil::submitCheck("securitySubmit");
     if ($formSubmit) {
         if ($_POST["act"] == "") {
             if (isset($_POST["ip"])) {
                 foreach ($_POST["ip"] as $new) {
                     if ($new["ip1"] != "" && $new["ip2"] != "" && $new["ip3"] != "" && $new["ip4"] != "") {
                         $own = 0;
                         $ip = explode(".", Ibos::app()->setting->get("clientip"));
                         for ($i = 1; $i <= 4; $i++) {
                             if (!is_numeric($new["ip" . $i]) || $new["ip" . $i] < 0) {
                                 $new["ip" . $i] = -1;
                                 $own++;
                             } elseif ($new["ip" . $i] == $ip[$i - 1]) {
                                 $own++;
                             }
                             $new["ip" . $i] = intval($new["ip" . $i]);
                         }
                         if ($own == 4) {
                             $this->error(Ibos::lang("Ipban illegal"));
                         }
                         $expiration = TIMESTAMP + $new["validitynew"] * 86400;
                         $new["admin"] = Ibos::app()->user->username;
                         $new["dateline"] = TIMESTAMP;
                         $new["expiration"] = $expiration;
                         IpBanned::model()->add($new);
                     }
                 }
             }
             if (isset($_POST["expiration"])) {
                 $userName = Ibos::app()->user->username;
                 foreach ($_POST["expiration"] as $id => $expiration) {
                     IpBanned::model()->updateExpirationById($id, strtotime($expiration), $userName);
                 }
             }
         } elseif ($_POST["act"] == "del") {
             if (is_array($_POST["id"])) {
                 IpBanned::model()->deleteByPk($_POST["id"]);
             }
         } elseif ($_POST["act"] == "clear") {
             $command = Ibos::app()->db->createCommand();
             $command->delete("{{ipbanned}}");
         }
         CacheUtil::update(array("setting", "ipbanned"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $data = array();
         $lists = IpBanned::model()->fetchAllOrderDateline();
         $list = array();
         foreach ($lists as $banned) {
             for ($i = 1; $i <= 4; $i++) {
                 if ($banned["ip{$i}"] == -1) {
                     $banned["ip{$i}"] = "*";
                 }
             }
             $banned["dateline"] = date("Y-m-d", $banned["dateline"]);
             $banned["expiration"] = date("Y-m-d", $banned["expiration"]);
             $displayIp = "{$banned["ip1"]}.{$banned["ip2"]}.{$banned["ip3"]}.{$banned["ip4"]}";
             $banned["display"] = $displayIp;
             $banned["scope"] = ConvertUtil::convertIp($displayIp);
             $list[] = $banned;
         }
         $data["list"] = $list;
         $this->render("ip", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:67,代码来源:SecurityController.php

示例3: foreach

    foreach ($history as $log) {
        ?>
						<?php 
        $row = json_decode($log["message"], true);
        ?>
						<tr>
							<td><?php 
        echo date("y-n-j H:i:s", $log["logtime"]);
        ?>
</td>
							<td><?php 
        echo $row["ip"];
        ?>
</td>
							<td><?php 
        echo !empty($row["address"]) ? $row["address"] : ConvertUtil::convertIp($row["ip"]);
        ?>
</td>
							<td class="fss"><?php 
        echo $terminal[$row["terminal"]];
        ?>
</td>
						</tr>
					<?php 
    }
    ?>
				<?php 
}
?>
			</tbody>
			<?php 
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:history.php

示例4: actionSecurity

 public function actionSecurity()
 {
     $operation = EnvUtil::getRequest("op");
     if (!in_array($operation, array("setup", "ip", "log"))) {
         $operation = "setup";
     }
     $formSubmit = EnvUtil::submitCheck("securitySubmit");
     if ($formSubmit) {
         switch ($operation) {
             case "setup":
                 $fields = array("expiration", "minlength", "mixed", "errorlimit", "errorrepeat", "errortime", "autologin", "allowshare", "timeout");
                 $updateList = array();
                 foreach ($fields as $field) {
                     if (!isset($_POST[$field])) {
                         $_POST[$field] = 0;
                     }
                     $updateList[$field] = $_POST[$field];
                 }
                 if (intval($updateList["timeout"]) == 0) {
                     $this->error("请填写一个正确的大于0的超时时间值");
                 }
                 Setting::model()->updateSettingValueByKey("account", $updateList);
                 break;
             case "ip":
                 if ($_POST["act"] == "") {
                     if (isset($_POST["ip"])) {
                         foreach ($_POST["ip"] as $new) {
                             if ($new["ip1"] != "" && $new["ip2"] != "" && $new["ip3"] != "" && $new["ip4"] != "") {
                                 $own = 0;
                                 $ip = explode(".", Ibos::app()->setting->get("clientip"));
                                 for ($i = 1; $i <= 4; $i++) {
                                     if (!is_numeric($new["ip" . $i]) || $new["ip" . $i] < 0) {
                                         $new["ip" . $i] = -1;
                                         $own++;
                                     } elseif ($new["ip" . $i] == $ip[$i - 1]) {
                                         $own++;
                                     }
                                     $new["ip" . $i] = intval($new["ip" . $i]);
                                 }
                                 if ($own == 4) {
                                     $this->error(Ibos::lang("Ipban illegal"));
                                 }
                                 $expiration = TIMESTAMP + $new["validitynew"] * 86400;
                                 $new["admin"] = Ibos::app()->user->username;
                                 $new["dateline"] = TIMESTAMP;
                                 $new["expiration"] = $expiration;
                                 IpBanned::model()->add($new);
                             }
                         }
                     }
                     if (isset($_POST["expiration"])) {
                         $userName = Ibos::app()->user->username;
                         foreach ($_POST["expiration"] as $id => $expiration) {
                             IpBanned::model()->updateExpirationById($id, strtotime($expiration), $userName);
                         }
                     }
                 } elseif ($_POST["act"] == "del") {
                     if (is_array($_POST["id"])) {
                         IpBanned::model()->deleteByPk($_POST["id"]);
                     }
                 } elseif ($_POST["act"] == "clear") {
                     $command = Ibos::app()->db->createCommand();
                     $command->delete("{{ipbanned}}");
                 }
                 CacheUtil::update("ipbanned");
                 break;
             default:
                 break;
         }
         CacheUtil::update(array("setting"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $data = array();
         switch ($operation) {
             case "setup":
                 $account = Setting::model()->fetchSettingValueByKey("account");
                 $data["account"] = unserialize($account);
                 break;
             case "ip":
                 $lists = IpBanned::model()->fetchAllOrderDateline();
                 $list = array();
                 foreach ($lists as $banned) {
                     for ($i = 1; $i <= 4; $i++) {
                         if ($banned["ip{$i}"] == -1) {
                             $banned["ip{$i}"] = "*";
                         }
                     }
                     $banned["dateline"] = date("Y-m-d", $banned["dateline"]);
                     $banned["expiration"] = date("Y-m-d", $banned["expiration"]);
                     $displayIp = "{$banned["ip1"]}.{$banned["ip2"]}.{$banned["ip3"]}.{$banned["ip4"]}";
                     $banned["display"] = $displayIp;
                     $banned["scope"] = ConvertUtil::convertIp($displayIp);
                     $list[] = $banned;
                 }
                 $data["list"] = $list;
                 break;
             case "log":
                 $levels = array("admincp", "banned", "illegal", "login");
                 $level = EnvUtil::getRequest("level");
                 $filterAct = EnvUtil::getRequest("filteract");
//.........这里部分代码省略.........
开发者ID:AxelPanda,项目名称:ibos,代码行数:101,代码来源:GlobalController.php


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