User authentication with CodeIgniter

前端 未结 7 972
名媛妹妹
名媛妹妹 2021-02-05 19:22

I am writing a web application using PHP. I want to use the MVC pattern for this, and decided to go with CodeIgniter. My application will have some pages which will require auth

相关标签:
7条回答
  • 2021-02-05 19:53

    Visit GitHub and search for Codeigniter Auth or Authentication, or check the CodeIgniter Wiki, you'll find many libraries with different features.. explore them and choose the one you need! But be careful, many are for CI 2, and you have to ucfirst the classes to use with CI 3, otherwise they don't work at all.

    0 讨论(0)
  • 2021-02-05 19:55

    Use flexi auth a modified version of the popular Ion Auth library. It's more advanced and do all the job out-of-the-box.

    flexi auth is a free open source user authentication/login library for use with the CodeIgniter 2.0+ framework.

    I know it's too late but I hope someone else will find it helpful. Cheers!

    0 讨论(0)
  • 2021-02-05 19:58

    I was looking into the same thing recently, and I found a CodeIgniter fork called Kohana that includes a nice authentication module. If you are set on CI, maybe adapting Kohana's auth module backwards to CI would save you some time? If you have just started out on your project and PHP5 is OK to use, consider switching over; they are very similar frameworks.

    0 讨论(0)
  • 2021-02-05 20:02

    May be you can use CL_AUTH library for CI. I've used it and it works good. You can find it here http://www.jasonashdown.co.uk/cl_auth_doc/

    0 讨论(0)
  • 2021-02-05 20:07

    "Ion Auth" is lean, well-programmed, somewhat widely used and is actively maintained.

    http://github.com/benedmunds/CodeIgniter-Ion-Auth

    0 讨论(0)
  • 2021-02-05 20:12

    If by "some pages" you mean some controllers (the gateway to your views), then you may want to investigate controller inheritance. Extend the default CodeIgniter controller with your own and put an authentication check in the constructor (check the session for a logged in flag or something and if not logged in then redirect to login page). Then, all controllers that require authentication will need to extend your new parent controller. That's it.

    Head on over to the CodeIgniter forums and search for some different ways to extend the controller. Here is one http://codeigniter.com/forums/viewthread/89768/#452890

    0 讨论(0)
提交回复
热议问题