X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Findex.php;h=6e45cb0e8a0c06b7e5928f7868517bc59f62f288;hb=8b9c2b3ec59baef7c9f64f9663347bc5b9cf69fe;hp=9a7665b1e27d58c6724c90aad0b8ab32ad8afa78;hpb=03002883141b5e751650f5a28812456c2aa5f054;p=brisk.git diff --git a/web/index.php b/web/index.php index 9a7665b..6e45cb0 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") { @@ -372,7 +381,7 @@ function index_main(&$brisk, $transp_type, &$header_out, $addr, $get, $post, $co $tables .= '
'; $tables .= ''; for ($ii = 0 ; $ii < TABLES_N ; $ii++) { - if ($user->flags & USER_FLAG_AUTH) + if ($user->is_auth()) $i = $ii; else $i = TABLES_N - $ii - 1; @@ -807,7 +816,7 @@ google_color_url = "000000"; // MLANG garantisci .$mlang_room['tit_splash'][$G_lang]. '
-'.($user->flags & USER_FLAG_AUTH ? ' +'.($user->is_auth() ? '