MyBB Community Forums

Full Version: page manager and php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have installed page Page Manager. I then created a page in html and it works great. I needed to make it secure so that only certain groups could access it. Someone gave me some code to make it secure which is as follows:

<?php

$disallowed = array('1', '2', '3', '5', '6', '7');

if(in_array($mybb->user['usergroup'], $disallowed))
{
error_no_permission();
}

?>

Now for the problem....I want my cake and eat it too.

If I change the setting Use MyBB Template to yes which turns on the header and footer to keep the pages consistent, I lose the ability to make the page secure.

Is there a way to be able to use the headers and footers from MyBB and keep the page secure?

Thanks,
Jim
You can use the $headerinclude, $header, and $footer variables.
I am still very new to MyBB, so I am not sure what you mean.
Try this:

<?php

 $disallowed = array('1', '2', '3', '5', '6', '7');

 if(in_array($mybb->user['usergroup'], $disallowed))
 {
 error_no_permission();
 } else {

echo "<html>
 <head>
 <title>{$mybb->settings[bbname]} - Example Page</title>
 {$headerinclude}
 </head>
 <body>
 {$header}
 <br />
 <!-- Content: Start -->

 <!-- Content: End -->
 {$footer}
 </body>
 </html>";

}
?>
I have not been able to get this to work. I get a parse error from page manager for the line that contains <td valign="top">. I will include my code below that works:

<?php

$disallowed = array('1', '2', '3', '5', '6', '7');

if(in_array($mybb->user['usergroup'], $disallowed))
{
error_no_permission();
}


?>

<td valign="top">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td width="100%" valign="top">
<!--area Type="main" face="Arial,Helvetica,sans-serif" size="2" color="black" style="0"-->

<p><font face="Arial,Helvetica,sans-serif" size="2" color="black"><DIV></DIV>
<DIV align=center>
</UL>
<P align=left><FONT face="Verdana, Arial, Helvetica, sans-serif"size=2><a href="http://www.sonyrewards.com/en/home/wof/" onmouseout="window.status=' ';return true;"onmouseover="window.status='Wheel of Fortune';return true;" target="_blank"><font color="black"">Wheel Of Fortune</a></DIV></font></P>
<UL>
<LI><FONT color=#0000ff>Living Proof</font></LI>

<!--Rest of code omitted for simplicity -->