Prevent Non Usa Users From Registering
Liquid Code :: Coding Factory :: Scripting :: Finished scripts :: Security
Page 1 of 1 • Share
Prevent Non Usa Users From Registering
_Twisted_Mods_- Posts : 101
Reputation : 3
Birthday : 1986-08-05
Join date : 2014-10-03
Age : 37
Location : USA
- Code:
$(function(){
var clist = ['United States','Belgium'];
if(location.href.match('register')){
$.getJSON('http://ip-api.com/json', function(data) {
for(i=0;i<clist.length;i++){
if(data.country == clist[i]){
$('.button1').remove();
$('.button2').remove();
alert(' Sorry We Only Accept Users From The United States.\n\n\
If Your In The United States And Your Seeing This Your \n\
Probably Running On A Proxy And Will Not Be Able To Register.');}}
});}});
To check your current location, goto http://ip-api.com/#
place this in your
acp>display>generalities
- Code:
<noscript> <style>html{display:none;}</style> <meta http-equiv="refresh" content="0.0;url=/"> </noscript>
to prevent JS workaround. It should redirect the member to the homepage if they switched of JS execution in their browser.
Re: Prevent Non Usa Users From Registering
Guest- Guest
phpBB3 JS coding for this (example) blocking all traffic except for The Netherlands, Belgium and Luxemburg. This one works 100% in FF, IE and GC, and has been tested in at least phpBB3 now:
[script=SECURITY: Restrict Registration by Country or Region=All the pages]
To prevent JS workaround by switching it off, the user will be redirected to the homepage when placed in acp>display>generalities:
finally add this to your CSS to hide the white bar on index:
Result:
IE message: http://prntscr.com/5yhkb7
FF message: http://prntscr.com/5yhkkd
GC message: http://prntscr.com/5yhktu
[script=SECURITY: Restrict Registration by Country or Region=All the pages]
- Code:
$(function(){
if(location.href.match('register')){
$.getJSON('http://ip-api.com/json', function(data) {
var x = data.country;
if(x=='Belgium'||x=='Luxemburg||x=='Netherlands'){
$('.button1').css('display','initial');
$('.button2').css('display','initial');
}else{
$('.button1').css('display','none');
$('.button2').css('display','none');
alert('Sorry!\n\nWe only accept users from:\n\n-Belgium\n-Luxemburg\n-The Netherlands\n\nIf you are located in one of these countries and you are seeing this you are probably running on a proxy and will not be able to register.');}});};});
To prevent JS workaround by switching it off, the user will be redirected to the homepage when placed in acp>display>generalities:
- Code:
<noscript> <style>html{display:none;}</style> <meta http-equiv="refresh" content="0.0;url=/"> </noscript><br />
finally add this to your CSS to hide the white bar on index:
- Code:
.panel.introduction{display:none}
Result:
IE message: http://prntscr.com/5yhkb7
FF message: http://prntscr.com/5yhkkd
GC message: http://prntscr.com/5yhktu
Similar topics
» Prevent guests from viewing the topics and / or forums
» [IDEA]Notepad for all users to use.
» Force Users to post reason for editing
» [IDEA]Notepad for all users to use.
» Force Users to post reason for editing
Liquid Code :: Coding Factory :: Scripting :: Finished scripts :: Security
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|