To solve the problem found yesterday (
http://community.mybb.com/thread-165135.html ) i've moved the content of that directory in "/" but i still find that everybody can access those pages, knowing the exact url.
So, how can i force users to login in order to view those pages or block guests and banned users from viewing?
In a php file you can put this:
<?php
define("IN_MYBB", 1);
require_once "global.php";
if(!$mybb->user['uid'])
{
error_no_permission();
}
// Rest of code
?>
Edit: delayed response
see
replies here
if (in_array($mybb->user['usergroup'] , array(1,7))) error_no_permission();
(2015-01-05, 03:11 PM)dragonexpert Wrote: [ -> ]In a php file you can put this:
<?php
define("IN_MYBB", 1);
require_once "global.php";
if(!$mybb->user['uid'])
{
error_no_permission();
}
// Rest of code
?>
It looks right but i get an error on line 7
See my edit. It placed an extra quotation mark.
(2015-01-05, 03:17 PM).m. Wrote: [ -> ]Edit: delayed response
see replies here
if (in_array($mybb->user['usergroup'] , array(1,7))) error_no_permission();
doesn't work, no errors but i can see the page when logged out
(2015-01-05, 03:19 PM)dragonexpert Wrote: [ -> ]See my edit. It placed an extra quotation mark.
it worked this time, thanks a lot!
^ as you want to block
php pages for
both guests & banned users, the other code should also work
if (in_array($mybb->user['usergroup'] , array(1,7))) error_no_permission();
(2015-01-05, 03:32 PM).m. Wrote: [ -> ]^ as you want to block php pages for both guests & banned users, the other code should also work
if (in_array($mybb->user['usergroup'] , array(1,7))) error_no_permission();
I've attempted with that too but i can access the page as guest...
since guests group id is 1 i cannot understand this :/
edit: btw issue has been solved forcing user to login with the other code so i have nothing to complain
^ fine. I don't want to argue. BUT tested it once again on
MyBB 1.8.3
<?php
define("IN_MYBB", 1);
require_once "global.php";
if (in_array($mybb->user['usergroup'] , array(1,7))) error_no_permission();
// Rest of code
echo 'MyBB';
?>