From f8ae81cef2871be97c5466319efbafb23599baac Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sun, 17 Mar 2013 16:40:23 +0100 Subject: [PATCH] pre-merge into master --- INSTALL.sh | 2 +- web/Obj/brisk.phh | 4 +++- web/briskin5/Obj/briskin5.phh | 2 ++ web/briskin5/index_wr.php | 13 ++++++++++++- web/index_wr.php | 7 ++++++- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/INSTALL.sh b/INSTALL.sh index 65074c8..a44e319 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -3,7 +3,7 @@ # # Defaults # -CONFIG_FILE="$HOME/.brisk_spu_install" +CONFIG_FILE="$HOME/.brisk_install" apache_conf="/etc/apache2/sites-available/default" players_n=3 diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 90df86f..6bdcb84 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -141,7 +141,7 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi', $G_lng = langtolng($G_lang); $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 ); -$G_brisk_version = "4.7.4"; +$G_brisk_version = "4.8.0"; /* MLANG: ALL THE INFO STRINGS IN brisk.phh */ $root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), NOVITA\': prova il nuovo azioni->preferenze.', @@ -2297,6 +2297,8 @@ class Room function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie) { + GLOBAL $G_black_list; + printf("NEW_SOCKET (root): %d PATH [%s]\n", intval($new_socket), $path); $enc = get_encoding($header); diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 008d85c..10edf1b 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -1153,6 +1153,8 @@ class Bin5 { static function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie) { + GLOBAL $G_black_list; + printf("NEW_SOCKET (root): %d\n", intval($new_socket)); $enc = get_encoding($header); diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 9f9764f..98fd79b 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -40,10 +40,15 @@ require_once("Obj/briskin5.phh"); */ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) { - GLOBAL $G_base, $G_dbasetype; + GLOBAL $G_base, $G_dbasetype, $G_black_list; $remote_addr = addrtoipv4($remote_addr_full); + if (array_search($remote_addr, $G_black_list) !== FALSE) { + // TODO: waiting async 5 sec before close + return (FALSE); + } + $curtime = time(); if ($bri == NULL) { return FALSE; @@ -71,6 +76,12 @@ function bin5_index_wr_main(&$bri, $remote_addr_full, $get, $post, $cookie) log_wr("Get User Error"); return FALSE; } + + if (array_search($user->ip, $G_black_list) !== FALSE) { + // TODO: waiting async 5 sec before close + return (FALSE); + } + $argz = explode('|', $mesg); log_wr('POSTSPLIT: '.$argz[0].' user->stat: ['.$user->stat.']'); diff --git a/web/index_wr.php b/web/index_wr.php index 8571c76..5b05c68 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -105,7 +105,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) /* if the IP is banned, exit without do nothing */ if (array_search($remote_addr, $G_black_list) !== FALSE) { - sleep(5); + // TODO: find a way to add a nonblocking sleep(5) here return (FALSE); } @@ -199,6 +199,11 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) // LACC UPDATED $user->lacc = $curtime; + if (array_search($user->ip, $G_black_list) !== FALSE) { + // TODO: find a way to add a nonblocking sleep(5) here + return (FALSE); + } + if ($argz[0] == 'ping') { log_wr("PING RECEIVED"); } -- 2.17.1