X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex.php;h=11694ca83ef9f0064f183554bc8edaae257b12cf;hb=14cd1fc05b5d9148de3c427e43bf60cfdf098e9d;hp=6ee1d74fc6b53773e161c13af4d371c8a3498d93;hpb=ef707202db0efb1094bac1ad7e2f1a656be252c0;p=brisk.git diff --git a/web/index.php b/web/index.php index 6ee1d74..11694ca 100644 --- a/web/index.php +++ b/web/index.php @@ -237,7 +237,7 @@ function poll_dom() { return ''; } -function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $cookie) +function index_main(&$brisk, $transp_type, &$header_out, $remote_addr_full, $get, $post, $cookie) { GLOBAL $G_with_donors, $G_donors_cur, $G_donors_all; GLOBAL $G_with_topbanner, $G_topbanner, $G_is_local; @@ -258,8 +258,10 @@ function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $co if (($table_token = gpcs_var('table_idx', $get, $post, $cookie)) === FALSE) unset ($table_token); + $remote_addr = addrtoipv4($remote_addr_full); + // Use of proxies isn't allowed. - if (!$G_is_local && is_proxy($addr)) { + if (!$G_is_local && is_proxy($remote_addr)) { return FALSE; } @@ -298,15 +300,22 @@ function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $co if ($ACTION == "login" && isset($name)) { log_main("pre garbage_manager DUE"); - if (isset($pass_private) == FALSE) { + if (isset($pass_private) == FALSE || $pass_private == "") { $pass_private = FALSE; + + $banned = FALSE; + if ($brisk->ban_check($remote_addr)) { + // TODO: find a way to add a nonblocking sleep(5) here + $banned = TRUE; + $idx = -1; + } } $brisk->garbage_manager(TRUE); /* try login */ - $ipv4addr = addrtoipv4($addr); - if (($user = $brisk->add_user(&$sess, &$idx, $name, $pass_private, $ipv4addr, $cookie)) != FALSE) { + if ($banned == FALSE && + ($user = $brisk->add_user(&$sess, &$idx, $name, $pass_private, $remote_addr, $cookie)) != FALSE) { $brisk->sess_cur_set($user->sess); $ACTION = "room"; if ($idx < 0) { @@ -314,7 +323,7 @@ function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $co $is_login = TRUE; } - log_legal($curtime, $ipv4addr, $user, "STAT:LOGIN", ''); + log_legal($curtime, $remote_addr, $user, "STAT:LOGIN", ''); // recovery lost game if ($user->stat == "table") { @@ -373,7 +382,7 @@ function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $co $tables .= ''; for ($ii = 0 ; $ii < TABLES_N ; $ii++) { if ($user->flags & USER_FLAG_AUTH) - $i = $ii; + $i = $ii; else $i = TABLES_N - $ii - 1; @@ -888,6 +897,7 @@ supported by:
var g_lng = ""; var g_tables_n = ; var g_tables_auth_n = ; + var g_tables_cert_n = ; var g_prefs, g_prefs_new = null; var g_listen; var g_withflash = false; @@ -1046,6 +1056,7 @@ echo "$body"; ?> var g_lng = ""; var g_tables_n = ; var g_tables_auth_n = ; + var g_tables_cert_n = ; var g_prefs, g_prefs_new = null; var g_listen; var g_is_spawn = 0;