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.

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

5 posters

Go down

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

Post by AlexisMcDevin December 28th 2014, 1:18 pm

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 December 30th 2014, 1:57 pm; edited 2 times in total
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by SLGray December 28th 2014, 4:32 pm

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51568
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by AlexisMcDevin December 28th 2014, 4:48 pm

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?
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by SLGray December 28th 2014, 7:13 pm

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51568
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by _Twisted_Mods_ December 28th 2014, 8:33 pm

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

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

http://liquidcode.forumotion.com

Back to top Go down

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

Post by AlexisMcDevin December 28th 2014, 8:35 pm

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.
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by _Twisted_Mods_ December 29th 2014, 12:36 am

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';
};
    }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
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

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

http://liquidcode.forumotion.com

Back to top Go down

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

Post by AlexisMcDevin December 29th 2014, 2:17 am

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.
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by _Twisted_Mods_ December 29th 2014, 2:22 am

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';
    };
        }else{
        lastur = my_getcookie("mylasturl");
        if (lastur == ""){}else{
              location.href=lastur;
    my_setcookie("mylasturl","");
            };
        };
    });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

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

http://liquidcode.forumotion.com

Back to top Go down

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

Post by AlexisMcDevin December 29th 2014, 2:47 am

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.
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by _Twisted_Mods_ December 29th 2014, 3:03 am

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';
        };
            }else{
            lastur = my_getcookie("mylasturl");
            if (lastur == ""){}else{
                  location.href=lastur;
        my_setcookie("mylasturl","", 10000);
                };
            };
        });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

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

http://liquidcode.forumotion.com

Back to top Go down

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

Post by SLGray December 29th 2014, 3:33 am

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51568
Reputation : 3525
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by _Twisted_Mods_ December 29th 2014, 3:42 am

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
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

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

http://liquidcode.forumotion.com

Back to top Go down

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

Post by AlexisMcDevin December 29th 2014, 5:56 am

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.
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by FrOsTyXi December 29th 2014, 11:16 pm

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

Regards
FrOsTyXi
FrOsTyXi
FrOsTyXi
Forumember

Male Posts : 460
Reputation : 12
Language : english

http://team-psn.forum-board.net/

Back to top Go down

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

Post by _Twisted_Mods_ December 29th 2014, 11:39 pm

should work for all versions
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

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

http://liquidcode.forumotion.com

Back to top Go down

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

Post by FrOsTyXi December 30th 2014, 12:06 am

@_Twisted_Mods_ Thank you sir!
FrOsTyXi
FrOsTyXi
Forumember

Male Posts : 460
Reputation : 12
Language : english

http://team-psn.forum-board.net/

Back to top Go down

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

Post by Ape December 30th 2014, 4:42 pm

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
Ape
Ape
Administrator
Administrator

Male Posts : 19450
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

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

Post by AlexisMcDevin December 30th 2014, 4:54 pm

@APE. Yes, sir! I got everything I need!
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

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

Post by Ape December 30th 2014, 5:00 pm

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
Ape
Ape
Administrator
Administrator

Male Posts : 19450
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

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