Fork me on GitHub

RaidNinja  Bottom

  • Hi, i run my guilds website for WoW and i ran across this great program here:

    http://forums.eqdkp.com/index.php?showtopic=1447

    In the aformentioned thread much discussion was given over how to plug this into EQDKP but what i was looking for was a way to plug it into PostNuke using the PostNuke login system. One user was able to modify it for Phpbb2 but after about 6 hours of consultation with the Author on AIM we werent able to hook it into the PNphpbb2 login system using cookies.

    I was hoping i could gather some insight from the great folks here and some coding help to integrate the login system for this program.

    We started out using this code:

    Code

    <?php
    //I use the sessionmanager of phpbb2 to read out the cookie, you have to adjust the root_path to your phpbb2-board      
           define('IN_PHPBB', true);
           $phpbb_root_path = '../phpBB2/';
           include($phpbb_root_path . 'extension.inc');
           include($phpbb_root_path . 'common.'.$phpEx);
           $userdata = session_pagestart($user_ip, PAGE_INDEX);


           session_start();
           $valid_user = 0;

          &nbsp;@ $db = mysql_connect('yourhost', 'user', 'pw');
           if (!$db)
           {
           echo '<p>Error: Could not connect to database. Please try again later.</p>';
           exit;
           }

    //I added the required tables for raidninja into database of my phpbb2-board
           mysql_select_db('phpbb2database');


    //i named my cookie in the preferences of phpbb2-config "phpbb2mysql", phpbb2 adds the suffix _data to it, so you have to name it "phpbb2mysql_data"
           if (isset($_COOKIE['phpbb2mysql_data']))
           {
    //now you can use the userdata of phpbb2 to get userid and password of the cookie
                           $member_id = $userdata['user_id'];      
                           $pass_hash = $userdata['user_password'];
    //maybe you have to adjust the names of "phpbb_users" and the "user_id"
                           $sql_pm = mysql_query("SELECT * FROM `phpbb_users` WHERE user_id = ".$member_id) or die('cannot get      
    members'
    );


    Which gave us this error:

    Code

    Fatal error: Call to undefined function: pndbgetconn() in /home/public_html/portal/modules/PNphpBB2/common.php on line 187


    Here is the offending code:

    Code

    // Begin PNphpBB2 Module (PN750)
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    // End PNphpBB2 Module (PN750)

    // Can we find the users table?
    $test = $dbconn->Execute("SELECT user_id FROM " . $table_prefix . "users LIMIT 1");
    if ($test) {
      define('PHPBB_INSTALLED', true);
     $test->Close();
    }
    // End PNphpBB2 Module



    So after tweaking with that for a bit and with no luck we decided to try another angle using this bit of code:

    Code

    // Code to validate log-in
       // You might want to use sessions depending on your forum's set-up.  I've included cookies here.
    // Validate log-in from cookies
    if (isset($_COOKIE['pnphpbb2mysql_data']))
    {
      // Get the user's ID and password, then check to see that they match
      // $valid_user is set to 1 if the user is a valid administrator
      // $member_id and $pass_hash will need to be changed to the location of your cookie's id and password
      $cookiearray = unserialize(urldecode($_COOKIE['pnphpbb2mysql_data']));
      $member_id = $cookiearray['userid'];
      //$pass_hash = $_COOKIE['pass_hash'];
      $sql_pm = mysql_query("SELECT * FROM `nuke_phpbb_users` WHERE user_id = ".$member_id) or die('cannot get members');
      $pm = mysql_fetch_array($sql_pm);
      // Put the ID #s here for allowed admins
      if ($member_id == '2')
      {
       $valid_user = 1;
      }
      else
      {
       // If not an admin, redirect to front page of your site
       header("Location: http://www.aegisorder.com/"); /* Redirect browser */
       // In case re-direct doesn't work, display message
       echo 'You aren\'t an admin.';
       exit;
      }
    }
    // If no session and no cookie, send to your log-in screen
    else
    {
     // Redirect browser
     header("Location: http://www.aegisorder.com/forums/index.php?act=Login&amp;CODE=00");
     // If re-direct doesn't work
     echo 'Please <a href="http://www.aegisorder.com/forums/index.php?act=Login&amp;CODE=00">log-in.</a><br />';
     exit;
    }


    Everytime i got a cannot get member error. It seems the code is reading the cookie properly but yet its not extrapolating ANY data from it, ie the Userid. It had me scratching my head.

    The author had this to say:

    Quote

    I got the phpbb logins working last night on a fresh post nuke + pnphpbb install. I'd never used postnuke but the problems a user and I were having convinced me to install it on my machine, and BAM my code worked right off the bat.

    Here's the login code for rnadmin.php for pnphpbb (just check what you've configured your cookie name to be and what your actual user ID is. In most installations it will be 2 if you are the first admin):


    I disabled AutoTheme and went back to a default theme with no luck there either. If anyone can provide any insight i would be most grateful.

    I also posted a thread a pnphpbb.com but havent yet gotten a reply.

    Thank you.
  • You probably should tie in any module or script added to postnuke to the postnuke user system directly and not to any modules(ie PNphpBB2, ect) connection to that system.
  • Using the above cookie method what would you suggest for Postnuke?
  • If theres anyway someone could dig grave up it would be great..

    Theres a new version of RaidNinja out now (v2.0 r4) but theres no Postnuke module or login script for it yet.

    I can make a donation to someone if they are willing to work with the new version of RaidNinja so it works with the newer versions of Postnuke.

    www.raidninja.com

    I asked the developer, but he appears to be months away from adding this to the project.

    Thanks

This list is based on users active over the last 60 minutes.