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 * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ *
15 * $Tag:: 0.2.1-FINAL $ *
16 * $Author:: stelzi $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
43 } elseif (!IS_MEMBER()) {
44 LOAD_URL("modules.php?module=index");
47 // Add description as navigation point
48 ADD_DESCR("member", __FILE__);
51 $main_content = array();
53 // Load waiting/pending orders
54 $result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp, target_send, data_type, zip
55 FROM `{!_MYSQL_PREFIX!}_pool`
56 WHERE sender=%s AND data_type != 'SEND'
57 ORDER BY timestamp DESC",
58 array($GLOBALS['userid']), __FILE__, __LINE__);
60 // Are there mails left in pool?
61 if (SQL_NUMROWS($result) > 0) {
64 while ($data = SQL_FETCHARRAY($result)) {
65 // Is the ZIP code set? If not, set dashes
66 if (empty($data['zip'])) $data['zip'] = "---";
68 // Prepare content for output
72 'cat' => GET_CATEGORY($data['cat_id']),
73 'pay' => GET_PAYMENT($data['payment_id']),
74 'subj' => COMPILE_CODE($data['subject']),
75 'url' => DEREFERER($data['url']),
76 'stamp' => MAKE_DATETIME($data['timestamp'], "2"),
77 'recs' => $data['target_send'],
78 'type' => TRANSLATE_POOL_TYPE($data['data_type']),
83 $OUT .= LOAD_TEMPLATE("member_pool_row", true, $content);
90 $main_content['pool'] = LOAD_TEMPLATE("member_pool_table", true, $OUT);
93 $main_content['pool'] = LOAD_TEMPLATE("admin_settings_saved", true, getMessage('MEMBER_NO_MAILS_IN_POOL'));
97 SQL_FREERESULT($result);
101 $result = SQL_QUERY_ESC("SELECT id, cat_id, payment_id, subject, url, timestamp_ordered, max_rec, timestamp_send, clicks
102 FROM `{!_MYSQL_PREFIX!}_user_stats`
104 ORDER BY timestamp_ordered DESC",
105 array($GLOBALS['userid']), __FILE__, __LINE__);
107 if (SQL_NUMROWS($result) > 0) {
108 // Mail orders are in pool so we can display them
110 while ($data = SQL_FETCHROW($result)) {
111 // Prepare data for the template
114 'cat' => GET_CATEGORY($data[1]),
115 'pay' => GET_PAYMENT($data[2]),
116 'subj' => COMPILE_CODE($data[3]),
117 'url' => DEREFERER($data[4]),
118 'stamp' => MAKE_DATETIME($data[5], "2"),
120 'sent' => MAKE_DATETIME($data[7], "2"),
122 'perc' => COMPILE_CODE($data[8] / $data[6] * 100)."%",
125 // Load row template and switch colors
126 $OUT .= LOAD_TEMPLATE("member_stats_row", true, $content);
130 // Load main template
131 $main_content['stats'] = LOAD_TEMPLATE("member_stats_table", true, $OUT);
133 // No mail orders fond
134 $main_content['stats'] = LOAD_TEMPLATE("admin_settings_saved", true, getMessage('MEMBER_NO_MAILS_IN_STATS'));
138 SQL_FREERESULT($result);
140 // Load main template
141 LOAD_TEMPLATE("member_stats_pool", false, $main_content);