Help with ssi permission

Started by Atheo, June 15, 2008, 10:28:56 AM

Previous topic - Next topic

Atheo

Hello,

I have a few membergroups that are allowed to access a certain area in my site.  That area is protected by this:

<?php global $user_info;
$groups = array(1,2,3,9,10,11,12);
if(count(array_intersect($groups, $user_info['groups'])) > 0)
{
echo '<table><tr><td>',  ssi_welcome() ,'</td></tr></table>';
}
else
{
echo 'Sorry, you must be a Premium Member to access this area.';
}
?>

If they are in that group then:

<?php global $user_info;
$groups = array(1,2,3,9,10,11,12);
if(count(array_intersect($groups, $user_info['groups'])) > 0)
{
echo '<table width="100%" border="0" cellpadding="5">
     <tr>
       <td><a href="http://fit-hub.com/forum/index.php?action=felblog"><img src="/images/blog.png" alt="Premium Blogs" width="48" height="48" border="0" /></a></td>
       <td colspan="2" align="left"><span class="style5"><a href="http://fit-hub.com/forum/index.php?action=felblog">Go to Blogs!</a></span> </td>
       </tr>
     <tr>
       <td></td>
       <td width="58%" align="right"><a href="http://fit-hub.com/forum/index.php?board=27.0" class="style5">Premium Forum </a></td>
       <td width="15%"><a href="http://fit-hub.com/forum/index.php?board=27.0"><img src="/images/premium_forum.png" alt="Premium Forums" width="48" height="48" border="0" /></a></td>
     </tr>
     <tr>
       <td><a href="http://fit-hub.com/forum/index.php?board=23.0"><img src="/images/training_log.png" alt="Training Requests" width="48" height="48" border="0" /></a></td>
       <td align="left"><a href="http://fit-hub.com/forum/index.php?board=23.0" class="style5">Training Requests </a></td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td></td>
       <td></td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td></td>
       <td></td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
   </table>'
;
}
else
{
echo '<table width="100%" border="0" cellpadding="5">
     <tr>
       <td align="left">
         This section is for members who have purchased a Premium Membership. If you would like to take advantage of the features here, please visit our <a href="http://fit-hub.com/store.php">store</a> to purchase a membership.<br />
           Fit-Hub Premium Memberships Feature:
           <ul>
           <li>Ad-free Forum Section<br />
           <li>Personal Blog<br />
           <li>Personal Photo Album<br />
           <li>Preferred Content</li>
           <li>Beta Features</li>
           <li>Store Discounts</li>
           </ul>
         <p>Already a Premium Member? Please <a href="http://fit-hub.com/forum/index.php?action=login">click here</a> or sign in at the top of this page. </p></td>
     </tr>
   </table>'
;
}
?>


Works great on my computer but others who are in the select groups are only seeing the second output in the first bloc telling them they are not allowed to see.  Any help with this?

Thank you


[SiNaN]

Let's try this:

global $user_info;
   $allowed_groups= array(1,2,3,4,5,6,7,1453,1071);
   $permit = false;
   foreach ($allowed_groups as $group) {
      if(in_array($group, $user_info['groups']))
         $permit = true;
   }
   
   if($permit)
   {
   echo '<table>
    <tr>
<td>',  ssi_welcome() ,'</td>
</tr>
</table>';
   }
   else
   {
   echo 'Sorry, you must be a Premium Member to access this area.';
   }

global $user_info;
   $allowed_groups= array(1,2,3,4,5,6,7,1453,1071);
   $permit = false;
   foreach ($allowed_groups as $group) {
      if(in_array($group, $user_info['groups']))
         $permit = true;
   }
   
   if($permit)
   {
   echo '<table width="100%" border="0" cellpadding="5">
      <tr>
        <td><a href="http://fit-hub.com/forum/index.php?action=felblog"><img src="/images/blog.png" alt="Premium Blogs" width="48" height="48" border="0" /></a></td>
        <td colspan="2" align="left"><span class="style5"><a href="http://fit-hub.com/forum/index.php?action=felblog">Go to Blogs!</a></span> </td>
        </tr>
      <tr>
        <td></td>
        <td width="58%" align="right"><a href="http://fit-hub.com/forum/index.php?board=27.0" class="style5">Premium Forum </a></td>
        <td width="15%"><a href="http://fit-hub.com/forum/index.php?board=27.0"><img src="/images/premium_forum.png" alt="Premium Forums" width="48" height="48" border="0" /></a></td>
      </tr>
      <tr>
        <td><a href="http://fit-hub.com/forum/index.php?board=23.0"><img src="/images/training_log.png" alt="Training Requests" width="48" height="48" border="0" /></a></td>
        <td align="left"><a href="http://fit-hub.com/forum/index.php?board=23.0" class="style5">Training Requests </a></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>';
   }
   else
   {
   echo '<table width="100%" border="0" cellpadding="5">
      <tr>
        <td align="left">
          This section is for members who have purchased a Premium Membership. If you would like to take advantage of the features here, please visit our <a href="http://fit-hub.com/store.php">store</a> to purchase a membership.<br />
            Fit-Hub Premium Memberships Feature:
            <ul>
            <li>Ad-free Forum Section<br />
            <li>Personal Blog<br />
            <li>Personal Photo Album<br />
            <li>Preferred Content</li>
            <li>Beta Features</li>
            <li>Store Discounts</li>
            </ul>
          <p>Already a Premium Member? Please <a href="http://fit-hub.com/forum/index.php?action=login">click here</a> or sign in at the top of this page. </p></td>
      </tr>
    </table>';
   }


Former SMF Core Developer | My Mods | SimplePortal

Advertisement: