1
MrCoffee
how can i set the permissions for a custom html page ?
  • 2008/5/2 0:49

  • MrCoffee

  • Just popping in

  • Posts: 4

  • Since: 2007/5/17


how can i set the permissions for a custom html page, I am using the fallowing to add a html page to my site.

include("path/to/mainfile.php");
include(XOOPS_ROOT_PATH."/header.php");
?>
My html content
include(XOOPS_ROOT_PATH."/footer.php");
?>

I would like set permission on that page so only the registered users will see it.

2
Anonymous
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 0:58

  • Anonymous

  • Posts: 0

  • Since:


is it inside modules folder or in main folder ?

if it is index page of custom module, you can set the permissions from groups page.

if this page in root folder, use this code:

include("path/to/mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

if ( !
is_object($xoopsUser) ) {
    
redirect_header("indx.php",0);
    exit();
} else {

echo 
"My html content";

}

include(
XOOPS_ROOT_PATH."/footer.php");
?>

3
MrCoffee
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 1:27

  • MrCoffee

  • Just popping in

  • Posts: 4

  • Since: 2007/5/17


cool that wat I was looking for :)

if I whant to set it for a other groups like ( Dealers group )
can I set it up somewhere ? or I have to put a code in the page ?

4
Anonymous
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 1:54

  • Anonymous

  • Posts: 0

  • Since:


Hi,

include("path/to/mainfile.php"); 
include(
XOOPS_ROOT_PATH."/header.php"); 

if ( !
is_object($xoopsUser) ) { 
    
redirect_header("indx.php",0); 
    exit(); 
} elseif(!
in_array('4',$xoopsUser->getGroups())) {

echo 
"you are from Dealers group"



elseif(!
in_array('2',$xoopsUser->getGroups())) {

echo 
"hello register user :P"




include(
XOOPS_ROOT_PATH."/footer.php"); 
?>


not tested but I think will work :)

5
blueteen
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 7:20

  • blueteen

  • Quite a regular

  • Posts: 379

  • Since: 2004/7/16


Hello,
here's what i use :

include './mainfile.php';
include 
XOOPS_ROOT_PATH.'/header.php';
include 
XOOPS_ROOT_PATH."/include/cp_functions.php";

global 
$xoopsDB$xoopsConfig;
if (
is_object($xoopsUser)){
$groupsok $xoopsUser->getGroups();
}
else {
$groupsok=99; }

if (!
in_array("4"$groupsok)) //if not in dealer group
    
{
    
redirect_header("./index.php",2"Sorry, you're not authorized.....");
    exit();
    }
?>

6
MrCoffee
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 13:50

  • MrCoffee

  • Just popping in

  • Posts: 4

  • Since: 2007/5/17


wow, thank you for the reply, I will test both and see what will be the best for what I need.

7
MrCoffee
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 17:12

  • MrCoffee

  • Just popping in

  • Posts: 4

  • Since: 2007/5/17


Found this today and it works great :)
include '../mainfile.php'
include 
XOOPS_ROOT_PATH.'/header.php'

$in_group is_object($xoopsUser) && in_array(2$xoopsUser->getGroups());

//display group-specific information
if ($in_group) {
echo 
"Membership ONLY info Here";
}else {
echo 
"Regular user ONLY infor Here";
}

include(
XOOPS_ROOT_PATH."/footer.php");  
?>

8
Anonymous
Re: how can i set the permissions for a custom html page ?
  • 2008/5/2 17:22

  • Anonymous

  • Posts: 0

  • Since:


Great

As you know:

1 is for webmaster
2 is for registed users
3 is for visitors
4 is for new created group

Login

Who's Online

337 user(s) are online (252 user(s) are browsing Support Forums)


Members: 0


Guests: 337


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits