MyBB Community Forums

Full Version: Page access depending on MyBB Usergroup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello all,

I have set up php-based file-explorer on my site to allow people to up/download/edit etc files on my server. It comes with it's own usermanagement-module (PHPFileNavigator).

Can someone either
- create me either instructions on how to build a bridge for this
OR
- tell me how to check for a MyBB Usergroup before giving access to a page

For the latter, the logic would have to go something like this:

- check if the person is logged in, if not -> noaccess but redirect to the login-screen (like MMs download mod has)
- if the person is logged in, is he/she in usergroup 4 OR 8; if not, noaccess but redirect to the login-screen
- if above criteris is met -> then show the rest of the page (ie the loginpage for the tool (unless I find then a way to disable the usermanagement there and allow 'anonymous' access and only rely on the MyBB-check above)

Help would be appreciated.

cheers,
Kimmo
<?php
include("./global.php");

// Logged in and usergroup 4 or 8?
if($mybb->user['usergroup'] != "4" || $mybb->user['usergroup'] != "8")
{
// Not logged in, show login screen
nopermission();
}
else
{
// Show Page
}
?>
okay...I can see how that works...but the PHPFileExplorer is installed in it's own directory.....so the relative paths are not working...any workaround for this?
Just change the path here:
include("./../mybb/global.php");
hmmm...I understand....but it's not working for me Sad
I have another file 'required' in the global-file that has a path to ./inc/ and now that reference is not working Sad

If someone is willing to spend some time, I will reserve time to do a netmeeting or something to show everything live...
Kimmo Wrote:hmmm...I understand....but it's not working for me Sad
I have another file 'required' in the global-file that has a path to ./inc/ and now that reference is not working Sad

If someone is willing to spend some time, I will reserve time to do a netmeeting or something to show everything live...

Are you getting an error when accessing the page directly? If a shortened path is not working for you, I suggest using the complete file path.
the new page is under it's own subdir and is called index.php
this file then needs to access the global.php which is in the server-root. This global.php has inside it reference also to a required file myown_common.php which is in /inc -directory....

Root
I
Common.php
I
---/inc/myown_common.php
I
---/subdir/index.php

kinda difficult to explain Sad
Kimmo Wrote:the new page is under it's own subdir and is called index.php
this file then needs to access the global.php which is in the server-root. This global.php has inside it reference also to a required file myown_common.php which is in /inc -directory....

Root
I
Common.php
I
---/inc/myown_common.php
I
---/subdir/index.php

kinda difficult to explain Sad

An explanation for this is much simpler than one would make it to be. No matter what folder the new page is in, it can access the global.php file if you get the complete path to that file.

I hope this helps Smile.
(2006-03-24, 12:21 PM)Michael S. Wrote: [ -> ]
<?php
include("./global.php");

// Logged in and usergroup 4 or 8?
if($mybb->user['usergroup'] != "4" || $mybb->user['usergroup'] != "8")
{
// Not logged in, show login screen
nopermission();
}
else
{
// Show Page
}
?>

Is this still valid for MyBB 1.6?
(2010-11-25, 01:11 AM)Xdlo Wrote: [ -> ]
(2006-03-24, 12:21 PM)Michael S. Wrote: [ -> ]
<?php
include("./global.php");

// Logged in and usergroup 4 or 8?
if($mybb->user['usergroup'] != "4" || $mybb->user['usergroup'] != "8")
{
// Not logged in, show login screen
nopermission();
}
else
{
// Show Page
}
?>

Is this still valid for MyBB 1.6?

You can also use this plugin. :p
http://community.mybb.com/thread-75991.html
Pages: 1 2