Home | Support Forums | Your Account | Gallery [2] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

Standalone phpBB2 integration within PHPNuke - Part II
Goto page 1, 2  Next
 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Issues » Other PHPNuke Issues View previous topicPrinter friendly versionView next topic
Author Message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6271
Location: Washington Township, NJ, USA

PostPosted: Tue May 03, 2005 8:36 pm    Post subject: Standalone phpBB2 integration within PHPNuke - Part II Reply with quote

This is a DRAFT of the FORTH VERSION of the installation guide. Make backup copies of your phpNuke files and your database before starting this process. If it works for you, let us know [nukedgallery.net]. If it doesn't, let us know what went wrong [nukedgallery.net], then revert back to your saved backup for your site until we can work out the bugs.

Version History:
Beta1 (8 April 2004):
Initial Draft

Beta2 (27 April 2004):
Reduced number of phpNuke modifications by using $user_prefix.

Beta3 (3 May 2004):
Introduced ability to redirect to forums upon login/logout.
Added fixes for phpNuke admin control panel related to change in format of $user_regdate field in the database.

Beta4 (9 July 2004):
Updated to phpNuke 7.2.
Split the integration methods into two separate guides.

How to integrate standalone phpBB with phpNuke
Developed and Authored by: Dariush Molavi (dari AT nukedgallery DOT net) and spcdata
Special thanks to spcdata for testing


This is a how-to on integrating standalone phpBB within PHPNuke. Why do this? Simply stated, it makes upgrading and modifying both pieces of software much simpler.

Standard disclaimer: Before you start any of this:
Backup your existing phpnuke database.
Backup your existing phpnuke directory.


For existing PHPNuke / BB2Nuke installations
Portions of this are taken from phpBB.com [phpbb.com]

This is a bit trickier, as most of the required phpBB tables are already created by phpNuke, just with a different name. It is crucial that you back up your database before doing this.
  1. When you install phpNuke for the first time, it creates lots of tables with names in the following format:
    Code: › <prefix>_bbXXXXX


    phpBB uses tables with the format of:
    Code: › <prefix>bb_XXXXX


    These are the tables that store all of your posts, private messages, etc. Below is a list of the tables:
    Code: ›  <prefix>_bbauth_access       
     <prefix>_bbbanlist      
     <prefix>_bbcategories      
     <prefix>_bbconfig      
     <prefix>_bbdisallow      
     <prefix>_bbfavorites      
     <prefix>_bbforum_prune      
     <prefix>_bbforums      
     <prefix>_bbgroups      
     <prefix>_bbposts      
     <prefix>_bbposts_text      
     <prefix>_bbprivmsgs      
     <prefix>_bbprivmsgs_text   
     <prefix>_bbranks      
     <prefix>_bbsearch_results 
     <prefix>_bbsearch_wordlist
     <prefix>_bbsearch_wordmatch
     <prefix>_bbsessions      
     <prefix>_bbsmilies      
     <prefix>_bbthemes      
     <prefix>_bbthemes_name      
     <prefix>_bbtopics      
     <prefix>_bbtopics_watch      
     <prefix>_bbuser_group      
     <prefix>_bbvote_desc      
     <prefix>_bbvote_results      
     <prefix>_bbvote_voters      
     <prefix>_bbwords 


    You may have more or less, depending on your version of PHPNuke (this list is from phpNuke 7.2).

    You want to keep the contents of these tables intact during this conversion.

  2. Install a fresh copy of phpBB, making sure to specify the proper database name, database login, and password (the same as your phpNuke database). Leave the phpBB prefix at it's default value.

  3. Drop the following tables created by the phpBB installation:
    Code: ›  phpbb_auth_access       
     phpbb_banlist      
     phpbb_categories      
     phpbb_config      
     phpbb_disallow      
     phpbb_favorites      
     phpbb_forum_prune      
     phpbb_forums      
     phpbb_groups      
     phpbb_posts      
     phpbb_posts_text      
     phpbb_privmsgs      
     phpbb_privmsgs_text   
     phpbb_ranks      
     phpbb_search_results 
     phpbb_search_wordlist
     phpbb_search_wordmatch
     phpbb_sessions      
     phpbb_smilies      
     phpbb_themes      
     phpbb_themes_name      
     phpbb_topics      
     phpbb_topics_watch      
     phpbb_user_group      
     phpbb_vote_desc      
     phpbb_vote_results      
     phpbb_vote_voters      
     phpbb_words 

  4. Rename the phpNuke database tables that correspond to the above tables to their phpBB counterparts. For example, <prefix>_bbtopics would get renamed to <prefix>bb_topics.

  5. Rename the <prefix>_users table to <prefix>bb_users.

  6. Rename your <prefix>_users_temp table (from phpNuke) to <prefix>bb_users_temp.

  7. Change the $user_prefix in <phpNuke_root>/config.php to look like this:
    $user_prefix = "nukebb";
    (You may have a different portion for the "nuke" part. The important thing here is that you have "bb" on the end of it.)

  8. This step is crucial. You must edit your phpBB config.php file and change the prefix from phpbb_ to <nuke_user_prefix>_.Don't forget to include the underscore character ( _ ) after your phpNuke user prefix.

  9. Do the following in the <prefix>bb_users table

    1. Next, you will need to convert the user_regdate from the phpNuke "pretty-print" format to unixtime. The following php script will perform the conversion for you. (Note that this script will only function if your regdates are in the format "MMM dd, YYYY", for example "Nov 10, 2003") Once you've run this script, change the user_regdate from varchar(20) to int(11).
      PHP: › <?php

      require_once("mainfile.php");
      global 
      $user_prefix,$db;

      $months = array("abc","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

      $result $db->sql_query("SELECT user_id, username, user_regdate FROM ".$user_prefix."_users");

      echo 
      "Fetching information for ".$db->sql_numrows($result)." users...<br><br>";

      while(
      $row $db->sql_fetchrow($result)) {
              
      $date $row['user_regdate'];
              
      $tmp explode(" ",$date);
              
      $day substr($tmp[1],0,2);
              
      $month $tmp[0];
              while(
      $month_name current($months)) {
                      if(
      $month_name == $month) {
                              
      $month key($months);
                      }
                      
      next($months);
              }
              
      reset($months);
              
      $year $tmp[2];
              
      $unixdate mktime(0,0,0,$month,$day,$year);
              echo 
      "Converting regdate for ".$row['username']."...";
              
      $result2 $db->sql_query("UPDATE ".$user_prefix."_users SET user_regdate=".$unixdate." WHERE user_id=".$row['user_id']);
              if(!
      $result2) {
                      echo 
      "<font color=\"#ff0000\"><b>Error!</b></font><br>";
              }
              else {
                      echo 
      "<font color=\"#00ff00\"><b>Success!</b></font><br>";
              }
      }

      ?>

      Simply put this script into a file called "changetime.php" in your phpNuke root directory and view it through your browser for the update to take place.

    2. Change the user_id field from int(11) to mediumint(Cool and remove the autoincrement property.

    3. Change the Anonymous user to have a user_id of -1.

  10. Make the following file modifications in your PHPNuke installation.
    1. The following modifications are done inside Your_Account/index.php:
      PHP: › <?php #
      #-----[ OPEN ]-----------------------------------
      #
      modules/Your_Account/index.php

      #
      #-----[ FIND - THERE ARE 2 INSTANCES OF THIS]----
      #
          
      $sql "SELECT * FROM ".$prefix."_bbconfig";
          
      $result $db->sql_query($sql);

      #
      #-----[ REPLACE BOTH INSTANCES WITH ]------------
      #
          
      $sql "SELECT * FROM ".$prefix."bb_config";
          
      $result $db->sql_query($sql);

      #
      #-----[ FIND ]-----------------------------------
      #
          
      $user_regdate date("M d, Y");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $user_regdate time();


      #
      #-----[ FIND ]-----------------------------------
      #
          
      $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', '$user_regdate', '$check_num', '$time')");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', $user_regdate, '$check_num', '$time')");

      #
      #-----[ FIND ]-----------------------------------
      #
           
      $db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time < $past");
           
      $sql "SELECT * FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'";
           
      $result $db->sql_query($sql);

      #
      #-----[ AFTER, ADD ]-----------------------------------
      #
          
      $uid_result $db->sql_query("SELECT MAX(user_id) AS total FROM ".$user_prefix."_users");
          
      $uid_row $db->sql_fetchrow($uid_result);
          
      $user_id $uid_row['total'] + 1;

      #
      #-----[ FIND ]-----------------------------------
      #
              
      $db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '$row[user_regdate]', '$language')");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
              
      $sql2 "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES ('$user_id', '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', $row[user_regdate], '$language')";
              
      $db->sql_query($sql2);
       
      #
      #-----[ FIND ]-----------------------------------
      #
          
      $db->sql_query("DELETE FROM ".$prefix."_bbsessions WHERE session_user_id='$r_uid'");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $db->sql_query("DELETE FROM ".$prefix."bb_sessions WHERE session_user_id='$r_uid'");


      #
      #-----[ FIND ]-----------------------------------
      #
              
      if ($pm_login != "") {
                  
      Header("Location: modules.php?name=Private_Messages&file=index&folder=inbox");
                  exit;
              }
              if (
      $redirect == "" ) {
                  
      Header("Location: modules.php?name=Your_Account&amp;op=userinfo&amp;bypass=1&amp;username=$username");
              } else if (
      $mode == "") {
                  
      Header("Location: forums.html&amp;file=$forward");
              } else if (
      $t !="")  {
                  
      Header("Location: forums.html&amp;file=$forward&amp;mode=$mode&amp;t=$t");
              } else {
                  
      Header("Location: forums.html&amp;file=$forward&amp;mode=$mode&amp;f=$f");
              }

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
              
      if ($redirect == "" ) {
                  
      Header("Location: modules.php?name=Your_Account&op=userinfo&bypass=1&username=$username");
              } 
              else if (
      $redirect == "phpBB") {
                  
      Header("Location: /phpBB2/");
              }
              else if (
      $mode == "") {
                  
      Header("Location: /phpBB2/$forward");
              } else if (
      $t !="")  {
                  
      Header("Location: /phpBB2/$forward&amp;mode=$mode&amp;t=$t");
              } else {
                  
      Header("Location: /phpBB2/$forward&amp;mode=$mode&amp;f=$f");
              }

      #
      #-----[ FIND ]-----------------------------------
      #
          
      if ($redirect != "") {
              echo 
      "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
          } else {
              echo 
      "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=/index.php\">";
          }

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      if($redirect == "phpBB") {
                      echo 
      "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=/phpBB2/\">";
          }
          else {
                  if (
      $redirect != "") {
                      echo 
      "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
                  } else {
                      echo 
      "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=/index.php\">";
                  }
          }

      #
      #-----[ SAVE & CLOSE ]-----------------------------------
      #
      /modules/Your_Account/index.php ?>


    2. The following file modifications are done in admin.php:
      PHP: › <?php #
      #-----[ OPEN ]-----------------------------------
      #
      admin.php

      #
      #-----[ FIND ]-----------------------------------
      #
      $user_regdate date("M d, Y");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
      $user_regdate time();

      #
      #-----[ FIND ]-----------------------------------
      #
      $sql "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
      $sql "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";

      #
      #-----[ FIND ]-----------------------------------
      #
                  
      $db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit', '2', 'english','D M d, Y g:i a')");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
                 
      $sql "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";
                 
      $db->sql_query($sql);

      #
      #-----[ FIND ]-----------------------------------
      #
          
      $curDate2 "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $curDate2 $month[0].$month[1].$month[2]." ".$mday." ".$year;

      #
      #-----[ FIND ]-----------------------------------
      #
          
      $curDateP "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $curDateP $premonth[0].$premonth[1].$premonth[2]." ".$preday." ".$preyear;


      #
      #-----[ FIND ]-----------------------------------
      #
          
      $row3 $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount from $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'"));
          
      $userCount $row3['userCount'];
          
      $row4 $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'"));
          
      $userCount2 $row4['userCount'];

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $sql "SELECT COUNT(user_id) AS userCount from $user_prefix"._users." WHERE FROM_UNIXTIME(user_regdate,'%b %e %Y') LIKE '$curDate2'";
          
      $result $db->sql_query($sql);
          
      $row3 $db->sql_fetchrow($result);
          
      $userCount $row[userCount];
          
      $sql "SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE FROM_UNIXTIME(user_regdate,'%b %e %Y') LIKE '$curDateP'";
          
      $result $db->sql_query($sql);
          
      $row4 $db->sql_fetchrow($result);
          
      $userCount2 $row[userCount];

      #
      #-----[ SAVE & CLOSE ]-----------------------------------
      #
      /admin.php ?>

    3. The following modifications are made in admin/modules/users.php:
      PHP: › <?php #
      #-----[ FIND ]-----------------------------------
      #
          
      $user_regdate date("M d, Y");

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $user_regdate time();

      #
      #-----[ FIND ]-----------------------------------
      #
          
      $sql .= "values (NULL, '$add_name', '$add_uname', '$add_email', '$add_femail', '$add_url', '$user_regdate', '$add_user_icq', '$add_user_aim', '$add_user_yim', '$add_user_msnm', '$add_user_from', '$add_user_occ', '$add_user_intrest', '$add_user_viewemail', '$add_avatar', '$add_user_sig', '$add_pass', '$add_newsletter', '1', '0')";

      #
      #-----[ REPLACE WITH ]-----------------------------------
      #
          
      $sql .= "values (NULL, '$add_name', '$add_uname', '$add_email', '$add_femail', '$add_url', $user_regdate, '$add_user_icq', '$add_user_aim', '$add_user_yim', '$add_user_msnm', '$add_user_from', '$add_user_occ', '$add_user_intrest', '$add_user_viewemail', '$add_avatar', '$add_user_sig', '$add_pass', '$add_newsletter', '1', '0')";

      #
      #-----[ SAVE & CLOSE ]-----------------------------------
      #
      /admin/modules/users.php ?>


  11. That is all the file mods that need to be made for stock phpNuke files.

  12. Now comes the fun part, modifying the phpBB files to work with PHPNuke. Luckily, most of the modifications are minor. These are the only modifications you will have to repeat when/if you upgrade your phpBB installation. If you are using the stock subSilver template in your forum, it is important that you do NOT overwrite your templates directory during an upgrade of phpBB. This may look like a lot of modifications, but most are only one or two lines. With a heavily modified installation, such as the one here at NukedGallery.net, the additional time required to perform these alterations is trivial compared to the time required to re-implement all of the other modifications already in place.
    PHP: › <?php #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/admin/pagestart.php

    #
    #-----[ FIND ]-----------------------------------
    #
     
    include($phpbb_root_path 'common.'.$phpEx);
     
    #
    #-----[ AFTER, ADD ]-----------------------------------
    #
    global $nukeuser;

    #
    #-----[ FIND ]-----------------------------------
    #
    $userdata session_pagestart($user_ipPAGE_INDEX);

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    $userdata session_pagestart($user_ipPAGE_INDEX,$nukeuser);

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/admin/page_header_admin.php

    #
    #-----[ FIND ]-----------------------------------
    #
    'S_LOGIN_ACTION' => append_sid('../login.'.$phpEx),

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    'S_LOGIN_ACTION' => append_sid('/modules.'.$phpEx.'?name=Your_Account'),

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/common.php

    #
    #-----[ FIND ]-----------------------------------
    #
     
    {
         die(
    "Hacking attempt");
     }

    #
    #-----[ AFTER, ADD ]-----------------------------------
    #
    $user $_COOKIE['user'];
    $nukeuser base64_decode($user);
     
    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/faq.php

    #
    #-----[ FIND ]-----------------------------------
    #
    $userdata session_pagestart($user_ipPAGE_FAQ);

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    $userdata session_pagestart($user_ipPAGE_FAQ,$nukeuser);

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/groupcp.php

    #
    #-----[ FIND ]-----------------------------------
    #
    $userdata session_pagestart($user_ipPAGE_GROUPCP);

    #
    #-----[    REPLACE WITH ]-----------------------------------
    #
    $userdata session_pagestart($user_ipPAGE_GROUPCP,$nukeuser);

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/includes/constants.php

    #
    #-----[ FIND ]-----------------------------------
    #
    define('DELETED', -1);
    define('ANONYMOUS', -1);
                                                                                    
    define('USER'0);
    define('ADMIN'1);
    define('MOD'2);

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    define('DELETED', -1);
    define('ANONYMOUS', -1);
      
    define('USER'1);
    define('ADMIN'2);
    define('MOD'3);

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/includes/functions.php

    #
    #-----[ FIND ]-----------------------------------
    #
        
    global $db$template$board_config$theme$lang$phpEx$phpbb_root_path$nav_links$gen_simple_header$images;

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
        
    global $db$template$board_config$theme$lang$phpEx$phpbb_root_path$nav_links$gen_simple_header$images,$user;

    #
    #-----[ FIND ]-----------------------------------
    #
            
    $userdata session_pagestart($user_ipPAGE_INDEX);

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
            
    $userdata session_pagestart($user_ipPAGE_INDEX$nukeuser);

    #
    #-----[ FIND ]-----------------------------------
    #
            // Behave as per HTTP/1.1 spec for others
            
    header('Location: ' $server_protocol $server_name $server_port $script_name $url);
        exit;
     }
     
    #
    #-----[ AFTER, ADD ]-----------------------------------
    #
    function bblogin($nukeuser$session_id) {
            global 
    $nukeuser$userdata$user_ip$session_length$session_id$db$nuke_file_path;
            
    define("IN_LOGIN"true);
            
    $cookie explode(":"$nukeuser);
            
    $nuid $cookie[0];
            
    $sql "SELECT s.*
                    FROM " 
    SESSIONS_TABLE " s
                    WHERE s.session_id = '$session_id'
                    AND s.session_ip = '$user_ip'"
    ;
            if ( !(
    $result $db->sql_query($sql)) )
            {
                    
    message_die(CRITICAL_ERROR'Error doing DB query userdata row fetch : session_pagestar');
            }
            
    $logindata $db->sql_fetchrow($result);

            if( 
    $nuid != $logindata['session_user_id'] ) {
                
    $nusername $cookie[1];
                
    $sql "SELECT user_id, username, user_password, user_active, user_level
                        FROM "
    .USERS_TABLE."
                        WHERE username = '" 
    str_replace("\'""''"$nusername) . "'";
                
    $result $db->sql_query($sql);
                if(!
    $result) {
                    
    message_die(GENERAL_ERROR"Error in obtaining userdata : login"""__LINE____FILE__$sql);
                }
                
    $rowresult $db->sql_fetchrow($result);
                
    $password $cookie[2];
                if(
    count($rowresult) ) {
                    if( 
    $rowresult['user_level'] != ADMIN && $board_config['board_disable'] ) {
                        
    header("Location: " append_sid("/phpBB2/index.php"true));
                    } else {
                        if( 
    $password == $rowresult['user_password'] && $rowresult['user_active'] ) {
                            
    $autologin 0;
                            
    $userdata session_begin($rowresult['user_id'], $user_ipPAGE_INDEX$session_lengthFALSE$autologin);
                            
    $session_id $userdata['session_id'];
                            if(!
    $session_id ) {
                                
    message_die(CRITICAL_ERROR"Couldn't start session : login"""__LINE____FILE__);

                            } else {
                            }
                        } else {
                            
    $message $lang['Error_login'] . "<br /><br />" sprintf($lang['Click_return_login'], "<a href=\"" append_sid("/phpBB2/login.php&amp;$redirect") . "\">""</a> ") . "<br /><br />" .  sprintf($lang['Click_return_index'], "<a href=\"" append_sid("/phpBB2/index.php") . "\">""</a> ");
                            
    message_die(GENERAL_MESSAGE$message);
                        }
                    }
                } else {
                    
    $message $lang['Error_login'] . "<br /><br />" sprintf($lang['Click_return_login'], "<a href=\"" append_sid("/phpBB2/login.php&amp;$redirect") . "\">""</a> ") . "<br /><br />" .  sprintf($lang['Click_return_index'], "<a href=\"" append_sid("/phpBB2/index.php") . "\">""</a> ");
                    
    message_die(GENERAL_MESSAGE$message);
                }
            }

    }

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/includes/functions_post.php

    #
    #-----[ FIND ]-----------------------------------
    #
            
    $userdata session_pagestart($user_ip$page_id);
    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
            
    $userdata session_pagestart($user_ip$page_id,$nukeuser);

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/includes/page_header.php

    #
    #-----[ FIND ]-----------------------------------
    #
    'S_LOGIN_ACTION' => append_sid('login.'.$phpEx),

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    'S_LOGIN_ACTION' => append_sid('/modules.'.$phpEx.'?name=Your_Account'),

    #
    #-----[ FIND ]-----------------------------------
    #
    //
    // Generate logged in/logged out status
    //
    if ( $userdata['session_logged_in'] )
    {
        
    $u_login_logout 'login.'.$phpEx.'?logout=true&amp;sid=' $userdata['session_id'];
        
    $l_login_logout $lang['Logout'] . ' [ ' $userdata['username'] . ' ]';
    }
    else
    {
        
    $u_login_logout 'login.'.$phpEx;
        
    $l_login_logout $lang['Login'];
    }

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    //
    // Generate logged in/logged out status
    //
    if ( $userdata['session_logged_in'] )
    {
            
    $u_login_logout '/modules.php?name=Your_Account&op=logout&redirect=phpBB';
            
    $l_login_logout $lang['Logout'];
            
    $l_user "Hello, ".$userdata['username']."! "
    }
    else
    {
            
    $u_login_logout 'login.'.$phpEx.'?redirect=phpBB';
            
    $l_login_logout $lang['Login'];
            
    $l_user "<a class=\"phpnuke\" href=\"/modules.php?name=Your_Account&amp;op=new_user\">Create</a> an account";
    }

    #
    #-----[ FIND ]-----------------------------------
    #
        
    'L_USERNAME' => $lang['Username'],
         
    'L_PASSWORD' => $lang['Password'],
         
    'L_LOGIN_LOGOUT' => $l_login_logout,

    #
    #-----[ AFTER, ADD ]-----------------------------------
    #
        
    'L_USER' => $l_user,

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/includes/page_tail.php

    #
    #-----[ FIND ]-----------------------------------
    #
     //
     // Show the overall footer.
     //

    #
    #-----[ AFTER, ADD ]-----------------------------------
    #
    global $nukeuser;

    #
    #-----[ OPEN ]-----------------------------------
    #
    phpBB2/includes/sessions.php

    #
    #-----[ FIND ]-----------------------------------
    #
        
    $SID 'sid=' $session_id;

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
        
    $SID = ( $sessionmethod == SESSION_METHOD_GET ) ? 'sid=' $session_id '';
     
    #
    #-----[ FIND ]-----------------------------------
    #
    function session_pagestart($user_ip$thispage_id)

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
    function session_pagestart($user_ip$thispage_id,$nukeuser)

    #
    #-----[ FIND ]-----------------------------------
    #
        
    global $db$lang$board_config;

    #
    #-----[ REPLACE WITH ]-----------------------------------
    #
        
    global $db$lang$board_config,$session_id;

    #
    #-----[ FIND ]-----------------------------------
    #
            
    $session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';