Auth noob some advice |
Hi all,
I'm new to codeigniter and new in php framework world. xD This is my story: I made a personal website based on bootstrap, and suddenly I thought that a login system was helpful for my needs. So I start to first build up a login system coding in php on my own, then i destroy everything to find some good php script but I didn't find anything good (I don't want just copy & paste so understand others code sometimes need a lot of time that I don't have). So I found out php frameworks. After I've try a few, I decide that CodeIgniter is for me, simple, fast and synergize well and easily with bootstrap. So here I am. I have my nice CI app, my bootstrap website work with views and controls now and everything is good. Now, I need to build a simple auth system (registration/login/logout). I know that CI doesn't have anything like this in its package. Can you advice me a good tutorial or a plug-in (i read about ion auth) that I can study to make my own login system? Thank you in advance, you are my last hope and sorry for my bad English
Hello Psygnosis,
The Ion Auth is actually quite good, but it could be difficult for php beginners. I show you a basic auth system with the help of useful CI libraries. Let's see the login view: Code: /* send the post data to the Controller called Verify_login.php Now, the Controller called Verify_login.php: PHP Code: <?php The Login_model admin_auth method: PHP Code: function admin_auth($username, $password) And finally, the admin function which checks the session array, and if it's not exists, any requests will be redirected to the login view. Code: public function index() I hope it can help you, and remember: it is just an example to practice with, there are so many ways of auth. And for the sake of safety, you can find better hashing algorythms, and you can also validate forms with javascript too. PS: To use sessions, you have to set the $config['encryption_key'] = ''; in the application/config/config.php Bonus: http://jeffreybarke.net/tools/codeignite...generator/ Good luck, and tell me if you get stucked somewhere.
Your tube has many. Some of the better ones use old versions of CI but they are still useful. Search youtube for "Code Igniter From Scratch." They have a small login example.
I made one called Community Auth. I think it's easy to use. Take a look. Links below:
Thank you all,
For now I've tried Ion Auth with no result =( I just make a copy of my app, install all the files as the author said, rename models/ion_auth_model.php => models/Ion_auth_model.php controllers/auth.php => controllers/Auth.php upload the sql to the db and if I point to localhost/app/index.php/Auth or localhost/app/auth i have 404 =( I'd just like to see how it works for studing =( then I will try petrinze code to see what's happening |
Welcome Guest, Not a member yet? Register Sign In |