2 /************************************************************************
3 * MXChange v0.2.1 Start: 11/09/2003 *
4 * =============== Last change: 04/21/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-stats.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Statistics over send mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Statistik ueber gesendete Mails *
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 (!defined('__SECURITY')) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38 } elseif (!IS_MEMBER()) {
39 LOAD_URL("modules.php?module=index");
42 // Add description as navigation point
43 ADD_DESCR("member", basename(__FILE__));
45 // Load waiting/pending orders
46 $result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp, target_send, data_type, zip
47 FROM "._MYSQL_PREFIX."_pool
48 WHERE sender=%s AND data_type != 'SEND'
49 ORDER BY timestamp DESC",
50 array($GLOBALS['userid']), __FILE__, __LINE__);
52 // Are there mails left in pool?
53 if (SQL_NUMROWS($result) > 0) {
56 while ($data = SQL_FETCHARRAY($result)) {
57 // Is the ZIP code set? If not, set dashes
58 if (empty($data['zip'])) $data['zip'] = "---";
60 // Prepare content for output
64 'cat' => GET_CATEGORY($data['cat_id']),
65 'pay' => GET_PAYMENT($data['payment_id']),
66 'subj' => COMPILE_CODE($data['subject']),
67 'url' => DEREFERER($data['url']),
68 'stamp' => MAKE_DATETIME($data['timestamp'], "0"),
69 'recs' => $data['target_send'],
70 'type' => TRANSLATE_POOL_TYPE($data['data_type']),
71 'zip' => bigintval($data['zip'])
75 $OUT .= LOAD_TEMPLATE("member_pool_row", true, $content);
82 LOAD_TEMPLATE("member_pool", false, $OUT);
85 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_NO_MAILS_IN_POOL);
89 SQL_FREERESULT($result);
93 $result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp_ordered, max_rec, timestamp_send, clicks
94 FROM "._MYSQL_PREFIX."_user_stats
96 ORDER BY timestamp_ordered DESC",
97 array($GLOBALS['userid']), __FILE__, __LINE__);
99 if (SQL_NUMROWS($result) > 0) {
100 // Mail orders are in pool so we can display them
102 while ($data = SQL_FETCHROW($result)) {
103 // Prepare data for the template
106 'cat' => GET_CATEGORY($data[1]),
107 'pay' => GET_PAYMENT($data[2]),
108 'subj' => COMPILE_CODE($data[3]),
109 'url' => DEREFERER($data[4]),
110 'stamp' => MAKE_DATETIME($data[5], "0"),
112 'sent' => MAKE_DATETIME($data[7], "0"),
114 'perc' => COMPILE_CODE($data[8] / $data[6] * 100)."%",
117 // Load row template and switch colors
118 $OUT .= LOAD_TEMPLATE("member_stats_row", true, $content);
122 // Remember rows in template
123 define('__STATS_ROWS', $OUT);
125 // Load main template
126 LOAD_TEMPLATE("member_stats_table");
128 // No mail orders fond
129 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_NO_MAILS_IN_STATS);
133 SQL_FREERESULT($result);