MyBB Community Forums

Full Version: IN_MYBB not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Try changing your cookie path to / instead of what you have now.
(2018-02-02, 10:17 PM)dragonexpert Wrote: [ -> ]Try changing your cookie path to / instead of what you have now.

not possible to change the path, as I can't get to the page that allows me to change the cookies path Big Grin as clicking on the settings saiz first I've gotta first log in.

This is a minor issue, the accessing of $mybb->user['uid'] is what I really want to solve, I might try installing it elsewhere
I don't mean to be rude, but the code you have should work and multiple have told you that you are not properly accessing global.php

Just because there is no error doesn't mean that you have the correct location.

Try this code:

<?php

define("IN_MYBB", 1);
require("global.php");

echo('<pre>' . var_dump($mybb) . '</pre>');

?>

If you get a result of null then you do not have the correct location.

In order to solve the problem, I need to know the path to your page (ie. zed.php) then someone can help you correctly access the MyBB libraries.
OK making progress, installed 1.8.14 again

If I copy the my title.php file into the same directory as where mybb is installed it works

and change the code to
define("IN_MYBB", true );
require("global.php");
echo "f" . $mybb->user['username'] . "g";

Obviously this is less than satisfactory
Here is the directory layout I have
-|
 |-forum (mybb installed here)
 |-movies (eg title.php keep here)

so from movies/title.php
define("IN_MYBB", true );
require("../forum/global.php");
echo "f" . $mybb->user['username'] . "g";
should work but it doesnt

(2018-02-02, 11:04 PM)Wildcard Wrote: [ -> ]I don't mean to be rude, but the code you have should work and multiple have told you that you are not properly accessing global.php

Be as rude as you want Smile

define("IN_MYBB", 1 );
require("../forum/global.php");
echo('<pre>' . var_dump($mybb) . '</pre>');

object(MyBB)#6 (23) { ["version"]=> string(6) "1.8.14" ["version_code"]=> int(1814) ["cwd"]=> string(1) "." ["input"]=> array(1) { ["id"]=> int(1) } ["cookies"]=> array(8) { ["mybb"]=> array(2) { ["lastvisit"]=> string(10) "1517613111" ["lastactive"]=> string(10) "1517614084" } ["_ga"]=> string(27) "GA1.2.1541593013.1444345896" ..... etc


 define("IN_MYBB", 1 );
require("../forum/global.php");

//echo('<pre>' . var_dump($mybb) . '</pre>');
echo "f" . $mybb->user['username'] . "g";

fd

I am logged in
site is
http://zedzeek.com/hb

cookie stuff (though I've tried others as well)  

Cookie Domain
The domain which cookies should be set to. This can remain blank. It should also start with a . so it covers all subdomains.
.zedzeek.com

Cookie Path
The path which cookies are set to. We recommend setting this to the full directory path to your forums with a trailing slash.
/

Perhaps useful info, which may lead to insight [Image: mybb2.png]Click on 'Log Out'.
Displays the following, and 3 seconds later display's the first image again. i.e. It never logged me out, in fact I'm always logged in no matter how many times I log out

[Image: mybb3.png]

OK I think I've solved it now,

In board settings I changed the following
Cookie Prefix
A prefix to append to all cookies set by MyBB. This is useful if you wish to install multiple copies of MyBB on the one domain or have other software installed which conflicts with the names of the cookies in MyBB. If not specified, no prefix will be used.

I added test into the editbox


I went into a private window, logged on and then I was able to log out and then were able to log on again.

http://zedzeek.com/hb/movies/title.php?id=1
displayed the correct info
fzedzeekg

I went back cleared all the cookies for this site and now I could log in/off in my normal window

No idea why its working now as I've changed nothing apart from the cookieprefix I can see it stuffing up WRT cookies if I was using the one browser but I was testing it with multiple eg firefox,edge,chrome.
Well that was 5 hours spread over 3 days well spent.

Thanks for all your help guys
(2018-02-02, 11:24 PM)zedzeek Wrote: [ -> ]Well that was 5 hours spread over 3 days well spent.

lol I can't tell you how many times I have wasted hours on a typo.

Super glad you got it working. Good on you for not giving up!
Well to be honest I did try phpBB which worked but I see they've updated their php stuff eg $_POST to be more strict which is all well and good, but I would then have to rewrite a lot of my php files (which I should anyways security etc), but I'm lazy Smile
Pages: 1 2