限制codeigniter管理面板ip地址 [英] restrict codeigniter admin panel ip address

查看:91
本文介绍了限制codeigniter管理面板ip地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi朋友我想限制ip地址为我的codeignter php网站后端在办公室只是为了安全的原因。

hi friends i want to restrict ip address for my codeignter php website backend at office only for security reason. any advice if someone has already done it ?

推荐答案

除了使用.htaccess之外,您还可以限制从PHP访问虽然.htaccess解决方案更加健壮):

An alternative to using .htaccess, you can also restrict the access from PHP (although .htaccess solution is more robust):

$your_ip_address='123.123.123.123'; //change it to yours
if (!isset($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $your_ip_address)) {
   exit();
}

找到 index.php 在webroot文件夹中,将上面的代码添加到文件的顶部。

Locate the index.php in the webroot folder, add the above codes to the top of the file.

希望这有助于。

这篇关于限制codeigniter管理面板ip地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆