Need help to limit the view (times) number of visitors Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
5 posters

    Need help to limit the view (times) number of visitors

    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Sun 28 Dec 2014 - 13:18

    As per the topic title, I want to limit view number of guest. Once the view number out of limit, visitor have to register account. However, after visiters register and login completed, they can be continue to read the topic that they are reading before.

    Please help me these.

    My forum is phpBB3 and link to on my profile.


    Thank you!
    Alex.


    Last edited by AlexisMcDevin on Tue 30 Dec 2014 - 13:57; edited 2 times in total
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51446
    Reputation : 3521
    Language : English
    Location : United States

    Solved Re: Need help to limit the view (times) number of visitors

    Post by SLGray Sun 28 Dec 2014 - 16:32

    Do you mean that you want guests to not see the posts?



    Need help to limit the view (times) number of visitors Slgray10

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


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Re: Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Sun 28 Dec 2014 - 16:48

    SLGray wrote:Do you mean that you want guests to not see the posts?

    I mean that Guest only can view and read info. in my forum a few times (may be ten times). After that, they must be register and login to read more information in my forum.

    Is it clear my request?
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51446
    Reputation : 3521
    Language : English
    Location : United States

    Solved Re: Need help to limit the view (times) number of visitors

    Post by SLGray Sun 28 Dec 2014 - 19:13

    I do not know if there is a way to achieve this.



    Need help to limit the view (times) number of visitors Slgray10

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


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: Need help to limit the view (times) number of visitors

    Post by _Twisted_Mods_ Sun 28 Dec 2014 - 20:33

    you could count the post they have navigated to but if they refresh the page it would still count as another view
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Re: Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Sun 28 Dec 2014 - 20:35

    Hi all,

    I need someone really well to corect below code. I think that my requests will be solved.

    - This code will be the viewing quantity limitation of visitor (guest) in our forum. I mean that how many times we will allow the visitor read topic (please noted that at the moment visitor is guest (have not yet a member of forum)? Time will be count down.
    Code:
    $(function(){
        if($("#logout").length<1) {
            count = parseInt(my_getcookie("count")) || 0;
            count < 0?my_setcookie("count",++count):location.href='URL login page';
        }
    });

    - This code may be used for: After visitor already completed regiter and then login to forum, they can be continue read the last topic that they were reading before.
    Code:
    function getParameter(name) { // function use parameters
        name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
        var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
            results = regex.exec(location.search);
        return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    getParameter('url') // return www.google.com

    I do not know how to make these codes work. So, I hope you can do that.
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: Need help to limit the view (times) number of visitors

    Post by _Twisted_Mods_ Mon 29 Dec 2014 - 0:36

    Code:
    $(function(){
            var x = "/login /register";
        var y = x.split(" ");
    for (var i = 0; i < y.length; i++) {
           if (window.location.pathname == y[i]) return;     
    };


        if(_userdata.session_logged_in <= 0) {
           
            count = parseInt(my_getcookie("count")) || 0;
            if(count < 10){
                my_setcookie("count",++count);
               
            }else{
                  
                      var hhh = location.href;
         my_setcookie("mylasturl",hhh);
               location.href='/login?theme_id=185730';
    };
        }else{
        lastur = my_getcookie("mylasturl");
        if (lastur == ""){}else{
               location.href=lastur;
    my_setcookie("mylasturl","");
            };
        };
    });


    change the 10 in

    Code:
     
     if(count < 10){



    to set the view count
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Re: Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Mon 29 Dec 2014 - 2:17

    Haha, you are my guy!!! Your code worked very well!

    After I applied this code, at the login time, the address bar of browser inform: "http://ccxiqi.forumvi.com/null" in a few seconds, and then link to my forum.

    Can I request one more thing?

    I really need to get a small board (pop-up) to notice (inform) to visitor (guest) that they are over the viewing quantity limitation on our forum, please login or register to use all the funtions of our forum. Something like my description. I will change text in our language.

    If we do not have this notice, they will not know why they have been kicked out.

    I am looking forward to receiving your response soon.

    Thank you!
    Alex.
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: Need help to limit the view (times) number of visitors

    Post by _Twisted_Mods_ Mon 29 Dec 2014 - 2:22

    Code:
        $(function(){
    themsg = "You Have Reached The View Limit You Must Signup To Continue Viewing";
                var x = "/login /register";
            var y = x.split(" ");
        for (var i = 0; i < y.length; i++) {
              if (window.location.pathname == y[i]) return;   
        };


            if(_userdata.session_logged_in <= 0) {
             
                count = parseInt(my_getcookie("count")) || 0;
                if(count < 10){
                    my_setcookie("count",++count);
                 
                }else{
                      alert(themsg);
                          var hhh = location.href;
            my_setcookie("mylasturl",hhh);
                  location.href='/login?theme_id=185730';
        };
            }else{
            lastur = my_getcookie("mylasturl");
            if (lastur == ""){}else{
                  location.href=lastur;
        my_setcookie("mylasturl","");
                };
            };
        });
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Re: Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Mon 29 Dec 2014 - 2:47

    This code also working really good! You are the best!

    I just find out one more thing that we have to improve. Once the visitor gone out of the viewing quantity limitation, the notice board turn on however, if the visitor turn off their browser and then turn on it, they will have 10 times to review our forum again.

    In this case, I think that we should control IP address from visitor to get the best way.

    Please let me know your thoughts. Can you find other ways to get this thing done.

    Thank you!
    Alex.
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: Need help to limit the view (times) number of visitors

    Post by _Twisted_Mods_ Mon 29 Dec 2014 - 3:03

    try this idk if it will work i didnt test it

    Code:
          $(function(){
        themsg = "You Have Reached The View Limit You Must Signup To Continue Viewing";
                    var x = "/login /register";
                var y = x.split(" ");
            for (var i = 0; i < y.length; i++) {
                  if (window.location.pathname == y[i]) return; 
            };


                if(_userdata.session_logged_in <= 0) {
               
                    count = parseInt(my_getcookie("count")) || 0;
                    if(count < 10){
                        my_setcookie("count",++count, 10000);
                   
                    }else{
                          alert(themsg);
                              var hhh = location.href;
                my_setcookie("mylasturl",hhh, 10000);
                      location.href='/login?theme_id=185730';
            };
                }else{
                lastur = my_getcookie("mylasturl");
                if (lastur == ""){}else{
                      location.href=lastur;
            my_setcookie("mylasturl","", 10000);
                    };
                };
            });
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51446
    Reputation : 3521
    Language : English
    Location : United States

    Solved Re: Need help to limit the view (times) number of visitors

    Post by SLGray Mon 29 Dec 2014 - 3:33

    I do not know if you can control guests you erase their histories and  caches with a code.

    Also guests can turn off JavaScript in their browsers.



    Need help to limit the view (times) number of visitors Slgray10

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


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: Need help to limit the view (times) number of visitors

    Post by _Twisted_Mods_ Mon 29 Dec 2014 - 3:42

    only way to by pass it would be to delete cookies.. because you can still setup a noscript to redirect to login page if their javascript is off
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Re: Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Mon 29 Dec 2014 - 5:56

    It may not good with you all, however it is good enough with me. If visitors have to delete cookie all time to view my forum, it will take long time more than they registor an account in my forum.

    So, if you have any better ideas, I am really happy on this. If not, this topic should be closed.  Solved!

    Thank you very much!
    Alex.
    FrOsTyXi
    FrOsTyXi
    Forumember


    Male Posts : 460
    Reputation : 12
    Language : english

    Solved Re: Need help to limit the view (times) number of visitors

    Post by FrOsTyXi Mon 29 Dec 2014 - 23:16

    @_Twisted_Mods_ Will this code work on a punbb forum set?

    Regards
    FrOsTyXi
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: Need help to limit the view (times) number of visitors

    Post by _Twisted_Mods_ Mon 29 Dec 2014 - 23:39

    should work for all versions
    FrOsTyXi
    FrOsTyXi
    Forumember


    Male Posts : 460
    Reputation : 12
    Language : english

    Solved Re: Need help to limit the view (times) number of visitors

    Post by FrOsTyXi Tue 30 Dec 2014 - 0:06

    @_Twisted_Mods_ Thank you sir!
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19261
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Need help to limit the view (times) number of visitors

    Post by Ape Tue 30 Dec 2014 - 16:42

    Is this problem now solved as it marked as solved on the icon ?



    Need help to limit the view (times) number of visitors Left1212Need help to limit the view (times) number of visitors Center11Need help to limit the view (times) number of visitors Right112
    Need help to limit the view (times) number of visitors Ape_b110
    Need help to limit the view (times) number of visitors Ape1010
    AlexisMcDevin
    AlexisMcDevin
    Forumember


    Male Posts : 134
    Reputation : 5
    Language : English

    Solved Re: Need help to limit the view (times) number of visitors

    Post by AlexisMcDevin Tue 30 Dec 2014 - 16:54

    @APE. Yes, sir! I got everything I need!
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19261
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Need help to limit the view (times) number of visitors

    Post by Ape Tue 30 Dec 2014 - 17:00

    Thank you @AlexisMcDevin
    Topic solved and archived

    Happy New year to you Wink



    Need help to limit the view (times) number of visitors Left1212Need help to limit the view (times) number of visitors Center11Need help to limit the view (times) number of visitors Right112
    Need help to limit the view (times) number of visitors Ape_b110
    Need help to limit the view (times) number of visitors Ape1010