heartles39
Fanatic member
Hello
I don’t want some countries to log in to my Teaspeak server. How can I prevent them?
I don’t want some countries to log in to my Teaspeak server. How can I prevent them?
Last edited:
<?php
require("ts3admin.class.php");
// Ignorowane grupy / Ignore groups
$ignorowana_grupa = 69;
$powod_kicka = "Wykryto VPN. Wyjdź z VPN żeby móc korzystać normalnie z serwera."; // Kick Information
$login_query = "serveradmin"; //login query
$haslo_query = "123456789"; //password query
$adres_ip = "127.0.0.1"; //address ip server
$query_port = "10011"; //port query
$port_serwera = "9987"; //server port
$nazwa_bota = "VPN_GUARD"; //name bot
$ts = new ts3Admin($adres_ip, $query_port);
if(!$ts->getElement('success', $ts->connect())) {
die("Brak polaczenia z serwerem..");
}
$ts->login($login_query, $haslo_query);
$ts->selectServer($port_serwera);
$ts->setName($nazwa_bota);
while(true) {
sleep(1);
$clientList = $ts->clientList("-ip -groups");
foreach($clientList['data'] as $val) {
$groups = explode(",", $val['client_servergroups'] );
if(in_array($ignorowana_grupa, $groups) || ($val['client_type'] == 1)) {
continue;
}
$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4');
$file = json_decode($file, true);
if($file['proxy'] == 1) {
$ts->clientKick($val['clid'], "server", $powod_kicka);
}
}
}
?>
$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4');
too $file = file_get_contents('http://ip-api.com/json/'.$val['connection_client_ip']);
if($file['proxy'] == 1) {
too if($file['country'] == "Canada") {
I think its not a good way. Its better block directly in firewall i think.You can use this php script, you can modify it to block certain countries easily
.
Normally change this line to =>>PHP:<?php require("ts3admin.class.php"); // Ignorowane grupy / Ignore groups $ignorowana_grupa = 69; $powod_kicka = "Wykryto VPN. Wyjdź z VPN żeby móc korzystać normalnie z serwera."; // Kick Information $login_query = "serveradmin"; //login query $haslo_query = "123456789"; //password query $adres_ip = "127.0.0.1"; //address ip server $query_port = "10011"; //port query $port_serwera = "9987"; //server port $nazwa_bota = "VPN_GUARD"; //name bot $ts = new ts3Admin($adres_ip, $query_port); if(!$ts->getElement('success', $ts->connect())) { die("Brak polaczenia z serwerem.."); } $ts->login($login_query, $haslo_query); $ts->selectServer($port_serwera); $ts->setName($nazwa_bota); while(true) { sleep(1); $clientList = $ts->clientList("-ip -groups"); foreach($clientList['data'] as $val) { $groups = explode(",", $val['client_servergroups'] ); if(in_array($ignorowana_grupa, $groups) || ($val['client_type'] == 1)) { continue; } $file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4'); $file = json_decode($file, true); if($file['proxy'] == 1) { $ts->clientKick($val['clid'], "server", $powod_kicka); } } } ?>
I'm sorry I don't have a server to tryPHP:$file = file_get_contents('http://iphub.info/api.php?ip='.$val['connection_client_ip'].'&showtype=4'); too $file = file_get_contents('http://ip-api.com/json/'.$val['connection_client_ip']); if($file['proxy'] == 1) { too if($file['country'] == "Canada") {
for the best result and the best solution is to use a frontend firewall with country IP addresses . you can open/close any country you want on itHello
I don’t want some countries to log in to my Teaspeak server. How can I prevent them?
I could not. Do you have a video?for the best result and the best solution is to use a frontend firewall with country IP addresses . you can open/close any country you want on it
with a mikrotik(RouterOS) as frontend firewall on your VPS you can do mostly anything you want
this things does not have video tutorialI could not. Do you have a video?