5 * Copyright (C) 2014 Matteo Nastasi
6 * mailto: nastasi@alternativeoutput.it
7 * matteo.nastasi@milug.org
8 * web: http://www.alternativeoutput.it
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details. You should have received a
19 * copy of the GNU General Public License along with this program; if
20 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21 * Suite 330, Boston, MA 02111-1307, USA.
27 $mlang_stat_day = array( 'normal match'=> array( 'it' => 'Partite normali',
28 'en' => 'Normal matches' ),
29 'special match' => array( 'it' => 'Partite speciali',
30 'en' => 'Special matches'),
32 'info_total'=> array( 'it' => 'totali',
36 ini_set("max_execution_time", "240");
38 require_once($G_base."Obj/brisk.phh");
39 require_once($G_base."Obj/user.phh");
40 require_once($G_base."Obj/auth.phh");
41 require_once($G_base."Obj/dbase_${G_dbasetype}.phh");
42 require_once($G_base."briskin5/Obj/briskin5.phh");
43 require_once($G_base."briskin5/Obj/placing.phh");
44 require_once($G_base."spush/brisk-spush.phh");
48 GLOBAL $G_alarm_passwd, $sess, $_POST, $_SERVER;
52 $ip = $_SERVER["REMOTE_ADDR"];
54 $private = md5($G_alarm_passwd.$ip.$sess);
55 $cmd = array ("cmd" => "userauth", "sess" => $sess, "private" => $private, "the_end" => "true");
56 $cmd_ser = cmd_serialize($cmd);
57 $cmd_len = mb_strlen($cmd_ser, "ASCII");
60 if (($socket = stream_socket_client("unix://".USOCK_PATH."2")) == FALSE)
63 if (($rwr = fwrite($socket, $cmd_ser, $cmd_len)) == FALSE
68 if (($buf = fread($socket, 4096)) == FALSE)
70 $res = cmd_deserialize($buf);
72 if (!isset($res['val']) || $res['val'] != 200)
87 GLOBAL $G_dbpfx, $G_alarm_passwd, $f_mailusers, $sess, $_POST, $_SERVER;
89 if (check_auth() == FALSE) {
90 echo "Authentication failed";
94 if (isset($_POST['f_accept'])) {
97 else if (isset($_POST['f_delete'])) {
102 if ($action == "accept") {
103 if (($bdb = BriskDB::create()) == FALSE) {
104 log_crit("stat-day: database connection failed");
108 foreach($_POST as $key => $value) {
109 if (substr($key, 0, 9) != "f_newuser")
112 $id = (int)substr($key, 9);
117 // retrieve list of active tournaments
119 SELECT usr.*, guar.login AS guar_login
121 JOIN %susers AS guar ON guar.code = usr.guar_code
122 WHERE ( (usr.type & (CAST (X'%x' as integer))) = (CAST (X'%x' as integer)) )
123 AND usr.disa_reas = %d AND usr.code = %d;",
125 USER_FLAG_TY_ALL, USER_FLAG_TY_DISABLE,
126 USER_DIS_REA_NU_TOBECHK, $id);
127 if (($usr_pg = pg_query($bdb->dbconn->db(), $usr_sql)) == FALSE) {
128 log_crit("stat-day: select from tournaments failed");
131 $usr_obj = pg_fetch_object($usr_pg, 0);
133 printf("KEY: %s: %s %s<br>\n", $id, $value, $usr_obj->login);
142 if (($bdb = BriskDB::create()) == FALSE) {
143 log_crit("stat-day: database connection failed");
147 // retrieve list of active tournaments
149 SELECT usr.*, guar.login AS guar_login
151 JOIN %susers AS guar ON guar.code = usr.guar_code
152 WHERE ( (usr.type & (CAST (X'%x' as integer))) = (CAST (X'%x' as integer)) )
153 AND usr.disa_reas = %d;",
155 USER_FLAG_TY_ALL, USER_FLAG_TY_DISABLE,
156 USER_DIS_REA_NU_TOBECHK);
157 if (($usr_pg = pg_query($bdb->dbconn->db(), $usr_sql)) == FALSE) {
158 log_crit("stat-day: select from tournaments failed");
162 $usr_n = pg_numrows($usr_pg);
164 for ($i = 0 ; $i < $usr_n ; $i++) {
165 $usr_obj = pg_fetch_object($usr_pg, $i);
167 $tab_lines .= sprintf("<tr><td><input name=\"f_newuser%d\" type=\"checkbox\" CHECKED></td><td>%s</td><td></td></tr>\n",
168 $usr_obj->code, eschtml($usr_obj->login), eschtml($usr_obj->guar_login));
173 <form action="<?php echo "$PHP_SELF"; ?>" method="POST">
179 <input type="submit" name="f_accept" value="Accept">
180 <input type="submit" name="f_delete" value="Delete">