PHPBB3 Website Intergrating systems.

Need some coding help with a MOD or tweak you are working on? - Ask here.
Forum rules
Ask for support specifically regarding coding help with phpBB3.
Not for generic usability questions or support.

PHPBB3 Website Intergrating systems.

Postby Robbie Garrett » 28 Aug 2008, 09:58

Hello,

I did post in the wrong place and have asked for it to be deleted so can i get help here for this?

I am currently trying to implement PHPBB3 into my website and having a few problems.
I have set up a quick example, nothing to special just a test page for me to get things going aye :P

http://www.letstakeoff.com/testphp/


Ok when you click content it directs you to the content.htm page, but if the user is unregistered i want them to go too http://www.letstakeoff.com/testphp/login.htm so once they login it directs them back too content.htm and they can see it.

I fully understand that for this to work ill have to save it as .php and ill do that once i know the corrects codes for this to work and be implemented into the website.

Also any chance of were it says login once logged in it says Log Out Robbie Garrett. E.G

Also if all the stuff like register and stuff is on the HTML template and not the Forums so it looks like it's not using the forum to give you access. Ill have a forum but it'll be on a different URL and connected to the MYSQL Database for the website mainframe forum.


So were it says content i don't want anyone viewing until they login, once logged in it takes them directly back to that page. And i want to do that on various different sections of the site. So not just redirect to any random page.

A very good example of what i am attempting is here http://www.simfly.eu

Also and chance of a session being ran outside the forum directory and anywere within the sites different directories.

Regards,

Robbie
Robbie Garrett
Cadet I
Cadet I
 
Posts: 15
Joined: 28 Aug 2008, 05:44
Gender: Male
phpBB Knowledge: 4




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: PHPBB3 Website Intergrating systems.

Postby topdown » 28 Aug 2008, 11:15

This is all do able but the important part is that the pages are PHP and start with this code

Spoiler:
Code: Select all
<?php
/**
*@package phpBB3 Web
* @version $Id: index.php whatever$
* @copyright (c) 2007-08 something.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');


I would suggest using phpBB3's log in form
Spoiler:
Code: Select all
<!-- IF not S_USER_LOGGED_IN -->

      <form action="{S_LOGIN_ACTION}" method="post">

      <div class="panel">
         <div class="inner"><span class="corners-top"><span></span></span>

         <div class="content">
            <h3><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a><!-- IF S_REGISTER_ENABLED -->&nbsp; &bull; &nbsp;<a href="{U_REGISTER}">{L_REGISTER}</a><!-- ENDIF --></h3>
      
            <fieldset class="fields1">
            <dl>
               <dt><label for="username">{L_USERNAME}:</label></dt>
               <dd><input type="text" tabindex="1" name="username" id="username" size="25" value="{USERNAME}" class="inputbox autowidth" /></dd>
            </dl>
            <dl>
               <dt><label for="password">{L_PASSWORD}:</label></dt>
               <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" /></dd>
               <!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="3" /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
               <dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="4" /> {L_HIDE_ME}</label></dd>
            </dl>
            <dl>
               <dt>&nbsp;</dt>
               <dd><input type="submit" name="login" tabindex="5" value="{L_LOGIN}" class="button1" /></dd>
            </dl>
            </fieldset>
         </div>

         <span class="corners-bottom"><span></span></span></div>
      </div>
<!-- ENDIF -->
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3026
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: PHPBB3 Website Intergrating systems.

Postby Robbie Garrett » 28 Aug 2008, 14:43

Hi thanks for the help.

Ran into some problems.

Currently testing stuff out to block certain pages and then they are accessible once logged in.

http://letstakeoff.com/testphp/robbie.php

Parse error: syntax error, unexpected $end in /home/letstake/public_html/testphp/robbie.php on line 81

Code: Select all
<?php
/**
*@package phpBB3 Web
* @version $Id: index.php whatever$
* @copyright (c) 2007-08 something.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './phptestcode/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');
//
// End session management
//

if($userdata['session_logged_in'])
{
echo('Hi '.$userdata['username'].'! <a href="' . append_sid($phpbb_root_path . 'login.php?logout=true&redirect=..%2F') . '">Logout</a>');
}
else
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Example sessions page</title>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#apDiv1 {
   position:absolute;
   width:43px;
   height:18px;
   z-index:1;
   left: 549px;
   top: 14px;
}
#apDiv2 {
   position:absolute;
   width:424px;
   height:115px;
   z-index:2;
   left: 113px;
   top: 119px;
}
.style1 {
   font-family: Aeroportal;
   font-size: 12px;
}
-->
</style>
</head>

<body>
<a href="http://www.letstakeoff.com/testphp/index.htm">Home</a> <a href="http://www.letstakeoff.com/testphp/content.htm">Content</a> <a href="http://www.letstakeoff.com/testphp/login.htm">Forum</a>
<div id="apDiv1"><a href="http://www.letstakeoff.com/testphp/login.htm">Log In</a></div>
<div class="style1" id="apDiv2">
  <p>Content Test, Hello this must be blocked here so an unregistered user cannot view. Once logged in they can view this writing. So somehow once logged in they can view my content on this page and noway around it unless logged in.</p>
  <p>&nbsp;</p>
</div>
</body>

</html>


http://letstakeoff.com/testphp/robbie.php
Robbie Garrett
Cadet I
Cadet I
 
Posts: 15
Joined: 28 Aug 2008, 05:44
Gender: Male
phpBB Knowledge: 4

Re: PHPBB3 Website Intergrating systems.

Postby topdown » 28 Aug 2008, 15:20

Because you have an open else statement

}
else
{
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3026
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: PHPBB3 Website Intergrating systems.

Postby Robbie Garrett » 28 Aug 2008, 15:39

Do i get rid of that?
echo('Hi '.$userdata['username'].'! <a href="' . append_sid($phpbb_root_path . 'login.php?logout=true&redirect=..%2F') . '">Logout</a>');
}
else
{
?>

I got this from some PHPBB forum but cannot retreive the history file :(

Ooops

Regards,

Robbie
Robbie Garrett
Cadet I
Cadet I
 
Posts: 15
Joined: 28 Aug 2008, 05:44
Gender: Male
phpBB Knowledge: 4

Re: PHPBB3 Website Intergrating systems.

Postby topdown » 28 Aug 2008, 18:15

Well typically it would be something like this (just an example)

Code: Select all
if (!$user->data['is_registered'])
{
    if ($user->data['is_bot'])
    {
        // the user is a bot, send them to where ever
        redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
    }
    // the user is not logged in, give them a chance to login here...
    login_box('', 'LOGIN');
}
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3026
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: PHPBB3 Website Intergrating systems.

Postby Robbie Garrett » 30 Aug 2008, 16:51

Sorry for the late reply back.

Just to get the php code session working...

http://letstakeoff.com/testphp/usertest.php

Warning: include(./phptestcode/common.php) [function.include]: failed to open stream: No such file or directory in /home/letstake/public_html/testphp/usertest.php on line 5

Warning: include(./phptestcode/common.php) [function.include]: failed to open stream: No such file or directory in /home/letstake/public_html/testphp/usertest.php on line 5
Warning: include() [function.include]: Failed opening './phptestcode/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/letstake/public_html/testphp/usertest.php on line 5

Warning: include(./phptestcode/includes/functions_display.php) [function.include]: failed to open stream: No such file or directory in /home/letstake/public_html/testphp/usertest.php on line 6

Warning: include(./phptestcode/includes/functions_display.php) [function.include]: failed to open stream: No such file or directory in /home/letstake/public_html/testphp/usertest.php on line 6

Warning: include() [function.include]: Failed opening './phptestcode/includes/functions_display.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/letstake/public_html/testphp/usertest.php on line 6

Fatal error: Call to a member function session_begin() on a non-object in /home/letstake/public_html/testphp/usertest.php on line 9


File is in testphp
Forum is in phptestcode as i don't want everything to be /forum/ and something like /flighttracker/

Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './phptestcode/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');
?>
Robbie Garrett
Cadet I
Cadet I
 
Posts: 15
Joined: 28 Aug 2008, 05:44
Gender: Male
phpBB Knowledge: 4

Re: PHPBB3 Website Intergrating systems.

Postby topdown » 30 Aug 2008, 17:04

The path is not correct,
you are working with 2 different directories
root/testphp/
root/phptestcode/

So if you are running a script in testphp and you want to justify the forum root you have to go back out of that directory ../
../ = back one directory
../../ = back 2
etc......

Try this

Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../phptestcode/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');
?>
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3026
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: PHPBB3 Website Intergrating systems.

Postby Robbie Garrett » 30 Aug 2008, 17:44

top down.

http://www.letstakeoff.com/testphp/usertest.php

I believe that works perfectly.

Just a question. On the PHPBB forums were it says: Login and then Register or something like that if not registered or logged in.. How can i make it like that so when logged in it changes too Welcome... Robbie Garrett (log out)

Or similar.

Thanks very much,

Regards,

Robbie
Robbie Garrett
Cadet I
Cadet I
 
Posts: 15
Joined: 28 Aug 2008, 05:44
Gender: Male
phpBB Knowledge: 4

Re: PHPBB3 Website Intergrating systems.

Postby topdown » 31 Aug 2008, 00:49

That still needs to be finished out, as it's not complete

Spoiler:
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../phptestcode/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');

// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
   'body' => 'test_body.html')
);

page_footer();

?>


Then put your HTML template in the forum templates, in this case it would be named test_body.html

For the Logged in thing,
Open the language/ en/ common.php

Find
Code: Select all
'LOGOUT_USER'                  => 'Logout [ %s ]',


Change to
Code: Select all
'LOGOUT_USER'                  => 'Welcome back [ %s ]',
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3026
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Next

Return to phpBB3 Coding Assistance

Who is online

Users browsing this forum: JikeSpider, MSNbot Media and 10 guests