How to build an admin panel [SOLVED] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to build an admin panel [SOLVED] (/showthread.php?tid=67391) |
How to build an admin panel [SOLVED] - kirasiris - 02-16-2017 Hello guys, I've been wondering what is the right way to start the admin panel. I mean I already have the admin pages, etc; but what I want is to block the access to the public, is there a way to do it by htaccess, or can you explain me how to do some type of login. And I think is going to be little bit hard, because as stated above all admin pages are done, but I never though of dong a login panel before accessing to it. Here is my controller (Admin/ index function): PHP Code: public function index(){ that's all what I got, I did not even create an admin model, or anything related to it.Neither a table in the databse.) This is my dashboard: As I said the dashboard is completely done, with all the functions working, I just need to block the access RE: How to build an admin panel - stebo - 02-17-2017 Hey, there are several login tutorials available. Just search for e. g. codeigniter 3 login tutorial and you will find a bunch of nice descriptions how to realize a login for your page. With these basics you are able to wrap up your admin sites into a closed area. The easiest way is to set some $_SESSION data like "login = TRUE" after the login was successfull. Then you implement a check in every controller within your admin area, if user is logged in and has access to this controller. If not, redirect him to login page. I hope this will help you ;-) Best regards from Germany RE: How to build an admin panel - ignitedcms - 02-17-2017 The best and easiest permission class I found was: https://github.com/bcit-ci/CodeIgniter/wiki/Permission-Class Which I've integrated into ignited cms and ignited cms pro. RE: How to build an admin panel - Avenirer - 02-17-2017 Try Ion_auth. It's quite basic and does the job well. RE: How to build an admin panel - kirasiris - 02-18-2017 Well this is what I got so far, I do nt want to create another views,etc. I just wat to block all the IP address, or set one Io to have the accesss to these pages. And to do that I put this in my __construct public function __construct() { parent::__construct(); $this->load->model('about_model'); $this->load->model('blog_model'); $this->load->model('categorias_model'); $this->load->model('cookies_model'); $this->load->model('news_model'); $this->load->model('portfolio_model'); $this->load->model('privacy_model'); $this->load->model('terms_model'); $this->load->model('skills_model'); $this->load->model('profesion_model'); $this->load->model('slider_model'); $this->load->library('pagination'); //// Block access to admin pages //// //Here you check ip allowed or not if (!in_array($this->input->ip_address(), array('107.208.103.39','2602:306:bd06:7270:fcdd:74c5:c591:dc4'))) { // Either show 404 show_404(); // OR redirect somewhere else redirect('admin'); } } I found ths tutorial on Stackoverflow, byt apprently I have to create an input as called "ip_address" and I do not know where should I create it, but as I said before I would like to avoid the creating of new controller, views/models etc. RE: How to build an admin panel - ivantcholakov - 02-18-2017 "I do Front-End development most of the time, but I trying to get more into being a full-stack developer, so I'm now learning all what I need to do!" "I just want to do this..., I want to avoid that..." - Why do you waste people's time? Just do what you intend to do. |