]> git.mxchange.org Git - mailer.git/blobdiff - 0.2.1/inc/gen_mediadata.php
win32 to unix line delimiters changed
[mailer.git] / 0.2.1 / inc / gen_mediadata.php
index 403d2e35c61dd1ec4036debc39457679f4a98b17..07d1e7a7e9d04d7cef752cdb137a9fbbb8c92fd4 100644 (file)
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1                                    Start: 10/08/2005 *\r
- * ===============                              Last change: 01/01/2006 *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * File              : gen_mediadata.php                                *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Checks for existing mail orders                  *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung  : Prueft bestehende Mailbuchungen                  *\r
- * -------------------------------------------------------------------- *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
- * For more information visit: http://www.mxchange.org                  *\r
- *                                                                      *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or    *\r
- * (at your option) any later version.                                  *\r
- *                                                                      *\r
- * This program is distributed in the hope that it will be useful,      *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
- * GNU General Public License for more details.                         *\r
- *                                                                      *\r
- * You should have received a copy of the GNU General Public License    *\r
- * along with this program; if not, write to the Free Software          *\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
- * MA  02110-1301  USA                                                  *\r
- ************************************************************************/\r
-\r
-// Some security stuff...\r
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
-{\r
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
-       require($INC);\r
-}\r
-\r
-// Check for normal mails\r
-$result_media = SQL_QUERY("SELECT SUM(max_rec) AS max_rec, SUM(clicks) AS clicks\r
-FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__);\r
-list($nsent, $nclicks) = SQL_FETCHROW($result_media);\r
-if (empty($nsent))   $nsent   = "0";\r
-if (empty($nclicks)) $nclicks = "0";\r
-\r
-// Free memory\r
-SQL_FREERESULT($result_media);\r
-\r
-// Count mail orders\r
-$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__);\r
-list($ncount) = SQL_FETCHROW($result_media);\r
-SQL_FREERESULT($result_media);\r
-$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);\r
-list($bcount) = SQL_FETCHROW($result_media);\r
-SQL_FREERESULT($result_media);\r
-\r
-// Check for bonus extension\r
-if (EXT_IS_ACTIVE("bonus"))\r
-{\r
-       // Check for bonus mails\r
-       $result_media = SQL_QUERY("SELECT SUM(mails_sent) AS bonus_sent, SUM(clicks) AS bonus_clicks\r
-FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);\r
-       list($bsent, $bclicks) = SQL_FETCHROW($result_media);\r
-       if (empty($bsent))   $bsent   = "0";\r
-       if (empty($bclicks)) $bclicks = "0";\r
-}\r
- else\r
-{\r
-       // Not found!\r
-       $bsent = "0"; $bclicks = "0";\r
-}\r
-\r
-// Load (maybe) missing file\r
-require_once(PATH."inc/libs/mediadata_functions.php");\r
-\r
-// Insert info to database\r
-MEDIA_UPDATE_ENTRY(array("total_send"  , "normal_send")  , "init", $nsent);\r
-MEDIA_UPDATE_ENTRY(array("total_clicks", "normal_clicks"), "init", $nclicks);\r
-MEDIA_UPDATE_ENTRY(array("total_orders", "normal_orders"), "init", $ncount);\r
-MEDIA_UPDATE_ENTRY(array("total_send"  , "bonus_send" )  , "init", $bsent);\r
-MEDIA_UPDATE_ENTRY(array("total_clicks", "bonus_clicks") , "init", $bclicks);\r
-MEDIA_UPDATE_ENTRY(array("total_orders", "bonus_orders") , "init", $bcount);\r
-\r
-// Aquire total used points\r
-$result = SQL_QUERY("SELECT SUM(used_points) AS used_points FROM "._MYSQL_PREFIX."_user_data", __FILE__, __LINE__);\r
-list($used) = SQL_FETCHROW($result);\r
-SQL_FREERESULT($result);\r
-\r
-// ... and total points\r
-$result = SQL_QUERY("SELECT SUM(points) AS points FROM "._MYSQL_PREFIX."_user_points", __FILE__, __LINE__);\r
-list($points) = SQL_FETCHROW($result);\r
-SQL_FREERESULT($result);\r
-\r
-// Update database\r
-MEDIA_UPDATE_ENTRY(array("total_points"), "init", ($points - $used));\r
-\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 10/08/2005 *
+ * ===============                              Last change: 01/01/2006 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : gen_mediadata.php                                *
+ * -------------------------------------------------------------------- *
+ * Short description : Checks for existing mail orders                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Prueft bestehende Mailbuchungen                  *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
+{
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Check for normal mails
+$result_media = SQL_QUERY("SELECT SUM(max_rec) AS max_rec, SUM(clicks) AS clicks
+FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__);
+list($nsent, $nclicks) = SQL_FETCHROW($result_media);
+if (empty($nsent))   $nsent   = "0";
+if (empty($nclicks)) $nclicks = "0";
+
+// Free memory
+SQL_FREERESULT($result_media);
+
+// Count mail orders
+$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__);
+list($ncount) = SQL_FETCHROW($result_media);
+SQL_FREERESULT($result_media);
+$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);
+list($bcount) = SQL_FETCHROW($result_media);
+SQL_FREERESULT($result_media);
+
+// Check for bonus extension
+if (EXT_IS_ACTIVE("bonus"))
+{
+       // Check for bonus mails
+       $result_media = SQL_QUERY("SELECT SUM(mails_sent) AS bonus_sent, SUM(clicks) AS bonus_clicks
+FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);
+       list($bsent, $bclicks) = SQL_FETCHROW($result_media);
+       if (empty($bsent))   $bsent   = "0";
+       if (empty($bclicks)) $bclicks = "0";
+}
+ else
+{
+       // Not found!
+       $bsent = "0"; $bclicks = "0";
+}
+
+// Load (maybe) missing file
+require_once(PATH."inc/libs/mediadata_functions.php");
+
+// Insert info to database
+MEDIA_UPDATE_ENTRY(array("total_send"  , "normal_send")  , "init", $nsent);
+MEDIA_UPDATE_ENTRY(array("total_clicks", "normal_clicks"), "init", $nclicks);
+MEDIA_UPDATE_ENTRY(array("total_orders", "normal_orders"), "init", $ncount);
+MEDIA_UPDATE_ENTRY(array("total_send"  , "bonus_send" )  , "init", $bsent);
+MEDIA_UPDATE_ENTRY(array("total_clicks", "bonus_clicks") , "init", $bclicks);
+MEDIA_UPDATE_ENTRY(array("total_orders", "bonus_orders") , "init", $bcount);
+
+// Aquire total used points
+$result = SQL_QUERY("SELECT SUM(used_points) AS used_points FROM "._MYSQL_PREFIX."_user_data", __FILE__, __LINE__);
+list($used) = SQL_FETCHROW($result);
+SQL_FREERESULT($result);
+
+// ... and total points
+$result = SQL_QUERY("SELECT SUM(points) AS points FROM "._MYSQL_PREFIX."_user_points", __FILE__, __LINE__);
+list($points) = SQL_FETCHROW($result);
+SQL_FREERESULT($result);
+
+// Update database
+MEDIA_UPDATE_ENTRY(array("total_points"), "init", ($points - $used));
+
+//
+?>