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.
The forum of the forums
4 posters

    Make an HTML page viewable to Registered members Only

    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 5th 2012, 9:01 pm

    Is it possible to make an HTML page so you have to be logged into the forum to be able to view it?

    My forum is open for Guests to read and I want to keep it that way, but I was wondering if there was a code I could use that would restrict it to only the members can view it when they are logged in. Its not that important that it be that way but I would like to make it like that if it is possible.

    Here is my HTML page, I am using Invision:

    http://runawayhorses.alldiscussion.net/h1-cbox


    Last edited by runawayhorses on September 8th 2012, 1:10 am; edited 1 time in total
    Sanket
    Sanket
    ForumGuru


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by Sanket September 5th 2012, 9:25 pm

    What if the guests don't have the link?

    Surprisingly, the page is not opening just with this.
    http://runawayhorses.alldiscussion.net/h1

    Earlier, it used to open.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 5th 2012, 10:45 pm

    Will that link you posted is not the entire URL this is:

    http://runawayhorses.alldiscussion.net/h1-cbox

    This is the URL to my forum index page:

    http://runawayhorses.alldiscussion.net/

    The link to the HTML page is in my nav bar but good point because its hidden from guests. Still I was wondering because someone could bookmark the HTML page. I don't necessarily care that much but would prefer only people logged in view it.


    That link you posted:

    http://runawayhorses.alldiscussion.net/h1

    doesn't go to anything there is not a page with that address.

    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 5th 2012, 11:09 pm

    Well I don't use the widgets and don't have the widgets activated. Sad
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 6th 2012, 1:35 am

    Sanket you getting confused, the shorthand link would be /h1-
    The dash is necessary. It's part of the regex in mod_rewrite.

    If you look at how I answered this: http://www.avacweb.com/t412-help-me
    You'd be able to apply it to do what you want, as long as you have header an footer activated for the HTML page.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 6th 2012, 12:55 pm

    I tried that LG and it didn't do anything, nothing showed anywhere, and yes I have the header and footer activated for the html page, and I logged out to test it. Even if it had worked it seems to me that code was supposed to add a login reminder to the entire forum (global variable) and I just want the html page blocked from view if you aren't logged in not the entire forum. The "Login popup" is for the entire forum and serves as a login reminder and I already been using that and have it activated.. Even at best that code wouldn't block the page from being viewed just add a login reminder message.

    That's my understanding of what that code would do had it worked, and I wouldn't want it applied to the entire forum just the html page. I have my entire forum open for guests to read, I want to keep it that way with the exception of the html page.

    On another note, if I wanted to block the entire forum from being viewed by guests I would simply make all the forums viewable for members only in AP>>Categories and forums>>Forum Permissions Control, by doing that the html page would require you login to view it as well. The reason I know that is because I used to have my forum set to be viewed by members only, that were of course logged in, and I had an html page and it wasn't accessible either unless you were logged in.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 6th 2012, 1:37 pm

    I just tried your suggestion Rideem and it didn't work, I could still access the page without being logged in.

    There is no reason to believe I would know how to manipulate the element using LG's code by needing to include a code similar to the one Rideem just posted, if I needed more code to make it work why wasn't it included? In any case it didn't work. I don't think it should be automatically assumed people know what to do with incomplete pieces of code. That's no reflection on anyone here, just making an observation, but if the shoe fits wear it. Topics would get solved in a more timely fashion if the complete code (answer) was given.

    thanks for trying.
    Sanket
    Sanket
    ForumGuru


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by Sanket September 7th 2012, 8:33 pm

    LGforum wrote:Sanket you getting confused, the shorthand link would be /h1-
    The dash is necessary. It's part of the regex in mod_rewrite.

    If you look at how I answered this: http://www.avacweb.com/t412-help-me
    You'd be able to apply it to do what you want, as long as you have header an footer activated for the HTML page.
    Yep, i forgot it was with the dash.

    I remember there was another thread where you had replied about this, but you didn't respond to me in that thread so i was confused on the issue whether it could be done or not. Thanks for clarifying.
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 7th 2012, 11:05 pm

    Well there is no complete code really, it depends what you want to do with it.
    I expected you to understand what you could do with that code, because well I said in the thread.

    What it does is provide a javascript variable, which is true if the user is logged in.
    So think about this:
    Code:
    if(USER_LOGGED_IN) {
      do this stufff...
    }
    else {
      do this stuff...
    }
    Now, even to someone who doesn't know any javascript, that's pretty clear what that small example snippet is saying surely.

    Now with that in mind... this code will keep guests off the HTML page:
    Code:
    <script>
    if(USER_LOGGED_IN) {
      // the user is logged in... they are allowed on the HTML page.
    }
    else {
      // the user is not logged in... redirect them.
      window.location = '/';
    }

    Hope that now makes sense.

    And Rideems code was an example, that's not what anyone expected you to do.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 8th 2012, 12:07 am

    Well its keeping the users off the html page even when they are logged in.

    In that thread I didn't see any mention of what to do other than add the code to the description. I just added the code above and like I said it keeps everyone off even when they are logged in. Oh well.
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 8th 2012, 12:16 am

    Well do you have the thing in your site description. When I look at you forum, I don't see it there.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 8th 2012, 12:18 am

    Yes I did have it in the site description when I tested it, and I added the code above to the HTML page, but I removed it all when it didn't work.
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 8th 2012, 12:26 am

    You give up very easily, for something pretty easy to achieve. Razz

    If you stick it back, I'll check why it might not have worked.

    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 8th 2012, 12:37 am

    I'm not giving up easily I just wanted to free up the page so it could be accessed. lol

    Ok, look now I added the codes back. Smile
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 8th 2012, 12:38 am

    Your missing the end script tag. Smile
    Well actually, I'm missing it. I forgot it in the code above. There should be a closing script tag at the end.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 8th 2012, 12:42 am

    There is an ending tag in there, here is the code I copied from the description:

    Code:
            <script>IS_LOGGED_IN=('Using php in posts is called being a smart [Language]... Stop it'!=='Guest')</script>
    :


    OH the HTML page..OK I'll go add it..lol

    Edit: OK I added the ending script tag </script> to the html page, and I logged out and tested it, and I can still access the html page.
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 8th 2012, 12:48 am

    Ha I must apologize. I've been a dope, and its something we both should have spotted.
    In the site description code I used 'IS_LOGGED_IN' and then in that code I used 'USER_LOGGED_IN'.

    They have to be the same, just change one of them so its the same the other.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 8th 2012, 12:55 am

    Yes it works now! Thank you very much LG I really appreciate it. Smile
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by LGforum September 8th 2012, 12:56 am

    Good. That variable can be used for many other things that involve doing something different for guests and members.
    avatar
    runawayhorses
    Hyperactive


    Male Posts : 2537
    Reputation : 166
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by runawayhorses September 8th 2012, 1:06 am

    That's cool, I might can find another use for it sometime, that's great. Sorry for getting irritated before I know it showed in my earlier posts in this topic, I was just getting frustrated I guess, my humble apologies. You're a genius in my book and I will always respect what you do. You're a good friend as well.

    Thanks a lot. Smile

    edit: I on the other-hand am not a genius, I had to correct the word "genius" I spelled it wrong.. lol
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Make an HTML page viewable to Registered members Only

    Post by SLGray September 8th 2012, 3:48 am

    Topic Solved & Locked



    Make an HTML page viewable to Registered members Only Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is November 11th 2024, 5:32 pm