MyBB Community Forums

Full Version: Php code to block guest?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For example if i want a guest blocked from www.mypage.com/randompage.php

What code do i put in randompage.php and where?

Thank you.
basic function to restrict guests is the following;

if ($mybb->user['uid'] == ' ')
	{
		error("You didnot have permission to access this page.");
	}

and you have to put this in header.
Thanks ghazal .

I already also used this code and it worked

// No permission for guests
if(!$mybb->user['uid'])
{
error_no_permission();
}

w'salam alkym. Big Grin
were exactly do i place this code ?
At the top of the page Smile

Like so:
global $mybb;
if(!$mybb->user['uid'])
{
error_no_permission();
}

//rest of file...