The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

HTML page visible only for logged users.

3 posters

Go down

HTML page visible only for logged users. Empty HTML page visible only for logged users.

Post by Przmus July 28th 2012, 9:18 pm

Hello.
I created a page in "HTML pages management".
This page is now visible for everyone.
How can I hide it for everyone, that it will be visible only for users who are logged-in on my forum?
avatar
Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by Sanket July 29th 2012, 6:44 am

There is no way you can do this. All pages you make are visible to all, if they wish to see it.
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by LGforum July 29th 2012, 10:29 pm

If you ticked use header and footer, you can keep people away with this Javascript:
Code:
if('{*USERNAME}'==='Guest') window.location = '/';
(remove the *)
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by Sanket July 30th 2012, 5:37 pm

LGforum wrote:If you ticked use header and footer, you can keep people away with this Javascript:
Code:
if('{*USERNAME}'==='Guest') window.location = '/';
(remove the *)
Would that counter this as well?

http://www.webartzforum.com/-h6.htm If i just go on adding the numbers from h6 to any other number, it gives the html page?

Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by Przmus July 30th 2012, 6:10 pm

LGforum wrote:If you ticked use header and footer, you can keep people away with this Javascript:
Code:
if('{*USERNAME}'==='Guest') window.location = '/';
(remove the *)
Unfortunately it doesn't work on my forum...
I ticked to "use your forum header and footer", removed " * " and changed window location href...
I tried on all internet browsers. Any other ideas?
avatar
Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by LGforum July 31st 2012, 2:18 am

I don't think it parsed in HTML pages actually is it.

You'd have to have this somewhere where it is parsed:
Code:
if('{*USERNAME}'==='Guest' && /\/h\d+-.*/.test(window.location.pathname)) window.location = '/';
This is very similar to how I keep people off my HTML pages.

It needs to go in an announcement or widget, and will work on HTML pages with header and footer activated. And needs to be in script tags too obviously.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by Przmus August 1st 2012, 10:42 pm

Code:
<script type="text/javascript">
if('{*USERNAME}'==='Guest' && /\/h\d+-.*/.test(window.location.pathname)) window.location = 'http://mysite.forummotion.com/login';
  </script> 
without: * near USERNAME.

I added it to Modules/Javascript codes management And I selected to display it "In all the pages". But it still doesn't work when I'm logged off.
I also tried in widgets, but gives same issue.
What else can I do?
avatar
Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by LGforum August 2nd 2012, 2:17 am

Well no it won't work in Javascript management.

It needs to go in an announcement or widget. And it will work only on pages that include the announcement or widget (that contains the code).
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by Przmus August 2nd 2012, 10:43 pm

LGforum, could you send me a link to your HTML page? I'd like to view the source of your site, to find where is the problem.
avatar
Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by LGforum August 3rd 2012, 1:19 pm

That won't really help. All my HTML pages which have the header and footer in, you can not access because of a similar code to this.
It would be more beneficial to provide the HTML page you are making which this code isn't working for you.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

HTML page visible only for logged users. Empty Re: HTML page visible only for logged users.

Post by Przmus October 2nd 2012, 11:27 am

Thanks Rideem3.

I found a solution Smile
I created javascript which detect if cookie "fa_www_yourforum_forumotion_com_sid" exists. If not it will automatically redirect you to /login page

Code:

<script>
if (document.cookie.indexOf('fa_www_yourforum_forumotion_com_sid') != -1) {  ; }
else  { window.location = "http://yourforum.forumotion.com/login";  }
</script>

I hope it helps
avatar
Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum