The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

HTML page visible only for logged users.

View previous topic View next topic Go down

HTML page visible only for logged users.

Post by Przmus on 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?

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by Sanket on 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
ForumGuru

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

http://webartzforum.com

Back to top Go down

Re: HTML page visible only for logged users.

Post by LGforum on 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
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by Sanket on 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
ForumGuru

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

http://webartzforum.com

Back to top Go down

Re: HTML page visible only for logged users.

Post by Przmus on 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?

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by LGforum on 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
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by Przmus on 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?

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by LGforum on 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
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by Przmus on 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.

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by LGforum on 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
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: HTML page visible only for logged users.

Post by Przmus on 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

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

View previous topic View next topic Back to top


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