News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SSI certain member group access only

Started by Waste, November 11, 2004, 10:26:28 PM

Previous topic - Next topic

Waste

I am trying to figure out how to use the welcome script from the basic SSI tutorial to only allow certain member groups.
I got it to work for admins and block guests, but can't figure out how to allow one other member group in and not all members.

Jerry



- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Waste

I would I go about allowing, say, five member groups access to a certain page and noone else?

Jerry

probably something like this

<?php

if (in_array(9, $user_info['groups']) || in_array(12, $user_info['groups'] || in_array(14, $user_info['groups'] || in_array(16, $user_info['groups'] || in_array(18, $user_info['groups']))
{
   echo
'Yay! Im in group 9 ';

else
{
   echo
'We are sorry, it seems you dont have access to this page.';
}

?>
unkown probably has a better way though ;D


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Waste

I got errors when trying that.
Can't remember what they said though.

Jerry

yea didn't work for me either sorry :( After trying. . .


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

[Unknown]

<?php

require_once('/path/to/SSI.php');

global
$user_info;

if (
in_array(9, $user_info['groups']) || in_array(12, $user_info['groups']) || in_array(14, $user_info['groups']) || in_array(16, $user_info['groups']) || in_array(18, $user_info['groups']))
{
   echo
'Yay! I\'m in a special group!';

else
{
   echo
'We are sorry, it seems you dont have access to this page.';
}

?>


Once you've got that many, though, you almost want to use a permission instead...

-[Unknown]

Waste

#7
Thank you. :)

Would using a permission be a better method?

[Unknown]

Yes, but it'd be more complicated enough that it's not a big deal.

-[Unknown]

Advertisement: