...

View Full Version : Integrating PhpBB Login but am recieving a parse erorr?



Bry Man
10-14-2004, 02:28 AM
Hi,
Ive been working on integrating the phpBB login and registration into my own site, so far ive gotten the registration to work, it even adds the useres to the phpbb database. However the login code is giving me some problems ive followed the tutorial found Here (http://www.phpbbhacks.com/forums/viewtopic.php?t=7563&start=0) and have included it in my pages, the problem (error can be seen Here (http://www.trio.5gigs.com/register.php) is is that (i think) it doesnt like being "pieced" together using the phpinclude function so its thinkin that the < in html isnt supposed ot be there, is there a way to gt around this besides maybe just making the pages one single file instead of 3 (left, middle and right)? Im fairly new to php so i dont know what the deal with it not accepting it is so any help would be appreciated.

Site Code:

Fou-Lu
10-14-2004, 04:13 AM
Ugh, I would have used templates myself, but your errors are here:
In left.php on line 39 you have:


include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ($isauth == '1')
{

Change this to:


include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ($isauth == '1')
{
?>


In left.php on approx line 128 you have:


<td class="sideboxback" width="178" height="50" alt=""><center>
<?php

Change this to:


<td class="sideboxback" width="178" height="50" alt=""><center>
<?php
}
}


Then it should work for you. Unfortunatly I am missing the files required for the functions, so I now get a session_pagestart() error, but assuming that is user defined I'm not really concerned about that ATM.

You also have an error in your style.php file. You have not defined a start for php, which I assume you want directly after the </html> section for it. Also, since I'm not certain how it supposed to all go together, there is an error generated by the style when running the register script. Also, I don't believe you can send the header that far into the style.php script, since you have sent out html previous to that, but I could be wrong on that one.

Bry Man
10-14-2004, 05:51 AM
Ya now that I change to that it gives me the error that im trying to hack it again and the session_pagestart() error is back too... hmm, what ive got in the files is exactly what i got from the site, about the style being an error because i didnt define a start for php, The site as you notice is made of 3 pieces which are called together using the php include function which basiclly makes 3 pages work as if they are one, that is why I didnt end the php code the first time nor did I define the start in the style because they are part of one script...you know what i mean lol, 'supposedly' your html code or what the site was considering content is supposed to somewhere in the middle of the script so I included the first half in the left.php and the last half in style.php.

Fou-Lu
10-14-2004, 06:12 PM
The hacking attempt error is generated probably from your phpBB configurations. Not that they are wrong, but they probably need a class defined for it. I'll check mine here....

Seems fine for me. All I needed to change to get it to work was my directory for $phpbb_root_path to a relative path. So, if your phpbb is located at http://yoursite.com/phpbb, change the path to ./phpbb and it should work. Also, I would recommend that you change your php start tag from <? to <?php instead. You never know when your host will change their configuration.

Kurashu
10-15-2004, 03:08 AM
Did you add:


define('IN_PHPBB', true);

In your script?

Fou-Lu
10-15-2004, 03:18 PM
Yeah, its in there. I received the same error as well, which was kind of odd. Guess it just kinda requires the relative path, though it could be my environment set up I suppose. Thats the first thing that I thought as well...

Bry Man
10-15-2004, 07:57 PM
Ive heard that it is suppsed to be within the phpBB directory, I would try it out but I dont have any time now days with school and all.

marek_mar
10-15-2004, 08:10 PM
There is a phpBB auth mod so you can use phpbb sessions and user system on your own pages. Search phpbb.com

Bry Man
10-15-2004, 09:55 PM
ya Ive seen that too, its basicly the same exact thing that ive got here, the problem that occured was the same as the above. It would just be really cool if I could figure out a way to make it work lol since ive already got the registration linked to the phpBB database

Fou-Lu
10-16-2004, 03:49 AM
Have you tried to change the path to relative? I mean, I have phpbb installed in my environment under httpdocs/phpbb and placed your files under httpdocs/bryhelp and it worked fine if I changed the path to ./../phpbb/. It should work for you. Though I suppose that the absolute should as well. Otherwise we will have to think of a different method. If your looking at placing each on a different server, may not be possible since phpsessions are server generated.

Ultragames
10-16-2004, 06:28 AM
Im not sure how to fix this really. However, once you guys have this working, if someone could post that it's all fixed, i would like to use this script, (of course applying the fixes suggested here)

I've been dreading making one of my own. If i dont get a login script working within a week or so, im going to have some issues.

Bry Man
10-16-2004, 07:26 AM
Yes ive set the $phpbb_root_path variable to './phpBB2/ and I get the error that you can see now Here (http://www.trio.5gigs.com/register.php) incase you dont feel like sifting through all the posts to find the link, Its showing some content of the site but its severly jacked up and still giving an error


Warning: Cannot modify header information - headers already sent by (output started at /home/triopypg/public_html/left.php:2) in /home/triopypg/public_html/phpBB2/includes/sessions.php on line 188

Warning: Cannot modify header information - headers already sent by (output started at /home/triopypg/public_html/left.php:2) in /home/triopypg/public_html/phpBB2/includes/sessions.php on line 189

In the top of the page and at the ver bottom its showing this error


} else { message_die(GENERAL_ERROR, "You do not have permission to access this page"); } } else { // not logged in header('Location: ' . append_sid($phpbb_root_path.'login.'.$phpEx.'?redirect='.$PHP_SELF, true)); } include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?>

which looks like code thats not being parsed but is not locaed in any of the 3 pages that form the single page, its having an error on line 188+189 in the sessions.php which is part of phpBB so I dont think I can post a file from it

Fou-Lu
10-16-2004, 12:22 PM
The bottom is caused by your style.php which has a break in the php start and end tags. I cannot remember which it is missing off hand (I'm at work ATM), but I believe it was the start tag. Add that, and the bottom will go away. However, take a look into that as well, I don't believe you can send that last header without removing your html on there. If someone knows off hand whether header information is caused by html or if its caused by echo, that would be great!

As with those header information in your left.php, try changing them, and add a comma false to it to see if it will force. Unfortunatly, I don't know off hand what they are, or where they are located, so it could simply be a duplicate header its attempting to send. If that is the case, add the false.
IE: header("Content-type: whateverhere", false);

If that doesn't do the trick, I'll post a new section of code for it after.

Bry Man
10-16-2004, 07:14 PM
I guess I forgot to add the <?php to the start of the php in style.php so that got rid of one error and now its saying unexpected } im guessin its because its starting out with an else statement and the } that comes before else is confusing it but I dont know what to do about that. Also I am unsure about what you mean here

As with those header information in your left.php, try changing them, and add a comma false to it to see if it will force. Unfortunatly, I don't know off hand what they are, or where they are located, so it could simply be a duplicate header its attempting to send. If that is the case, add the false.
IE: header("Content-type: whateverhere", false);

Im kinda a noob to php in some ways and what you asking me to do there I guess is one of them...soz.

Fou-Lu
10-16-2004, 08:22 PM
Yeah, I'm not sure whats sending your header problem there. As with the style.php bottom, I'm not sure why it is you have the bottom section at all. It begins its php code with:


<?php
}
else
{

But I see no point in the script that it is continuing from anything else. Php unlike html cannot just be broken in wherever nessessary, you do need to have each script individually scripted, and so that they will run alone (unless you are making say... a function or global script which all others require, but they are still complete).
I'll check your site section, and see what the problem is.
btw, what is your phpbb board path set as in left.php?

Bry Man
10-16-2004, 09:17 PM
the $phpbb_root_path (or w/e it is) is set to ./phpBB2/ since my phpbb2 folder is directly above the root, the reason it is split is because according to the tutorial site I found for integrating the phpbb login In order for your pages to have restriced access to anyone but those who are registered the 'content' of you site must be within the part of the code that says 'content here' which means all the html im guessing

Heres a snippet from what im referring to:

include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ($isauth == '1')
{
Insert content here
}
else
{
message_die(GENERAL_ERROR, "You do not have permission to access this page");
}


So I just split the script to cover all three of the site pieces, which is why the top half didnt have an ending php tag and the bottom half didnt have a start since they are added into one one page I figured it would act as if it were one script.

And heres the part of the tutorial that mentions that all the pages must be within the phpbb2 directory in order to use its sessions

The only thing to remember is that the pages must be in the same directory as the phpBB 2 index file or they will not be able to use the phpBB 2 session.

So i guess ill start movin files into the phpbb directory =S I just hope it wont conflict with my site pages like my index and the such

Bry Man
10-17-2004, 02:23 AM
Well I moved left,register and style .php into the phpbb2 folder where its index.php resides and I get more errors.....this is kinda getting frustrating, perhaps there is an easier way to doing this while still being logged into both my site and phpbb at the same time and having the ability to restrict pages, Ive tried phpnuke in the apst and it was so god awful I was ashamed that I even tried it lol.

Fou-Lu
10-17-2004, 12:31 PM
Lol, problem solving is the key.

Ok, so the php sessions will do that based on your configurations. As far as I know, PHPSESSIONS is set via the DNS not the directory. Someone please correct me if I am mistaken in that aspect. Therefore, its not nessessary for you to place it in the same directory. In fact, I personally would not, but you do what works for you.

Ok, so you moved it into the same directory. Now, if nothing has been changed, you will receive errors similar to:


Warning: main(./phpbb/extension.inc): failed to open stream: No such file or directory in c:\network\apache\htdocs\helping\left.php on line 6

Warning: main(): Failed opening './phpbb/extension.inc' for inclusion (include_path='.;c:\php4\pear') in c:\network\apache\htdocs\helping\left.php on line 6

or something of the sorts I'm assuming. If left.php and all other files you are making are now in the directory of your phpBB, change your $phpbb path to './'. This should now work for you. Why they would give you the variable for a root path that requires a relative pathed url is beyond me, but I have only correctly gotten this to work with the relative. Anyway, if this works, we'll continue with the scripting. Though, like I mentioned, I would personally stick my site in the ./ directory and my forums in ./phpbb/ or ./forum/. But like I also said, this is up to you. I just have a feeling it may work out bad with your register.php script, and if phpbb has it, their register.php script. In any case, fill me in.

Bry Man
10-17-2004, 06:51 PM
I really dont want to have my site within the phpbb directory either but its what the tutorial said so I thought id give ti a spin, after changing the root path to ./ I get a page that has an infinite ammount of errors so thats no longe an option im guessin lol.

I still cant get mine to work when its not in the phpBB directory and above the root path witht he root path variable set to ./phpBB/ its still giging me the headers already sent and the unexpected } error, you said you had it working? could I see the page that its working on just so I know its possible please? perhaps ive missed a step or something, I hate having to bother you so much with this but thank you for your help that youve givin me so far.

Just in case Ive missed something heres my files up to date:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum