1
guspel
verify registered user in html
  • 2018/12/21 19:48

  • guspel

  • Just popping in

  • Posts: 12

  • Since: 2012/2/25


I have a page (xx.html) in a directory within xoops.
I want users to be able to see it (xoops / file / xx.html), but not anonymous.
What code should I include in the header of xx.html so that it verifies that it is a registered user?
Thank you

2
Mamba
Re: verify registered user in html
  • 2018/12/22 7:01

  • Mamba

  • Moderator

  • Posts: 11364

  • Since: 2004/4/23


You can try this approach:
https://xoops.org/modules/newbb/viewtopic.php?post_id=320807#320807
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
mjoel
Re: verify registered user in html
  • 2018/12/24 3:20

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


use this

global $xoopsUser
if (!
is_object($xoopsUser)) {
    
redirect_header('index.php'3"You have no permission");
}


check also
https://xoops.org/modules/newbb/viewtopic.php?topic_id=77168

4
guspel
Re: verify registered user in html
  • 2018/12/24 20:01

  • guspel

  • Just popping in

  • Posts: 12

  • Since: 2012/2/25


Thanks for the answers.
I solved it using this code.
For now it works well. I'll keep doing tests.

<?php include dirname(__FILE__) . DIRECTORY_SEPARATOR '../../mainfile.php';
 if (isset(
$GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser'])) { ?> 
<html>Any content</html>
 <?php }else {redirect_header(XOOPS_URL "/user.php");} include(XOOPS_ROOT_PATH."/footer.php"); ?>


Thank you and Happy New Year

Login

Who's Online

240 user(s) are online (63 user(s) are browsing Support Forums)


Members: 0


Guests: 240


more...

Donat-O-Meter

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

Latest GitHub Commits