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.

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

View previous topic View next topic Go down

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

Post by AlexisMcDevin on 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
Forumember

Male Posts : 133
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 on December 28th 2014, 4:32 pm

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


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


SLGray
Administrator
Administrator

Male Posts : 36619
Reputation : 2439
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

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

Post by AlexisMcDevin on 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
Forumember

Male Posts : 133
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 on December 28th 2014, 7:13 pm

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


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


SLGray
Administrator
Administrator

Male Posts : 36619
Reputation : 2439
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

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

Post by _Twisted_Mods_ on 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_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on 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
Forumember

Male Posts : 133
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_ on 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_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on 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
Forumember

Male Posts : 133
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_ on 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_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on 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
Forumember

Male Posts : 133
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_ on 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_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on 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.


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


SLGray
Administrator
Administrator

Male Posts : 36619
Reputation : 2439
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

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

Post by _Twisted_Mods_ on 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_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on 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
Forumember

Male Posts : 133
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 on December 29th 2014, 11:16 pm

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

Regards
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_ on December 29th 2014, 11:39 pm

should work for all versions

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on December 30th 2014, 12:06 am

@_Twisted_Mods_ Thank you sir!

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 on December 30th 2014, 4:42 pm

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




APE
Manager
Manager

Male Posts : 8598
Reputation : 748
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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 on December 30th 2014, 4:54 pm

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

AlexisMcDevin
Forumember

Male Posts : 133
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 on December 30th 2014, 5:00 pm

Thank you @AlexisMcDevin
Topic solved and archived

Happy New year to you Wink




APE
Manager
Manager

Male Posts : 8598
Reputation : 748
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

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