Full Site Integration

Discussion forum for MOD Writers regarding MOD Development.
Locked
AJN24
Registered User
Posts: 58
Joined: Fri Jun 27, 2008 1:39 am

Re: Full Site Integration

Post by AJN24 »

poizone wrote:../../forums

that should do it.

Still getting these errors after editing my code with what you provided:

Warning: include(../../forumscommon.php) [function.include]: failed to open stream: No such file or directory in /home/xthrsixz/public_html/php/login/register.php on line 7

Warning: include() [function.include]: Failed opening '../../forumscommon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xthrsixz/public_html/php/login/register.php on line 7

Warning: include(../../forumsincludes/functions_user.php) [function.include]: failed to open stream: No such file or directory in /home/xthrsixz/public_html/php/login/register.php on line 8

Warning: include() [function.include]: Failed opening '../../forumsincludes/functions_user.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xthrsixz/public_html/php/login/register.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at /home/xthrsixz/public_html/php/login/register.php:7) in /home/xthrsixz/public_html/php/login/includes/header.php on line 36
`Mistermage`
Registered User
Posts: 9
Joined: Thu Jul 03, 2008 1:03 am
Location: New Hampshire, USA
Contact:

Re: Full Site Integration

Post by `Mistermage` »

Mmmk after much reading of this topic I am still very confused as to why the code isn't working:

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup(); 
?>
	
<?php
        if($user->data['is_registered'])
        {
            echo 'Welcome back, ' . $user->data['username'] . '<br /><br />';
            echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx") . '">' . $user->lang['PROFILE'] . '</a><br />';
            
            $l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['NEW_PM'] : $user->lang['NEW_PMS'];
            $l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
            echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '">' . $l_privmsgs_text . '</a><br />';
            echo '<a href="' . append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts') . '">' . $user->lang['SEARCH_NEW'] . '</a>';
        }
        else
        {
            $path = pathinfo($_SERVER['SCRIPT_FILENAME']);
            echo 'Welcome guest<br /><br />
                <form method="POST" action="' . $phpbb_root_path . 'ucp.php?mode=login">
                Username: <input type="text" name="username" size="20"><br />
                Password: <input type="password" name="password" size="20"><br />
                Remember Me?: <input type="checkbox" name="autologin"><br />
                <input type="submit" value="Login" name="login">
                <input type="hidden" name="redirect" value="./../' . $path['basename'] . '">
                </form>
                <br />';
           echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register') . '">' . $user->lang['REGISTER'] . '</a>';
        }
?>
Now you should probably know that I am very new to the whole php scene but I am a quick learner, now this code ^, it works if i am already logged in but when i am logged out, before i had the "Cannot modify header information" error, but I fixed that up but now.. instead of showing the form to login, all it does is show the forum, without images in a header thats there. Any help is much appreciated :)
User avatar
poizone
Registered User
Posts: 62
Joined: Sun Jan 13, 2008 6:01 pm

Re: Full Site Integration

Post by poizone »

AJN24 wrote:
poizone wrote:../../forums

that should do it.

Still getting these errors after editing my code with what you provided:

Warning: include(../../forumscommon.php) [function.include]: failed to open stream: No such file or directory in /home/xthrsixz/public_html/php/login/register.php on line 7

Warning: include() [function.include]: Failed opening '../../forumscommon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xthrsixz/public_html/php/login/register.php on line 7

Warning: include(../../forumsincludes/functions_user.php) [function.include]: failed to open stream: No such file or directory in /home/xthrsixz/public_html/php/login/register.php on line 8

Warning: include() [function.include]: Failed opening '../../forumsincludes/functions_user.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xthrsixz/public_html/php/login/register.php on line 8

Warning: Cannot modify header information - headers already sent by (output started at /home/xthrsixz/public_html/php/login/register.php:7) in /home/xthrsixz/public_html/php/login/includes/header.php on line 36
Sorry, should be

Code: Select all

../../forums/
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10410
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

`Mistermage` wrote:Mmmk after much reading of this topic I am still very confused as to why the code isn't working:

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup(); 
?>
	
<?php
        if($user->data['is_registered'])
        {
            echo 'Welcome back, ' . $user->data['username'] . '<br /><br />';
            echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx") . '">' . $user->lang['PROFILE'] . '</a><br />';
            
            $l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['NEW_PM'] : $user->lang['NEW_PMS'];
            $l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
            echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '">' . $l_privmsgs_text . '</a><br />';
            echo '<a href="' . append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts') . '">' . $user->lang['SEARCH_NEW'] . '</a>';
        }
        else
        {
            $path = pathinfo($_SERVER['SCRIPT_FILENAME']);
            echo 'Welcome guest<br /><br />
                <form method="POST" action="' . $phpbb_root_path . 'ucp.php?mode=login">
                Username: <input type="text" name="username" size="20"><br />
                Password: <input type="password" name="password" size="20"><br />
                Remember Me?: <input type="checkbox" name="autologin"><br />
                <input type="submit" value="Login" name="login">
                <input type="hidden" name="redirect" value="./../' . $path['basename'] . '">
                </form>
                <br />';
           echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register') . '">' . $user->lang['REGISTER'] . '</a>';
        }
?>
Now you should probably know that I am very new to the whole php scene but I am a quick learner, now this code ^, it works if i am already logged in but when i am logged out, before i had the "Cannot modify header information" error, but I fixed that up but now.. instead of showing the form to login, all it does is show the forum, without images in a header thats there. Any help is much appreciated :)
I copy/pasted your code and it seems to work fine for me: http://theexiled.pwnageservers.com/form.php


@poizone: I'm not sure if you saw it since it's on the previous page, but I posted some code for you.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
User avatar
poizone
Registered User
Posts: 62
Joined: Sun Jan 13, 2008 6:01 pm

Re: Full Site Integration

Post by poizone »

I'm still having an issue. The code works, but no text shows up. I'm given no errors, and nothing else is misbehaving. It's only on the post's text though.
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10410
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

That's odd, because it seems to work fine on mine with that exact code: http://theexiled.pwnageservers.com/late ... _posts.php
Everything parses, the youtube videos, images, links, etc...
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
`Mistermage`
Registered User
Posts: 9
Joined: Thu Jul 03, 2008 1:03 am
Location: New Hampshire, USA
Contact:

Re: Full Site Integration

Post by `Mistermage` »

Noxwizard wrote:
`Mistermage` wrote:Mmmk after much reading of this topic I am still very confused as to why the code isn't working:

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup(); 
?>
	
<?php
        if($user->data['is_registered'])
        {
            echo 'Welcome back, ' . $user->data['username'] . '<br /><br />';
            echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx") . '">' . $user->lang['PROFILE'] . '</a><br />';
            
            $l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['NEW_PM'] : $user->lang['NEW_PMS'];
            $l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
            echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '">' . $l_privmsgs_text . '</a><br />';
            echo '<a href="' . append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts') . '">' . $user->lang['SEARCH_NEW'] . '</a>';
        }
        else
        {
            $path = pathinfo($_SERVER['SCRIPT_FILENAME']);
            echo 'Welcome guest<br /><br />
                <form method="POST" action="' . $phpbb_root_path . 'ucp.php?mode=login">
                Username: <input type="text" name="username" size="20"><br />
                Password: <input type="password" name="password" size="20"><br />
                Remember Me?: <input type="checkbox" name="autologin"><br />
                <input type="submit" value="Login" name="login">
                <input type="hidden" name="redirect" value="./../' . $path['basename'] . '">
                </form>
                <br />';
           echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register') . '">' . $user->lang['REGISTER'] . '</a>';
        }
?>
Now you should probably know that I am very new to the whole php scene but I am a quick learner, now this code ^, it works if i am already logged in but when i am logged out, before i had the "Cannot modify header information" error, but I fixed that up but now.. instead of showing the form to login, all it does is show the forum, without images in a header thats there. Any help is much appreciated :)
I copy/pasted your code and it seems to work fine for me: http://theexiled.pwnageservers.com/form.php


@poizone: I'm not sure if you saw it since it's on the previous page, but I posted some code for you.
Turns out that it was because my board was disabled, thought you could still work like that but i guess not ;).

On another note, the code is good and all but is there anyway i can make it not show the forums at all when you login via the form.php, like have it run on the db rather the forum login system, like if the forum is disabled they can still login to main site to... lets say.. upload images to a premade gallery?
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10410
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

I think this will do it for you:

Code: Select all

<?php
    define('IN_PHPBB', true);
    define('IN_LOGIN', true);
    $phpbb_root_path = './forums/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

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

    if($user->data['is_registered'])
    {
        echo 'Welcome back, ' . $user->data['username'] . '<br /><br />';
        echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx") . '">' . $user->lang['PROFILE'] . '</a><br />';
        
        $l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['NEW_PM'] : $user->lang['NEW_PMS'];
        $l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
        echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') . '">' . $l_privmsgs_text . '</a><br />';
        echo '<a href="' . append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts') . '">' . $user->lang['SEARCH_NEW'] . '</a>';
        echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">log out</a>';
    }
    else if(isset($_POST['login']))
    {
        //You will need to apply HTML to this section to style it

        $username = request_var('username', '', true);
        $password = request_var('password', '', true);
        $autologin = (!empty($_POST['autologin'])) ? true : false;

        $result = $auth->login($username, $password, $autologin);

        if ($result['status'] == LOGIN_SUCCESS)
        {
            //User was successfully logged into phpBB
            $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
            $redirect = reapply_sid($redirect);
            echo '<meta http-equiv="refresh" content="0; url=' . $redirect . '" />';

            echo $user->lang['LOGIN_REDIRECT'];
        }
        else
        {
            echo $user->lang['ERR_UNABLE_TO_LOGIN'] . '<br /><br /><a href="./../' . $path['basename'] . '>Return to previous page</a>';
        }
    }
    else
    {
        $path = pathinfo($_SERVER['SCRIPT_FILENAME']);
        echo 'Welcome guest<br /><br />
            <form method="POST" action="form.php">
            Username: <input type="text" name="username" size="20"><br />
            Password: <input type="password" name="password" size="20"><br />
            Remember Me?: <input type="checkbox" name="autologin"><br />
            <input type="submit" value="Login" name="login">
            <input type="hidden" name="redirect" value="./../' . $path['basename'] . '">
            </form>
            <br />';
       echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register') . '">' . $user->lang['REGISTER'] . '</a>';
    }
?>
The second define statement should allow it to show if the board is disabled. The second else if block will need HTML added to it, otherwise it will be a white page with black text. If your file is named something other than form.php, you will need to update the form action.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
`Mistermage`
Registered User
Posts: 9
Joined: Thu Jul 03, 2008 1:03 am
Location: New Hampshire, USA
Contact:

Re: Full Site Integration

Post by `Mistermage` »

Awesome, just awesome, thank you Very much Nox. I really appreciate this, time to integrate a detection based on the users position in the forum to decide if they can upload images or not :D .

Thanks again!
User avatar
poizone
Registered User
Posts: 62
Joined: Sun Jan 13, 2008 6:01 pm

Re: Full Site Integration

Post by poizone »

I tried the code again, and it worked, kind of. It would give me the first post, but then it gave me a general error about

Code: Select all

./forums/styles//template/bbcode.html
Which I know is a template. Then I commented out the line

Code: Select all

$message = generate_text_for_display(...);
and I got no error. I look through the source documentation, but found nothing in the function generate_text_for_display() that would set a style template file.
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10410
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

That is probably from includes/bbcode.php's bbcode_cache_init(). It looks like the user doesn't have a theme associated with it.

Code: Select all

$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
User avatar
poizone
Registered User
Posts: 62
Joined: Sun Jan 13, 2008 6:01 pm

Re: Full Site Integration

Post by poizone »

I fixed the issue by setting

Code: Select all

    $user->theme['template_path'] = 'blackbox_blue';
in the config area.

I noticed that the code strips urls, unless posted without a url tag. I saw this, and immediately tested BBCode, and it all works, but the URL tag.

Also, I owe you a pop, or beer, or something Noxwizard. Not that I can do anything like that, being a minor.
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10410
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

As long as the url starts with http:// it should become a link. There's a few on the page I have up which are showing properly.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
User avatar
poizone
Registered User
Posts: 62
Joined: Sun Jan 13, 2008 6:01 pm

Re: Full Site Integration

Post by poizone »

Noxwizard wrote:As long as the url starts with http:// it should become a link. There's a few on the page I have up which are showing properly.
Thats the problem. I use the syntax {url=http://www.example.com/}Example{/url}. That does not display correctly for some reason.
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10410
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Full Site Integration

Post by Noxwizard »

I'm not sure what to tell you, as all the bbcodes are getting parsed for me with that exact same code.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
Locked

Return to “[3.0.x] MOD Writers Discussion”