1
wellstuck
Users only for html - php page
  • 2008/4/3 11:19

  • wellstuck

  • Just popping in

  • Posts: 35

  • Since: 2007/11/14


Hi, I have created standard html pages that integrate into my XOOPS php sit. I used the below code above the html and everything works great. What I want to do now is add a bit of code that only allows registered users to view these pages so does anyone know how to alter this code to achieve this

This is what I have now...

include("mainfile.php");
include("header.php");
$xoopsOption['show_rblock'] = 1; //0 for no right block
?>

2
zyspec
Re: Users only for html - php page
  • 2008/4/3 13:46

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


You should be able to just add something like:
if (!isset($xoopsUser) || empty($xoopsUser)) {
    
redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST);
    exit();
}

3
wellstuck
Re: Users only for html - php page
  • 2008/4/7 12:16

  • wellstuck

  • Just popping in

  • Posts: 35

  • Since: 2007/11/14


Thanks for that, I had a bit of trouble placing it in the right place and got errors. I have now managed to make it work by adding it as below. Would you mind having a quick check over it to see that I have done it correctly because I am no expert and don't want my site to fall to pieces

Thanks a lot

this is what it looks like now...


include("mainfile.php");
include("header.php");
$xoopsOption['show_rblock'] = 1; //0 for no right block
if (!isset($xoopsUser) || empty($xoopsUser)) {
redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST);
exit();
} ?>

Login

Who's Online

144 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 144


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