Posted By

mladoux on 09/21/10


Tagged

auth php security bridge forum PHPBB3


Versions (?)

Simple PHPBB3 Authentication Bridge


 / Published in: PHP
 

URL: http://mark.haktstudios.com/

A simple bridge to allow your website to integrate it's authentication and session handling with PHPBB3

  1. <?php
  2.  
  3. /////////////////////////////////////////////////
  4. // BEGIN SESSION AND AUTHENTICATION MANAGEMENT //
  5. /////////////////////////////////////////////////
  6.  
  7. define('IN_PHPBB', true);
  8. $phpbb_root_path = './Forum/';
  9. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  10. include($phpbb_root_path . 'common.' . $phpEx);
  11. // Start session management
  12. $user->session_begin();
  13. $auth->acl($user->data);
  14. $user->setup();
  15.  
  16. ///////////////////////////////////////////////
  17. // END SESSION AND AUTHENTICATION MANAGEMENT //
  18. ///////////////////////////////////////////////
  19.  
  20. // is user logged in?
  21. if($user->data['is_registered']){
  22.  
  23. echo 'Weclome ';
  24. print $user->data['username'];
  25. echo '!<br />
  26. <a title="Click here to logout!" href="'.append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a>';
  27. }
  28. else{
  29.  
  30. echo '
  31. <form method="post" action="Forum/ucp.php?mode=login">
  32. <label for="username">Username: </label> <input type="text" name="username" id="username" size="40" /><br /><br />
  33. <label for="password">Password: </label><input type="password" name="password" id="password" size="40" /><br /><br />
  34. <label for="autologin">Remember Me?: </label><input type="checkbox" name="autologin" id="autologin" /><br /><br />
  35. <input type="submit" value="Log In" name="login" />
  36. <input type="hidden" name="redirect" value="../login.php" />
  37. </form>
  38.  
  39. <a title="Register" href="forum/ucp.php?mode=register">Register</a>
  40.  
  41. ';
  42. }

Report this snippet  

You need to login to post a comment.