<?php
+if (file_exists("$DOCUMENT_ROOT/Etc/provider_proxy.phh")) {
+ require_once("$DOCUMENT_ROOT/Etc/provider_proxy.phh");
+}
+else {
+ $G_provider_proxy = array();
+}
+
// G_dbasetype value can be "pgsql" or "file"
$G_dbasetype="pgsql";
return 0;
}
+// return string with IPV4 address
function addrtoipv4($addr)
{
$ipv4addr_arr = explode(':' , $addr);
return ($this->black_list->check($ip_str));
}
- function pproxy_realip($ip_str)
+ function pproxy_realip($header, $ip_str)
{
- return ($this->provider_proxy->realip($ip_str));
+ return ($this->provider_proxy->realip($header, $ip_str));
}
function users_cleanup()
function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
{
- GLOBAL $G_ban_list, $G_black_list;
+ GLOBAL $G_ban_list, $G_black_list, $G_provider_proxy;
printf("NEW_SOCKET (root): %d PATH [%s]\n", intval($new_socket), $path);
// $remote_addr = addrtoipv4($addr);
- $remote_addr = $this->pproxy_realip(addrtoipv4($addr));
+ $remote_addr = $this->pproxy_realip($header, addrtoipv4($addr));
fprintf(STDERR, "\n\n\n PRE_BLACK_CHECK \n\n\n");
if ($this->black_check($remote_addr)) {
// TODO: waiting async 5 sec before close
- fprintf(STDERR, "\n\n\n BLACK_CHECK \n\n\n");
+ fprintf(STDERR, "\n\n\n BLACK CHECK\n\n\n");
return (FALSE);
}
require_once("${G_base}Obj/ipclass.phh");
-$G_pproxy = array( "samosa" => array("headitem" => "X-Forwarded-For",
- "ipclass" => array("107.178.33.0/24",
- "107.178.34.0/24",
- "107.178.35.0/24",
- "107.178.37.0/24",
- "107.178.38.0/24",
- "107.178.39.0/24",
- "107.178.41.0/24",
- "107.178.42.0/24",
- "107.178.43.0/24",
- "107.178.45.0/24",
- "107.178.46.0/24",
- "107.178.47.0/24",
- "206.173.221.0/24") ),
- "mytest" => array("headitem" => "X-Forwarded-For",
- "ipclass" => array("192.168.2.3/24") )
- );
-
class ProviderProxyItem
{
var $name;
function clean()
{
if ($this->pp != NULL) {
- foreach ($this->pp as $pp_name) {
- unset($this->pp[$pp_name]);
+ foreach ($this->pp as $pp_key => $pp_value) {
+ fprintf(STDERR, "PHP PPN: %s\n", $pp_key);
+ unset($this->pp[$pp_key]);
}
unset($this->pp);
$this->pp = NULL;
$this->clean();
$this->pp = array();
- foreach ($pproxy as $pp_name => $pp_descr) {
- $this->pp[$pp_name] = new ProviderProxyItem($pp_name, $pp_descr);
+ foreach ($pproxy as $pp_key => $pp_value) {
+ $this->pp[$pp_key] = new ProviderProxyItem($pp_key, $pp_value);
}
}
- function realip($headers, $ip)
+ function realip($header, $ip)
{
if ($this->pp != NULL) {
foreach ($this->pp as $pp_name => $pp_item) {
- if ($pp_item->match($ip)) {
- if (isset($headers[$pp_item->headitem])) {
- fprintf(STDERR, "Match public proxy [%s]\n", $pp_name);
- return ($headers[$pp_item->headitem]);
+ if ($pp_item->ipclass->check($ip)) {
+ if (isset($header[$pp_item->headitem])) {
+ fprintf(STDERR, "Match public proxy [%s][%s]\n", $pp_name, $header[$pp_item->headitem]);
+ return ($header[$pp_item->headitem]);
}
}
}
{
GLOBAL $DOCUMENT_ROOT, $HTTP_HOST;
- GLOBAL $G_alarm_passwd, $G_ban_list, $G_black_list, $G_btrace_pref_sub, $G_dbauth;
+ GLOBAL $G_alarm_passwd, $G_ban_list, $G_black_list, $G_provider_proxy;
+ GLOBAL $G_btrace_pref_sub, $G_dbauth;
GLOBAL $G_dbpfx, $G_donors_all, $G_donors_cur, $G_is_local, $G_lang;
GLOBAL $G_poll_entries, $G_poll_name, $G_poll_title, $G_proxy_white_list;
GLOBAL $G_room_roadmap, $G_shutdown;
$line = trim($buf);
if ($line == "reload") {
require("$DOCUMENT_ROOT/Etc/".BRISK_CONF);
- $this->app->reload(FALSE, $G_ban_list, $G_black_list);
+ $this->app->reload(FALSE, $G_ban_list, $G_black_list,
+ $G_provider_proxy);
global_dump();
}
else if ($line == "shutdown" || $line == "sd") {
span.au2 {
background-color: #bafcba;
}
+
+div.bye_msg {
+ font-weigth: bold;
+}
\ No newline at end of file
require_once("Obj/auth.phh");
require_once("Obj/proxyscan.phh");
-$mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati.',
- 'en' => 'Wrong user and/or password.'),
- 'userpassmust' => array('it' => 'Il nickname deve contenere almeno una lettera o una cifra.',
- 'en' => 'The nickname have to contain at least one letter or one number.'),
+$mlang_room = array( 'userpassuse' => array('it' => 'Il tuo nickname è già in uso.',
+ 'en' => 'Your nickname is already in use.'),
'userpassend' => array('it' => 'Spiacenti, non ci sono più posti liberi. Riprova più tardi.',
'en' => 'We are sorry, there aren\'t free place. Try again later.'),
- 'userpassuse' => array('it' => 'Il tuo nickname è già in uso.',
- 'en' => 'Your nickname is already in use.'),
+ 'userpassmust' => array('it' => 'Il nickname deve contenere almeno una lettera o una cifra.',
+ 'en' => 'The nickname have to contain at least one letter or one number.'),
+ 'userpasserr' => array('it' => 'Utente e/o password errati.',
+ 'en' => 'Wrong user and/or password.'),
+ 'userpassban' => array('it' => 'Il tuo indirizzo IP è stato bannato perché precedentemente utilizzato da qualche molestatore.',
+ 'en' => 'Your IP address is banned because trolling activity was detected from it.'),
'standing' => array('it' => 'Giocatori in piedi',
'en' => 'Standing players'),
'headline' => array('it' => 'briscola chiamata in salsa ajax',
'en' => 'EN L\' accesso attraverso sistemi di anonimizzazione non è consentito.'),
'reas_anot' => array('it' => 'La tua sessione è stata assegnata ad un altro browser.',
'en' => 'EN La tua sessione è stata assegnata ad un altro browser.'),
+ 'reas_cloud' => array('it' => 'La connessione dai computer di una cloud non è ammessa.',
+ 'en' => 'Connection from cloud computers is not allowed.'),
+
'btn_enter' => array('it' => 'entra',
'en' => 'enter'),
'passwarn' => array('it' => 'Se non hai ancora una password, lascia il campo in bianco ed entra.',
$standup = "";
$ACTION = "login";
$last_msg = "";
+ $banned = FALSE;
if (isset($BRISK_SHOWHTML) == FALSE) {
$is_table = FALSE;
}
}
}
-
- $banned = FALSE;
- if ($ACTION == "login" && isset($name)) {
+ if (!$banned && $ACTION == "login" && isset($name)) {
log_main("pre garbage_manager DUE");
if (isset($pass_private) == FALSE || $pass_private == "") {
if ($brisk->ban_check($remote_addr)) {
// TODO: find a way to add a nonblocking sleep(5) here
$banned = TRUE;
- $idx = -1;
+ $idx = -4;
}
}
}
}
else {
+ fprintf(STDERR, "POST CHECK QUI\n");
/* Login Rendering */
- if ($idx == -3)
+ switch($idx) {
+ case -4:
+ $sfx = 'ban';
+ break;
+ case -3:
$sfx = 'err';
- else if ($idx == -2)
+ break;
+ case -2:
$sfx = 'must';
- else if ($idx == -1)
+ break;
+ case -1:
$sfx = 'end';
- else
+ break;
+ default:
$sfx = 'use';
+ }
$body .= '<div class="urgmsg"><b>'.$mlang_room['userpass'.$sfx][$G_lang].'</b></div>';
}
cursor: pointer;
margin-top:4px;
}
+
function main($argv)
{
- GLOBAL $G_ban_list, $G_black_list, $G_prov_proxy;
+ GLOBAL $G_ban_list, $G_black_list, $G_provider_proxy;
pid_save();
do {
- if (($brisk = Brisk::create(LEGAL_PATH."/brisk-crystal.data", $G_ban_list, $G_black_list, $G_prov_proxy)) == FALSE) {
+ if (($brisk = Brisk::create(LEGAL_PATH."/brisk-crystal.data", $G_ban_list, $G_black_list, $G_provider_proxy)) == FALSE) {
log_crit("Brisk::create failed");
$ret = 1;
break;