xoops forums

guspel

Just popping in
Posted on: 12/21 19:48
guspel
guspel (Show more)
Just popping in
Posts: 11
Since: 2012/2/25
#1

verify registered user in html

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

Mamba

Moderator
Posted on: 12/22 7:01
Mamba
Mamba (Show more)
Moderator
Posts: 10759
Since: 2004/4/23
#2

Re: verify registered user in html

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

mjoel

Quite a regular
Posted on: 12/24 3:20
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#3

Re: verify registered user in html

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

guspel

Just popping in
Posted on: 12/24 20:01
guspel
guspel (Show more)
Just popping in
Posts: 11
Since: 2012/2/25
#4

Re: verify registered user in html

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