21
blackrx
Re: How do I add a simple webpage to a xoops themed site?
  • 2009/11/8 0:39

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


based on
https://xoops.org/modules/newbb/viewtopic.php?post_id=316663#forumpost31666

ok bare with me...a newbie in mysl/php

i tried something like this but its not working..other user still can access the page

if (is_object($xoopsUser)) {
   
$sql "SELECT uid FROM ".$xoopsDB->prefix("users")." WHERE uid NOT IN (1) AND NOT IN (34)"
    
    
$result $xoopsDB->query($sql);
    
    if (
$result && $xoopsDB->getRowsNum($result) > 0) { 
 { 
        
redirect_header(XOOPS_URL5_NOPERM);
        exit();
    }
}

22
ghia
Re: How do I add a simple webpage to a xoops themed site?
  • 2009/11/8 1:31

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You are searching it too far. With your code snippet, the page is visible if the user is not logged in or when he is logged in, if there exists no users except for 1 or 34 in the database ...

It is much simpler:
// see who is logged in
if(is_object($xoopsUser)) {
  
$uid $xoopsUser->getVar('uid');
}
else

  
$uid 0;

// is it 1 or 34?
$userisok =(($uid == 1) || ($uid == 34));
// if it is not ok send him home
if (!$userisok) {
    
redirect_header(XOOPS_URL5'No permission');
    exit();
}

23
blackrx
Re: How do I add a simple webpage to a xoops themed site?
  • 2009/11/8 2:43

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


Lol...thanks Ghia..now i get it...

you rock

Login

Who's Online

453 user(s) are online (336 user(s) are browsing Support Forums)


Members: 0


Guests: 453


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