+++ /dev/null
-<?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));
-
-//
-?>