2 /************************************************************************
3 * MXChange v0.2.1 Start: 10/22/2005 *
4 * ================ Last change: 10/22/2005 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_beg.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List members in begging-rallye *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Mitglieder in Bettel-Rallye auflisten *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
43 if ($_CONFIG['beg_rallye'] == "Y")
45 // Shall I withdraw now?
46 if (isset($_POST['withdraw']))
48 // Okay, let's prepare...
49 $curr = date("m", time()) - 1;
50 if (strlen($curr) == 1) $curr = "0".$curr;
51 UPDATE_CONFIG("last_month", $curr);
52 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_WITHDRAW_PREPARED);
53 OUTPUT_HTML("<br />");
56 // Autopurge installed?
57 $LAST = "%s"; $ONLINE = "";
58 if (EXT_IS_ACTIVE("autopurge"))
60 // Use last online timestamp to keep inactive members away from here
61 $LAST = " AND last_online >= %s";
62 $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
65 // Check if at least one is in the active rallye
66 $result = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points, last_online
67 FROM "._MYSQL_PREFIX."_user_data
68 WHERE status='CONFIRMED' AND beg_points > 0".$LAST."
69 ORDER BY beg_points DESC, last_online DESC, userid",
70 array($ONLINE), __FILE__, __LINE__);
72 if (SQL_NUMROWS($result) > 0)
75 $OUT = "";$SW = 2; $cnt = 1; $total = 0;
76 while(list($uid, $email, $gender, $sname, $fname, $turbo, $last) = SQL_FETCHROW($result))
78 // Generate array fore the dynamic template
79 $WIN1 = ""; $WIN2 = "";
80 if ($cnt <= $_CONFIG['beg_ranks'])
82 // Maybe he can win his active beg?
88 'email' => CREATE_EMAIL_LINK($email, "user_data"),
89 'gender' => TRANSLATE_GENDER($gender),
92 'turbo' => TRANSLATE_COMMA($turbo),
93 'last' => MAKE_DATETIME($last, "2"),
100 // Load template and add it
101 $OUT .= LOAD_TEMPLATE("admin_list_beg_rows", true, $content);
102 $SW = 3 - $SW; $cnt++; $total += $turbo;
104 define('__BEG_ROWS', $OUT);
105 define('__TOTAL', TRANSLATE_COMMA($total));
107 // Check if we need to display form or not with manuel withdraw
108 if ($_CONFIG['last_month'] == date("m", time()))
111 define('__BEG_WITHDRAW_FORM', LOAD_TEMPLATE("admin_list_beg_form", true));
115 // Display message "no manual withdraw possible"
116 define('__BEG_WITHDRAW_FORM', "<FONT class=\"admin_failed\">".ADMIN_BEG_ALREADY_WITHDRAW."</FONT>");
119 // Prepare constant for timemark
120 define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - $_CONFIG['ap_in_since'], "2"));
122 // Load final template
123 LOAD_TEMPLATE("admin_list_beg");
127 // No one has joined the begging rallye...
128 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_NO_RALLYE);
133 // Rallye deactivated
134 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_RALLYE_DEACTIVATED);