MyBB Community Forums

Full Version: Integrating MyBB into your website. (Login Form)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Michael83 Wrote:What's this line for?
if($mybb->settings['showwol'] != "no" && $mybb->usergroup['canviewonline'] != "no")
Remove this line. See if that fixes your problem.

I'm remuve this line. Bat error same:
Quote:Fatal error: Call to a member function on a non-object in /USER/mrnagy/pcn.hu/mybb/forum/inc/class_datacache.php on line 33
I'm having problems with those first two lines. Whenever I put
chdir('forums'); // path to MyBB
require './global.php';
at the very top of the page, the myBB parts of the page work, but a lot of my mySQL queries error up.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/v/vv/htdocs/index.php on line 29

Warning: Cannot use a scalar value as an array in /www/v/vv/htdocs/index.php on line 10
I finally put those 2 lines right before where I actually use the login box, which happens to be the last part of the page, no queries after it. Then I have no problems. I'd like to put those 2 files in the header, above the rest of the code, but then all my mySQL queries mess up.

Any suggestions?
Why do you need this at the beginning of the script?

<?php
chdir('forums'); // path to MyBB
require './global.php';
?>

Just use a variable for the directory the forum is in then use the include function like so and put it right before the login script:

<?php
$forumdir = "forum"; // MyBB directory (no trailing slash)
include $forumdir . '/global.php';

//continuing with the script

?>

What is the difference between require and include anyways?
Simulationcity Wrote:Why do you need this at the beginning of the script?

<?php
chdir('forums'); // path to MyBB
require './global.php';
?>

Just use a variable for the directory the forum is in then use the include function like so and put it right before the login script:

<?php
$forumdir = "forum"; // MyBB directory (no trailing slash)
include $forumdir . '/global.php';

//continuing with the script

?>
Because the global.php includes files that that assume your in the mybb default directory. Doing the above should produce several include/require errors.
Simulationcity Wrote:What is the difference between require and include anyways?
If a file fails to require it stops the execution of the script, but inlcude will only produce a error.
Oh okay that makes sense now. Rolleyes Because in my PHP book it didn't say what the difference was.
wix Wrote:Error:
Quote:Fatal error: Call to a member function on a non-object in /USER/mrnagy/pcn.hu/mybb/forum/inc/class_datacache.php on line 33

I'm getting that same error.

Lines 33 & 34 are
Quote:$query = $db->query("SELECT title,cache FROM ".TABLE_PREFIX."datacache");
while($data = $db->fetch_array($query))

any ideas on how to fix this?

~silverwing
Is it possiable to make a login form in the E107 system?
Hey great tutorial im a 100% beginner with php and this was easy as your comments where kept simple but i was wonder if you could help me out this is

my website http://d2bn.nzgamelounge.net

and you will see there is a box that says recent threads is it possible to have the recent thread titles (as links) shown in that box

and


when you login to the forum i want the forum index to be diplayed on my forums page thread titles etc where the login is instead any idea's would be alot of help

cheers
When I run the script by its self, it works fine...
But when I run it through my index useing an include, I get an error however it seems to work.
heres the error I get.
Warning: Cannot modify header information - headers already sent by (output started at /home/content/n/i/g/nightzer0/html/practice/header.php:4) in /home/content/n/i/g/nightzer0/html/practice/forums/inc/functions.php on line 803

Why is this?
HomerTheDragoon Wrote:When I run the script by its self, it works fine...
But when I run it through my index useing an include, I get an error however it seems to work.
heres the error I get.
Warning: Cannot modify header information - headers already sent by (output started at /home/content/n/i/g/nightzer0/html/practice/header.php:4) in /home/content/n/i/g/nightzer0/html/practice/forums/inc/functions.php on line 803

Why is this?
Are you including the global.php at the beginning of your PHP file?