![]() |
Using PHPbb3's Authentication inside CodeIgniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Using PHPbb3's Authentication inside CodeIgniter (/showthread.php?tid=18734) |
Using PHPbb3's Authentication inside CodeIgniter - El Forum - 05-15-2009 [eluser]Ryan Pharis[/eluser] I recently had the need to use PHPbb3 and CodeIgniter together and wanted to use PHPbb's authentication to make things easy. I made a little library to help with that implementation: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); The only problem I ran into was that phpbb uses a function called "redirect" and as you know, CI has a redirect function in the url helper. So, as a compromise, I changed the CI code to ci_redirect() and just have to remember to change that upon upgrading to a new CI version. I have my phpbb install under a directory within my CI site (on the same level as application) and called it "forums" so if you have a different folder name that you place phpbb in, just change that in the constructor for $phpbb_root_path. Just thought I'd put that up there if anyone needs or wants to use phpbb inside of CI. - Ryan Pharis Using PHPbb3's Authentication inside CodeIgniter - El Forum - 09-03-2009 [eluser]vecima[/eluser] Thanks for sharing this Library. It gave me the foothold I needed to do what I wanted to do, which was to use the phpBB3 user/session/login system on my main site. I made only slight modifications to your library, adding a login / logout method. You could just as easily utilize the phpBB3 login / logout methods, except that if you are running locally, (localhost) you need to be sure that phpBB3 is set to use that as it's cookie domain. If you install phpBB3 to your localhost it's probably fine, but if not (I copied my live forum down to my xampplite) then you need to set it. I added these 2 methods to the library: Code: function logout() notice in the login function that the lines with $config are only needed in the case of having a forum on localhost, with it's cookie_domain set wrong (you can test this by logging into the forum on localhost, then check your cookies to see if there are any phpbb3 cookies under "localhost"). in my base controller (that all others inherit from) I defined login and logout methods to use CI form validation: Code: function login($admin = FALSE) and my login view that's shown if you're not logged in has a form: Code: <form action="<?=base_url();?>index.php/<?=$controller;?>/login" method="post"> hopefully I was clear in my description. If not feel free to ask questions. Also feel free to call me out on "crap code" and make a better version - I just wanted it to work, but if you can do it better, by all means show us how! ![]() Using PHPbb3's Authentication inside CodeIgniter - El Forum - 10-15-2009 [eluser]FlashUK[/eluser] Thank you for this useful post! I have successfully used this method to help integrate phpBB3 into Zend Framework 1.9.2 (sadly not CodeIgniter). I will be sharing mode code on my blog which is a direct adaption of this. Thanks for sharing your code! This is probably quickest and easiest method to get phpBB3 up and running in your framework. Using PHPbb3's Authentication inside CodeIgniter - El Forum - 11-02-2009 [eluser]Del Spooner[/eluser] Hello! First, thanks for the class to you both, it's just what I needed. I'm new to CI and I'm not still sure on how to deal with the views. I have my template with separate header/body/footer, but could you provide an example of how to integrate your view (that is, the form)? I'm trying right now, and I can integrate the login into a sliding panel that I set for that purpose, but when I try to login nothing happens. Also, in the 'register' link, this is the url that points to 'http://localhost/PHPBB_FORUM_PATH/ucp.php?mode=register', there's a constant there that didn't load so I guess I'm not correctly loading the view :S Could you show the way to a noob like me? Thanks for your time =) |