MyBB Community Forums

Full Version: Merging users to other features?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Basically what i have is a image/file upload .php script.
A simple one really. But was wondering how i would go about intergrating it into MyBB so only the users of the forum can access it?
The easiest way is to put it in the same folder as your MyBB installation, then at the top of the file, put:

<?php
require './global.php';

if(!$mybb->user['uid'])
{
   error_no_permission();
}
?>
Thanks for that.
That was exactly what i was wanting.
DennisTT Wrote:The easiest way is to put it in the same folder as your MyBB installation, then at the top of the file, put:

<?php
require './global.php';

if(!$mybb->user['uid'])
{
   error_no_permission();
}
?>

Sorry but would the !$mybb->user['uid'] have to be checked against 0? I thought guests were considered uid 0. If that's so then that check will return true for guests and no permission error will occur.

Please let me know if I am wrong because then I can save a small bit of code when writing my plugins.
labrocca Wrote:Sorry but would the !$mybb->user['uid'] have to be checked against 0? I thought guests were considered uid 0. If that's so then that check will return true for guests and no permission error will occur.

Please let me know if I am wrong because then I can save a small bit of code when writing my plugins.
http://ca.php.net/manual/en/types.comparisons.php will probably answer some of your questions, if I understand you correctly.