-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 03/27/2004 *\r
- * =============== Last change: 04/26/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : admin.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Administration area *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Administrationsbereich *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module\r
-$GLOBALS['module'] = "admin"; $CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-// Is the script installed?\r
-if (defined('mxchange_installed') && (mxchange_installed))\r
-{\r
- // Simply redirect... :-)\r
- LOAD_URL(URL."/modules.php?module=admin&action=login");\r
- // Redirection should be done here\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL(URL."/install.php");\r
-}\r
-\r
-// Really all done here... ;-)\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 03/27/2004 *
+ * =============== Last change: 04/26/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : admin.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Administration area *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Administrationsbereich *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module
+$GLOBALS['module'] = "admin"; $CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is the script installed?
+if (defined('mxchange_installed') && (mxchange_installed))
+{
+ // Simply redirect... :-)
+ LOAD_URL(URL."/modules.php?module=admin&action=login");
+ // Redirection should be done here
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL(URL."/install.php");
+}
+
+// Really all done here... ;-)
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 11/27/2003 *\r
- * =============== Last change: 04/26/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : agb.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Terms Of Usage link *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Allgemeine Geschaeftsbedingungen *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module\r
-$GLOBALS['module'] = "agb"; $CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-// Is the script installed?\r
-if (defined('mxchange_installed') && (mxchange_installed))\r
-{\r
- // Simply redirect... :-)\r
- LOAD_URL(URL."/modules.php?module=index&what=agb");\r
- // Redirection should be done here\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL(URL."/install.php");\r
-}\r
-// Really all done here... ;-)\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 11/27/2003 *
+ * =============== Last change: 04/26/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : agb.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Terms Of Usage link *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Allgemeine Geschaeftsbedingungen *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module
+$GLOBALS['module'] = "agb"; $CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is the script installed?
+if (defined('mxchange_installed') && (mxchange_installed))
+{
+ // Simply redirect... :-)
+ LOAD_URL(URL."/modules.php?module=index&what=agb");
+ // Redirection should be done here
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL(URL."/install.php");
+}
+// Really all done here... ;-)
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 01/09/2005 *\r
- * =============== Last change: 01/09/2005 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : beg.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Beg link for members *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Bettel-Link fuer Mitglieder *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module\r
-$GLOBALS['module'] = "beg";\r
-$GLOBALS['refid'] = 0;\r
-$CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-// Is the script installed?\r
-if (defined('mxchange_installed') && (mxchange_installed))\r
-{\r
- // Check for userid\r
- if (!empty($_GET['uid']))\r
- {\r
- $uid = 0;\r
- if (bigintval($_GET['uid']) != $_GET['uid'])\r
- {\r
- if (EXT_IS_ACTIVE("nickname"))\r
- {\r
- // Maybe we have found a nickname?\r
- $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",\r
- array($_GET['uid']), __FILE__, __LINE__);\r
- }\r
- else\r
- {\r
- // Nickname entered but nickname is not active\r
- $msg = CODE_EXTENSION_PROBLEM;\r
- $uid = -1;\r
- $result = false;\r
- }\r
- }\r
- else\r
- {\r
- // Direct userid\r
- $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",\r
- array(bigintval($_GET['uid'])), __FILE__, __LINE__);\r
- }\r
-\r
- // Check if locked in so don't pay points\r
- $login = false; $status = "failed";\r
- if (IS_LOGGED_IN())\r
- {\r
- // Logged in user detected!\r
- $login = true;\r
- }\r
-\r
- // Check if account was found\r
- if ((SQL_NUMROWS($result) == 1) && ($result != false))\r
- {\r
- // Found an ID so we simply set it\r
- list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result);\r
- if ($status == "CONFIRMED")\r
- {\r
- // Secure userid\r
- $uid = bigintval($uid);\r
-\r
- // Calculate beg points\r
- srand((double)microtime() * 10000000000 / time());\r
-\r
- // Multiply configured values with 100000 and divide with 100000 so we can also handle small values\r
- // If we need more number behind the decimal dot then we just need to increase all these three\r
- // numbers matching to the numbers behind the decimal dot. Simple! ;-)\r
- $POINTS = rand(($CONFIG['beg_points'] * 100000), ($CONFIG['beg_points_max'] * 100000)) / 100000;\r
-\r
- // Set nickname / userid for the template(s\r
- define('__BEG_UID' , $_GET['uid']);\r
- define('__BEG_CLICKS', ($clicks + 1));\r
- define('__BEG_BANNER', LOAD_TEMPLATE("beg_banner", true));\r
- define('__BEG_POINTS', TRANSLATE_COMMA($POINTS));\r
- }\r
- else\r
- {\r
- // Other status\r
- $uid = "0";\r
- }\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- if (($uid > 0) && ($CONFIG['beg_uid'] != $uid))\r
- {\r
- // Update counter\r
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET beg_clicks=beg_clicks+1 WHERE userid=%d AND status='CONFIRMED' LIMIT 1",\r
- array($uid), __FILE__, __LINE__);\r
-\r
- // Check for last entry for userid w/o IP number\r
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_beg_ips WHERE (timeout > ".(time() - $CONFIG['beg_timeout'])." OR (timeout > ".(time() - $CONFIG['beg_uid_timeout'])." AND userid=%d)) AND remote_ip='%s' LIMIT 1",\r
- array($uid, getenv('REMOTE_ADDR')), __FILE__, __LINE__);\r
- if ((SQL_NUMROWS($result) == 0) && ($POINTS > 0) && (!$login))\r
- {\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- if (!IS_ADMIN())\r
- {\r
- // Remember remote address, userid and timestamp for next click\r
- // but only when there is no admin begging.\r
- // Admins shall be able to test it!\r
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_beg_ips (userid, remote_ip, timeout) VALUES('%s', '%s', UNIX_TIMESTAMP())",\r
- array($uid, getenv('REMOTE_ADDR')), __FILE__, __LINE__);\r
- }\r
-\r
- // Set mode depending on how many mails the member has to confirm\r
- $locked = false;\r
- if (($ref_payout > 0) && ($CONFIG['allow_direct_pay'] == "N")) $locked = true;\r
-\r
- // Is begging rallye active?\r
- if ($CONFIG['beg_rallye'] == "Y")\r
- {\r
- // Add points to rallye account\r
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET beg_points=beg_points+%s WHERE userid=%d LIMIT 1",\r
- array($POINTS, $uid), __FILE__, __LINE__);\r
- }\r
- else\r
- {\r
- // Add points to account\r
- ADD_POINTS_REFSYSTEM($uid, $POINTS, false, "0", $locked, strtolower($CONFIG['beg_mode']));\r
- }\r
-\r
- // Subtract begged points from member account if the admin has selected one\r
- if ($CONFIG['beg_uid'] > 0)\r
- {\r
- // Subtract from this account\r
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET used_points=used_points+%s WHERE userid=%d LIMIT 1",\r
- array($POINTS, bigintval($CONFIG['beg_uid'])), __FILE__, __LINE__);\r
-\r
- // Update mediadata as well\r
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")\r
- {\r
- // Update database\r
- MEDIA_UPDATE_ENTRY(array("total_points"), "sub", $POINTS);\r
- }\r
- }\r
-\r
- // Set message\r
- define('__BEG_MSG', LOAD_TEMPLATE("beg_done", true));\r
- }\r
- elseif ($login)\r
- {\r
- // Logged in user found!\r
- define('__BEG_MSG', LOAD_TEMPLATE("beg_login", true));\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
- }\r
- else\r
- {\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- // Clicked received while reload lock is active\r
- define('__BEG_MSG', LOAD_TEMPLATE("beg_failed", true));\r
- }\r
-\r
- // Include header\r
- require_once(PATH."inc/header.php");\r
-\r
- // Load final template\r
- LOAD_TEMPLATE("beg_link");\r
-\r
- // Include footer\r
- require_once(PATH."inc/footer.php");\r
- }\r
- elseif (($status != "CONFIRMED") && ($status != "failed"))\r
- {\r
- // Maybe locked/unconfirmed account?\r
- switch ($status)\r
- {\r
- case "LOCKED" : $msg = CODE_ID_LOCKED ; break; // Locked account\r
- case "UNCONFIRMED": $msg = CODE_ID_UNCONFIRMED; break; // Unconfirmed account\r
- }\r
- }\r
- elseif (($uid == "0") || ($status == "failed"))\r
- {\r
- // Inalid or locked account, so let's find out\r
- $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",\r
- array($_GET['uid']), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result) == 1)\r
- {\r
- // Locked account\r
- $msg = CODE_ACCOUNT_LOCKED;\r
- }\r
- else\r
- {\r
- // Invalid nickname! (404)\r
- $msg = CODE_USER_404;\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
- }\r
- elseif ($uid = $CONFIG['beg_uid'])\r
- {\r
- // Webmaster's ID cannot beg for points!\r
- $msg = CODE_BEG_SAME_AS_OWN;\r
- }\r
-\r
- // Reload to index module\r
- if ((!empty($msg)) && (!empty($msg))) LOAD_URL(URL."/modules.php?module=index&msg=".$msg);\r
- }\r
- else\r
- {\r
- // No userid entered\r
- LOAD_URL(URL."/modules.php?module=index");\r
- }\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL(URL."/install.php");\r
-}\r
-// Really all done here... ;-)\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 01/09/2005 *
+ * =============== Last change: 01/09/2005 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : beg.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Beg link for members *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Bettel-Link fuer Mitglieder *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module
+$GLOBALS['module'] = "beg";
+$GLOBALS['refid'] = 0;
+$CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is the script installed?
+if (defined('mxchange_installed') && (mxchange_installed))
+{
+ // Check for userid
+ if (!empty($_GET['uid']))
+ {
+ $uid = 0;
+ if (bigintval($_GET['uid']) != $_GET['uid'])
+ {
+ if (EXT_IS_ACTIVE("nickname"))
+ {
+ // Maybe we have found a nickname?
+ $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",
+ array($_GET['uid']), __FILE__, __LINE__);
+ }
+ else
+ {
+ // Nickname entered but nickname is not active
+ $msg = CODE_EXTENSION_PROBLEM;
+ $uid = -1;
+ $result = false;
+ }
+ }
+ else
+ {
+ // Direct userid
+ $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+ array(bigintval($_GET['uid'])), __FILE__, __LINE__);
+ }
+
+ // Check if locked in so don't pay points
+ $login = false; $status = "failed";
+ if (IS_LOGGED_IN())
+ {
+ // Logged in user detected!
+ $login = true;
+ }
+
+ // Check if account was found
+ if ((SQL_NUMROWS($result) == 1) && ($result != false))
+ {
+ // Found an ID so we simply set it
+ list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result);
+ if ($status == "CONFIRMED")
+ {
+ // Secure userid
+ $uid = bigintval($uid);
+
+ // Calculate beg points
+ srand((double)microtime() * 10000000000 / time());
+
+ // Multiply configured values with 100000 and divide with 100000 so we can also handle small values
+ // If we need more number behind the decimal dot then we just need to increase all these three
+ // numbers matching to the numbers behind the decimal dot. Simple! ;-)
+ $POINTS = rand(($CONFIG['beg_points'] * 100000), ($CONFIG['beg_points_max'] * 100000)) / 100000;
+
+ // Set nickname / userid for the template(s
+ define('__BEG_UID' , $_GET['uid']);
+ define('__BEG_CLICKS', ($clicks + 1));
+ define('__BEG_BANNER', LOAD_TEMPLATE("beg_banner", true));
+ define('__BEG_POINTS', TRANSLATE_COMMA($POINTS));
+ }
+ else
+ {
+ // Other status
+ $uid = "0";
+ }
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ if (($uid > 0) && ($CONFIG['beg_uid'] != $uid))
+ {
+ // Update counter
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET beg_clicks=beg_clicks+1 WHERE userid=%d AND status='CONFIRMED' LIMIT 1",
+ array($uid), __FILE__, __LINE__);
+
+ // Check for last entry for userid w/o IP number
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_beg_ips WHERE (timeout > ".(time() - $CONFIG['beg_timeout'])." OR (timeout > ".(time() - $CONFIG['beg_uid_timeout'])." AND userid=%d)) AND remote_ip='%s' LIMIT 1",
+ array($uid, getenv('REMOTE_ADDR')), __FILE__, __LINE__);
+ if ((SQL_NUMROWS($result) == 0) && ($POINTS > 0) && (!$login))
+ {
+ // Free memory
+ SQL_FREERESULT($result);
+
+ if (!IS_ADMIN())
+ {
+ // Remember remote address, userid and timestamp for next click
+ // but only when there is no admin begging.
+ // Admins shall be able to test it!
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_beg_ips (userid, remote_ip, timeout) VALUES('%s', '%s', UNIX_TIMESTAMP())",
+ array($uid, getenv('REMOTE_ADDR')), __FILE__, __LINE__);
+ }
+
+ // Set mode depending on how many mails the member has to confirm
+ $locked = false;
+ if (($ref_payout > 0) && ($CONFIG['allow_direct_pay'] == "N")) $locked = true;
+
+ // Is begging rallye active?
+ if ($CONFIG['beg_rallye'] == "Y")
+ {
+ // Add points to rallye account
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET beg_points=beg_points+%s WHERE userid=%d LIMIT 1",
+ array($POINTS, $uid), __FILE__, __LINE__);
+ }
+ else
+ {
+ // Add points to account
+ ADD_POINTS_REFSYSTEM($uid, $POINTS, false, "0", $locked, strtolower($CONFIG['beg_mode']));
+ }
+
+ // Subtract begged points from member account if the admin has selected one
+ if ($CONFIG['beg_uid'] > 0)
+ {
+ // Subtract from this account
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET used_points=used_points+%s WHERE userid=%d LIMIT 1",
+ array($POINTS, bigintval($CONFIG['beg_uid'])), __FILE__, __LINE__);
+
+ // Update mediadata as well
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4")
+ {
+ // Update database
+ MEDIA_UPDATE_ENTRY(array("total_points"), "sub", $POINTS);
+ }
+ }
+
+ // Set message
+ define('__BEG_MSG', LOAD_TEMPLATE("beg_done", true));
+ }
+ elseif ($login)
+ {
+ // Logged in user found!
+ define('__BEG_MSG', LOAD_TEMPLATE("beg_login", true));
+
+ // Free memory
+ SQL_FREERESULT($result);
+ }
+ else
+ {
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Clicked received while reload lock is active
+ define('__BEG_MSG', LOAD_TEMPLATE("beg_failed", true));
+ }
+
+ // Include header
+ require_once(PATH."inc/header.php");
+
+ // Load final template
+ LOAD_TEMPLATE("beg_link");
+
+ // Include footer
+ require_once(PATH."inc/footer.php");
+ }
+ elseif (($status != "CONFIRMED") && ($status != "failed"))
+ {
+ // Maybe locked/unconfirmed account?
+ switch ($status)
+ {
+ case "LOCKED" : $msg = CODE_ID_LOCKED ; break; // Locked account
+ case "UNCONFIRMED": $msg = CODE_ID_UNCONFIRMED; break; // Unconfirmed account
+ }
+ }
+ elseif (($uid == "0") || ($status == "failed"))
+ {
+ // Inalid or locked account, so let's find out
+ $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",
+ array($_GET['uid']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1)
+ {
+ // Locked account
+ $msg = CODE_ACCOUNT_LOCKED;
+ }
+ else
+ {
+ // Invalid nickname! (404)
+ $msg = CODE_USER_404;
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+ }
+ elseif ($uid = $CONFIG['beg_uid'])
+ {
+ // Webmaster's ID cannot beg for points!
+ $msg = CODE_BEG_SAME_AS_OWN;
+ }
+
+ // Reload to index module
+ if ((!empty($msg)) && (!empty($msg))) LOAD_URL(URL."/modules.php?module=index&msg=".$msg);
+ }
+ else
+ {
+ // No userid entered
+ LOAD_URL(URL."/modules.php?module=index");
+ }
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL(URL."/install.php");
+}
+// Really all done here... ;-)
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 10/03/2004 *\r
- * =============== Last change: 10/03/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : birthday_confirm.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Birthday bonus confirmation link *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Geburtstagsgutschrift bestaetigen *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module\r
-$GLOBALS['module'] = "birthday_confirm"; $CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-if (defined('mxchange_installed') && (mxchange_installed))\r
-{\r
- // Script is installed so let's check for his confirmation link...\r
- $uid = strip_tags(bigintval($_GET['uid']));\r
-\r
- // Only allow numbers here...\r
- $chk = strip_tags(bigintval($_GET['check']));\r
-\r
- // .. only first 32 numbers\r
- $chk = substr($chk, 0, 32);\r
-\r
- // Check if link is not clicked so far\r
- $result = SQL_QUERY_ESC("SELECT DISTINCT b.points, d.sex, d.surname, d.family, d.status\r
-FROM "._MYSQL_PREFIX."_user_birthday AS b\r
-LEFT JOIN "._MYSQL_PREFIX."_user_data AS d\r
-ON b.userid=d.userid\r
-WHERE b.userid=%d AND b.chk_value='%s' LIMIT 1",\r
- array($uid, $chk), __FILE__, __LINE__);\r
-\r
- if (SQL_NUMROWS($result) == 1)\r
- {\r
- // Ok, congratulation again! Here's your gift from us...\r
- list($GIFT, $salut, $sname, $fname, $status) = SQL_FETCHROW($result);\r
- if ($status == "CONFIRMED")\r
- {\r
- // Set mode depending on how many mails the member has to confirm\r
- $locked = false;\r
- if (($ref_payout > 0) && ($CONFIG['allow_direct_pay'] == "N")) $locked = true;\r
-\r
- // Add points to account\r
- ADD_POINTS_REFSYSTEM($uid, $GIFT, false, "0", $locked, strtolower($CONFIG['birthday_mode']));\r
-\r
- // Remove entry from table\r
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_birthday WHERE userid=%d LIMIT 1",\r
- array($uid), __FILE__, __LINE__);\r
-\r
- // Update mediadata if version is 0.0.4 or newer\r
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")\r
- {\r
- // Update database\r
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $GIFT);\r
- }\r
-\r
- // Transfer data to constants for the template\r
- define('__SALUT', TRANSLATE_SEX($salut));\r
- define('__SNAME', $sname);\r
- define('__FNAME', $fname);\r
- define('__GIFT' , $GIFT);\r
-\r
- // Load message from template\r
- define('__MSG', LOAD_TEMPLATE("birthday_msg", true));\r
- }\r
- else\r
- {\r
- // Unconfirmed / locked accounts cannot get points\r
- define('__MSG', BIRTHDAY_CANNOT_STATUS_1.TRANSLATE_STATUS($status).BIRTHDAY_CANNOT_STATUS_2);\r
- }\r
- }\r
- else\r
- {\r
- // Cannot load data!\r
- define('__MSG', BIRTHDAY_CANNOT_LOAD_DATA);\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- // Set this because we have no module in URI\r
- $GLOBALS['module'] = "birthday_confirm";\r
-\r
- // Include header\r
- include(PATH."inc/header.php");\r
-\r
- // Load birthday header template (for your banners, e.g.?)\r
- define('__BIRTHDAY_HEADER', LOAD_TEMPLATE("birthday_header", true));\r
-\r
- // Load birthday footer template (for your banners, e.g.?)\r
- define('__BIRTHDAY_FOOTER', LOAD_TEMPLATE("birthday_footer", true));\r
-\r
- // Load final template and output it\r
- LOAD_TEMPLATE("birthday_confirm");\r
-\r
- // Include footer\r
- include(PATH."inc/footer.php");\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL(URL."/install.php");\r
-}\r
-// Really all done here... ;-)\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 10/03/2004 *
+ * =============== Last change: 10/03/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : birthday_confirm.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Birthday bonus confirmation link *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Geburtstagsgutschrift bestaetigen *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module
+$GLOBALS['module'] = "birthday_confirm"; $CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+if (defined('mxchange_installed') && (mxchange_installed))
+{
+ // Script is installed so let's check for his confirmation link...
+ $uid = strip_tags(bigintval($_GET['uid']));
+
+ // Only allow numbers here...
+ $chk = strip_tags(bigintval($_GET['check']));
+
+ // .. only first 32 numbers
+ $chk = substr($chk, 0, 32);
+
+ // Check if link is not clicked so far
+ $result = SQL_QUERY_ESC("SELECT DISTINCT b.points, d.sex, d.surname, d.family, d.status
+FROM "._MYSQL_PREFIX."_user_birthday AS b
+LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
+ON b.userid=d.userid
+WHERE b.userid=%d AND b.chk_value='%s' LIMIT 1",
+ array($uid, $chk), __FILE__, __LINE__);
+
+ if (SQL_NUMROWS($result) == 1)
+ {
+ // Ok, congratulation again! Here's your gift from us...
+ list($GIFT, $salut, $sname, $fname, $status) = SQL_FETCHROW($result);
+ if ($status == "CONFIRMED")
+ {
+ // Set mode depending on how many mails the member has to confirm
+ $locked = false;
+ if (($ref_payout > 0) && ($CONFIG['allow_direct_pay'] == "N")) $locked = true;
+
+ // Add points to account
+ ADD_POINTS_REFSYSTEM($uid, $GIFT, false, "0", $locked, strtolower($CONFIG['birthday_mode']));
+
+ // Remove entry from table
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_birthday WHERE userid=%d LIMIT 1",
+ array($uid), __FILE__, __LINE__);
+
+ // Update mediadata if version is 0.0.4 or newer
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4")
+ {
+ // Update database
+ MEDIA_UPDATE_ENTRY(array("total_points"), "add", $GIFT);
+ }
+
+ // Transfer data to constants for the template
+ define('__SALUT', TRANSLATE_SEX($salut));
+ define('__SNAME', $sname);
+ define('__FNAME', $fname);
+ define('__GIFT' , $GIFT);
+
+ // Load message from template
+ define('__MSG', LOAD_TEMPLATE("birthday_msg", true));
+ }
+ else
+ {
+ // Unconfirmed / locked accounts cannot get points
+ define('__MSG', BIRTHDAY_CANNOT_STATUS_1.TRANSLATE_STATUS($status).BIRTHDAY_CANNOT_STATUS_2);
+ }
+ }
+ else
+ {
+ // Cannot load data!
+ define('__MSG', BIRTHDAY_CANNOT_LOAD_DATA);
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Set this because we have no module in URI
+ $GLOBALS['module'] = "birthday_confirm";
+
+ // Include header
+ include(PATH."inc/header.php");
+
+ // Load birthday header template (for your banners, e.g.?)
+ define('__BIRTHDAY_HEADER', LOAD_TEMPLATE("birthday_header", true));
+
+ // Load birthday footer template (for your banners, e.g.?)
+ define('__BIRTHDAY_FOOTER', LOAD_TEMPLATE("birthday_footer", true));
+
+ // Load final template and output it
+ LOAD_TEMPLATE("birthday_confirm");
+
+ // Include footer
+ include(PATH."inc/footer.php");
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL(URL."/install.php");
+}
+// Really all done here... ;-)
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 01/02/2004 *\r
- * =============== Last change: 06/18/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : click.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Count clicks on a banner and redirect... *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Klicks auf Banner zaehlen und weiterleiten *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module\r
-$GLOBALS['module'] = "click"; $CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-if (((!empty($_GET['user'])) || (!empty($_GET['reseller']))) && (!empty($_GET['banner'])))\r
-{\r
- // Update clicks counter...\r
- $CLICK = 1;\r
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refbanner SET clicks=clicks+1 WHERE id=%d LIMIT 1", array(bigintval($_GET['banner'])), __FILE__, __LINE__);\r
- if (SQL_AFFECTEDROWS($link) == 1)\r
- {\r
- if (!empty($_GET['user']))\r
- {\r
- LOAD_URL("ref.php?refid=".$_GET['user']);\r
- }\r
- else\r
- {\r
- LOAD_URL("shop_reseller.php?reseller=".$_GET['reseller']);\r
- }\r
- }\r
- exit();\r
-}\r
- else\r
-{\r
- // Do nothing for now\r
- die();\r
-}\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 01/02/2004 *
+ * =============== Last change: 06/18/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : click.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Count clicks on a banner and redirect... *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Klicks auf Banner zaehlen und weiterleiten *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module
+$GLOBALS['module'] = "click"; $CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+if (((!empty($_GET['user'])) || (!empty($_GET['reseller']))) && (!empty($_GET['banner'])))
+{
+ // Update clicks counter...
+ $CLICK = 1;
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refbanner SET clicks=clicks+1 WHERE id=%d LIMIT 1", array(bigintval($_GET['banner'])), __FILE__, __LINE__);
+ if (SQL_AFFECTEDROWS($link) == 1)
+ {
+ if (!empty($_GET['user']))
+ {
+ LOAD_URL("ref.php?refid=".$_GET['user']);
+ }
+ else
+ {
+ LOAD_URL("shop_reseller.php?reseller=".$_GET['reseller']);
+ }
+ }
+ exit();
+}
+ else
+{
+ // Do nothing for now
+ die();
+}
+//
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 10/13/2003 *\r
- * =============== Last change: 04/26/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : confirm.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Redirection for the confirmation link *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Weiterleitungsscript f�r den Best�tigungslink *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module to confirm\r
-$GLOBALS['module'] = "confirm"; $CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-// Is the script installed?\r
-if (defined('mxchange_installed') && (mxchange_installed) && (admin_registered))\r
-{\r
- // Base URL for redirection\r
- $URL = URL."/modules.php?module=index&what=confirm&hash=";\r
- if (empty($_GET['hash']))\r
- {\r
- // No refid and we add our refid (don't forget to set $def_refid!)\r
- $URL = URL."/modules.php?module=index";\r
- }\r
- else\r
- {\r
- // We have an refid here. So we simply add it\r
- $URL .= $_GET['hash'];\r
- }\r
- // Load the URL\r
- LOAD_URL($URL);\r
- // Redirection should be done here\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL(URL."/install.php");\r
-}\r
-// Really all done here... ;-)\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 10/13/2003 *
+ * =============== Last change: 04/26/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : confirm.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Redirection for the confirmation link *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Weiterleitungsscript f�r den Best�tigungslink *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module to confirm
+$GLOBALS['module'] = "confirm"; $CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is the script installed?
+if (defined('mxchange_installed') && (mxchange_installed) && (admin_registered))
+{
+ // Base URL for redirection
+ $URL = URL."/modules.php?module=index&what=confirm&hash=";
+ if (empty($_GET['hash']))
+ {
+ // No refid and we add our refid (don't forget to set $def_refid!)
+ $URL = URL."/modules.php?module=index";
+ }
+ else
+ {
+ // We have an refid here. So we simply add it
+ $URL .= $_GET['hash'];
+ }
+ // Load the URL
+ LOAD_URL($URL);
+ // Redirection should be done here
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL(URL."/install.php");
+}
+// Really all done here... ;-)
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 11/06/2004 *\r
- * =============== Last change: 12/03/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : css.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Image code for multi-purposes *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Code-Bild fuer verschiedene Zwecke *\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
-// Deactivate caching system in CSS mode\r
-define('_OB_CACHING', "old");\r
-\r
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// This is a CSS file loader!\r
-$CSS = "1"; $GLOBALS['module'] = "css";\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-// Set header\r
-@header("Content-type: text/css");\r
-\r
-// Load header\r
-require_once(PATH."inc/header.php");\r
-\r
-// Load CSS code\r
-require_once(PATH."inc/stylesheet.php");\r
-\r
-// Load footer\r
-require_once(PATH."inc/footer.php");\r
-\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 11/06/2004 *
+ * =============== Last change: 12/03/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : css.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Image code for multi-purposes *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Code-Bild fuer verschiedene Zwecke *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Deactivate caching system in CSS mode
+define('_OB_CACHING', "old");
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// This is a CSS file loader!
+$CSS = "1"; $GLOBALS['module'] = "css";
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Set header
+@header("Content-type: text/css");
+
+// Load header
+require_once(PATH."inc/header.php");
+
+// Load CSS code
+require_once(PATH."inc/stylesheet.php");
+
+// Load footer
+require_once(PATH."inc/footer.php");
+
+//
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 02/13/2005 *\r
- * =============== Last change: 02/13/2005 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : doubler.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Points doubler *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Punkteverdoppler *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set module\r
-$GLOBALS['module'] = "doubler";\r
-$GLOBALS['refid'] = 0;\r
-$CSS = "0";\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-// Is the script installed?\r
-if (defined('mxchange_installed') && (mxchange_installed))\r
-{\r
- // Probe for referral ID\r
- if (!empty($_GET['refid'])) $GLOBALS['refid'] = bigintval($_GET['refid']);\r
-\r
- // Probe for nickname extension and if a nickname was supplied by URL\r
- $probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($GLOBALS['refid'])."") != $GLOBALS['refid']));\r
- if ($probe_nickname)\r
- {\r
- // Nickname in URL, so load the ID\r
- $result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",\r
- array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);\r
- }\r
- else\r
- {\r
- // Direct userid entered\r
- $result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",\r
- array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);\r
- }\r
-\r
- // Load data\r
- list($rid, $status_ref) = SQL_FETCHROW($result);\r
- $GLOBALS['refid'] = bigintval($rid);\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
- $uid = 0;\r
-\r
- // If no account was found set default refid and status to CONFIRMED\r
- if (empty($GLOBALS['refid'])) { $GLOBALS['refid'] = $CONFIG['def_refid']; $status = "CONFIRMED"; }\r
-\r
- // Begin with doubler script...\r
- if (isset($_POST['ok']))\r
- {\r
- // Secure points (so only integer/double values are allowed\r
- $_POST['points'] = bigintval($_POST['points']);\r
-\r
- // Begin with doubling process\r
- if ((!empty($_POST['userid'])) && (!empty($_POST['pass'])) && (!empty($_POST['points'])))\r
- {\r
- // Probe for nickname extension and if a nickname was entered\r
- $probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($_POST['userid'])."") != $_POST['userid']));\r
- if ($probe_nickname)\r
- {\r
- // Nickname in URL, so load the ID\r
- $result = SQL_QUERY_ESC("SELECT userid, status, password FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",\r
- array($_POST['userid']), __FILE__, __LINE__);\r
- }\r
- else\r
- {\r
- // Direct userid entered\r
- $result = SQL_QUERY_ESC("SELECT userid, status, password FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",\r
- array(bigintval($_POST['userid'])), __FILE__, __LINE__);\r
- }\r
-\r
- // Load data\r
- list($uid, $status, $password) = SQL_FETCHROW($result);\r
- $uid = bigintval($uid);\r
-\r
- // Free result\r
- SQL_FREERESULT($result);\r
-\r
- // Remove any dots and unwanted chars from the points\r
- $_POST['points'] = bigintval(round(str_replace(",", ".", $_POST['points'])));\r
-\r
- // Probe for enough points\r
- $probe_points = (($_POST['points'] >= $CONFIG['doubler_min']) && ($_POST['points'] <= $CONFIG['doubler_max']));\r
-\r
- // Check all together\r
- if ((!empty($uid)) && ($password == generateHash($_POST['pass'], substr($password, 0, -40))) && ($status == "CONFIRMED") && ($probe_points))\r
- {\r
- // Nickname resolved to a unique userid or direct userid entered by the member\r
- $DOUBLER_UID = $uid;\r
-\r
- // Calulcate points\r
- $POINTS = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");\r
-\r
- // So let's continue with probing his points amount\r
- if (($POINTS - $CONFIG['doubler_left'] - $_POST['points'] * $CONFIG['doubler_charge']) >= 0)\r
- {\r
- // Enough points are left so let's continue with the doubling process\r
- // Create doubling "account" width *DOUBLED* points\r
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s', '%s', '%s', '".$_SERVER['REMOTE_ADDR']."', UNIX_TIMESTAMP(), 'N', 'N')",\r
- array($uid, bigintval($GLOBALS['refid']), bigintval($_POST['points'] * 2)), __FILE__, __LINE__);\r
-\r
- // Subtract entered points\r
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET used_points=used_points+%s WHERE userid=%d LIMIT 1",\r
- array($_POST['points'], $uid), __FILE__, __LINE__);\r
-\r
- // Update mediadata as well\r
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")\r
- {\r
- // Update database\r
- MEDIA_UPDATE_ENTRY(array("total_points"), "sub", $_POST['points']);\r
- }\r
-\r
- // Add points to "total payed" including charge\r
- $points = $_POST['points'] - $_POST['points'] * $CONFIG['doubler_charge'];\r
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_points=doubler_points+%s WHERE config='0' LIMIT 1",\r
- array($points), __FILE__, __LINE__);\r
- $CONFIG['doubler_points'] += $points;\r
-\r
- // Destroy cache\r
- if (GET_EXT_VERSION("cache") >= "0.1.2")\r
- {\r
- if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy();\r
- }\r
-\r
- // Add second line for the referral but only when uid != refid\r
- if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid))\r
- {\r
- // Okay add a refid line and apply refid percents\r
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s', '0', '%s', '".$_SERVER['REMOTE_ADDR']."', UNIX_TIMESTAMP(), 'N', 'Y')",\r
- array(bigintval($GLOBALS['refid']), bigintval($_POST['points'] * 2 * $CONFIG['doubler_ref'])), __FILE__, __LINE__);\r
-\r
- // And that's why we dont't want to you more than one referral level of doubler-points. ^^^\r
- }\r
-\r
- // Update usage counter\r
- $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET doubler_counter=doubler_counter+1 WHERE config='0' LIMIT 1", __FILE__, __LINE__);\r
- $CONFIG['doubler_counter']++;\r
-\r
- // Set constant\r
- define('__DOUBLER_MSG', LOAD_TEMPLATE("doubler_reflink", true, $_POST['userid']));\r
- }\r
- else\r
- {\r
- // Not enougth points left\r
- define('__ERROR_MSG', DOUBLER_FORM_NO_POINTS_LEFT);\r
- }\r
-\r
- }\r
- elseif ($status == "CONFIRMED")\r
- {\r
- // Account is unconfirmed!\r
- define('__ERROR_MSG', DOUBLER_FORM_WRONG_PASS);\r
- }\r
- elseif ($status == "UNCONFIRMED")\r
- {\r
- // Account is unconfirmed!\r
- define('__ERROR_MSG', DOUBLER_FORM_STATUS_UNCONFIRMED);\r
- }\r
- elseif ($status == "LOCKED")\r
- {\r
- // Account is locked by admin / holiday!\r
- define('__ERROR_MSG', DOUBLER_FORM_STATUS_LOCKED);\r
- }\r
- elseif ($_POST['points'] < $CONFIG['doubler_min'])\r
- {\r
- // Not enougth points entered\r
- define('__ERROR_MSG', DOUBLER_FORM_POINTS_MIN);\r
- }\r
- elseif ($_POST['points'] > $CONFIG['doubler_max'])\r
- {\r
- // Too much points entered\r
- define('__ERROR_MSG', DOUBLER_FORM_POINTS_MAX);\r
- }\r
- elseif ($probe_nickname)\r
- {\r
- // Cannot resolv nickname -> userid\r
- define('__ERROR_MSG', DOUBLER_FORM_404_NICKNAME);\r
- }\r
- else\r
- {\r
- // Wrong password or account not found\r
- define('__ERROR_MSG', DOUBLER_FORM_404_MEMBER);\r
- }\r
- }\r
- elseif (empty($_POST['userid']))\r
- {\r
- // Login not entered\r
- define('__ERROR_MSG', DOUBLER_FORM_404_LOGIN);\r
- }\r
- elseif (empty($_POST['pass']))\r
- {\r
- // Password not entered\r
- define('__ERROR_MSG', DOUBLER_FORM_404_PASSWORD);\r
- }\r
- elseif (empty($_POST['points']))\r
- {\r
- // points not entered\r
- define('__ERROR_MSG', DOUBLER_FORM_404_POINTS);\r
- }\r
- }\r
-\r
- // Set messages to nothing\r
- if (!defined('__DOUBLER_MSG')) define('__DOUBLER_MSG', "");\r
- if (!defined('__ERROR_MSG')) define('__ERROR_MSG' , "");\r
-\r
- // Shall I check for points immediately?\r
- if ($CONFIG['doubler_send_mode'] == "DIRECT") require(PATH."inc/doubler_send.php");\r
-\r
- // Output header\r
- include(PATH."inc/header.php");\r
-\r
- // Banner in text\r
- define('__DOUBLER_BANNER', LOAD_TEMPLATE("doubler_banner", true));\r
-\r
- // Load header/footer templates\r
- define('__DOUBLER_HEADER', LOAD_TEMPLATE("doubler_header", true));\r
- define('__DOUBLER_FOOTER', LOAD_TEMPLATE("doubler_footer", true));\r
-\r
- if (!empty($uid))\r
- {\r
- // Transfer userid/nickname to constant\r
- define('__REFID', $uid);\r
- }\r
- elseif (!empty($GLOBALS['refid']))\r
- {\r
- // Transfer userid/nickname to constant\r
- define('__REFID', $GLOBALS['refid']);\r
- }\r
- else\r
- {\r
- // Transfer default refid to constant\r
- define('__REFID', $CONFIG['def_refid']);\r
- }\r
-\r
- // Percent values etc.\r
- define('__CHARGE_VALUE', TRANSLATE_COMMA($CONFIG['doubler_charge'] * 100));\r
- define('__REF_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_ref'] * 100));\r
- define('__TOTAL_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_points']));\r
- define('__MIN_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_min']));\r
- define('__MAX_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_max']));\r
-\r
- // Text "Enter login"\r
- if (EXT_IS_ACTIVE("nickname"))\r
- {\r
- // Choose login/nickname\r
- define('DOUBLER_ENTER_LOGIN', GUEST_ENTER_LOGIN_NICKNAME);\r
- }\r
- else\r
- {\r
- // Simple login ID\r
- define('DOUBLER_ENTER_LOGIN', GUEST_ENTER_LOGIN);\r
- }\r
-\r
- // Which mail-send-mode did the admin setup?\r
- switch ($CONFIG['doubler_send_mode'])\r
- {\r
- case "DIRECT":\r
- define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_DIRECT);\r
- break;\r
-\r
- case "RESET":\r
- define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_RESET);\r
- break;\r
- }\r
-\r
- // Generate table with already payed out doubles\r
- define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE("0", "Y", "N", "DESC"));\r
-\r
- // Generate timemark\r
- define('__TIMEOUT_MARK', CREATE_FANCY_TIME($CONFIG['doubler_timeout']));\r
-\r
- // Usage counter\r
- define('__DOUBLER_COUNTER', $CONFIG['doubler_counter']);\r
-\r
- // Points left to doubler\r
- define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));\r
-\r
- // Output neccessary form for this\r
- LOAD_TEMPLATE("doubler_index");\r
-\r
- // Output footer\r
- include(PATH."inc/footer.php");\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL(URL."/install.php");\r
-}\r
-\r
-// Really all done here... ;-)\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 02/13/2005 *
+ * =============== Last change: 02/13/2005 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : doubler.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Points doubler *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Punkteverdoppler *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set module
+$GLOBALS['module'] = "doubler";
+$GLOBALS['refid'] = 0;
+$CSS = "0";
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is the script installed?
+if (defined('mxchange_installed') && (mxchange_installed))
+{
+ // Probe for referral ID
+ if (!empty($_GET['refid'])) $GLOBALS['refid'] = bigintval($_GET['refid']);
+
+ // Probe for nickname extension and if a nickname was supplied by URL
+ $probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($GLOBALS['refid'])."") != $GLOBALS['refid']));
+ if ($probe_nickname)
+ {
+ // Nickname in URL, so load the ID
+ $result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",
+ array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
+ }
+ else
+ {
+ // Direct userid entered
+ $result = SQL_QUERY_ESC("SELECT userid, status FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+ array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
+ }
+
+ // Load data
+ list($rid, $status_ref) = SQL_FETCHROW($result);
+ $GLOBALS['refid'] = bigintval($rid);
+
+ // Free memory
+ SQL_FREERESULT($result);
+ $uid = 0;
+
+ // If no account was found set default refid and status to CONFIRMED
+ if (empty($GLOBALS['refid'])) { $GLOBALS['refid'] = $CONFIG['def_refid']; $status = "CONFIRMED"; }
+
+ // Begin with doubler script...
+ if (isset($_POST['ok']))
+ {
+ // Secure points (so only integer/double values are allowed
+ $_POST['points'] = bigintval($_POST['points']);
+
+ // Begin with doubling process
+ if ((!empty($_POST['userid'])) && (!empty($_POST['pass'])) && (!empty($_POST['points'])))
+ {
+ // Probe for nickname extension and if a nickname was entered
+ $probe_nickname = ((EXT_IS_ACTIVE("nickname")) && (("".round($_POST['userid'])."") != $_POST['userid']));
+ if ($probe_nickname)
+ {
+ // Nickname in URL, so load the ID
+ $result = SQL_QUERY_ESC("SELECT userid, status, password FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1",
+ array($_POST['userid']), __FILE__, __LINE__);
+ }
+ else
+ {
+ // Direct userid entered
+ $result = SQL_QUERY_ESC("SELECT userid, status, password FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
+ array(bigintval($_POST['userid'])), __FILE__, __LINE__);
+ }
+
+ // Load data
+ list($uid, $status, $password) = SQL_FETCHROW($result);
+ $uid = bigintval($uid);
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Remove any dots and unwanted chars from the points
+ $_POST['points'] = bigintval(round(str_replace(",", ".", $_POST['points'])));
+
+ // Probe for enough points
+ $probe_points = (($_POST['points'] >= $CONFIG['doubler_min']) && ($_POST['points'] <= $CONFIG['doubler_max']));
+
+ // Check all together
+ if ((!empty($uid)) && ($password == generateHash($_POST['pass'], substr($password, 0, -40))) && ($status == "CONFIRMED") && ($probe_points))
+ {
+ // Nickname resolved to a unique userid or direct userid entered by the member
+ $DOUBLER_UID = $uid;
+
+ // Calulcate points
+ $POINTS = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
+
+ // So let's continue with probing his points amount
+ if (($POINTS - $CONFIG['doubler_left'] - $_POST['points'] * $CONFIG['doubler_charge']) >= 0)
+ {
+ // Enough points are left so let's continue with the doubling process
+ // Create doubling "account" width *DOUBLED* points
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s', '%s', '%s', '".$_SERVER['REMOTE_ADDR']."', UNIX_TIMESTAMP(), 'N', 'N')",
+ array($uid, bigintval($GLOBALS['refid']), bigintval($_POST['points'] * 2)), __FILE__, __LINE__);
+
+ // Subtract entered points
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET used_points=used_points+%s WHERE userid=%d LIMIT 1",
+ array($_POST['points'], $uid), __FILE__, __LINE__);
+
+ // Update mediadata as well
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4")
+ {
+ // Update database
+ MEDIA_UPDATE_ENTRY(array("total_points"), "sub", $_POST['points']);
+ }
+
+ // Add points to "total payed" including charge
+ $points = $_POST['points'] - $_POST['points'] * $CONFIG['doubler_charge'];
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_points=doubler_points+%s WHERE config='0' LIMIT 1",
+ array($points), __FILE__, __LINE__);
+ $CONFIG['doubler_points'] += $points;
+
+ // Destroy cache
+ if (GET_EXT_VERSION("cache") >= "0.1.2")
+ {
+ if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy();
+ }
+
+ // Add second line for the referral but only when uid != refid
+ if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid))
+ {
+ // Okay add a refid line and apply refid percents
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s', '0', '%s', '".$_SERVER['REMOTE_ADDR']."', UNIX_TIMESTAMP(), 'N', 'Y')",
+ array(bigintval($GLOBALS['refid']), bigintval($_POST['points'] * 2 * $CONFIG['doubler_ref'])), __FILE__, __LINE__);
+
+ // And that's why we dont't want to you more than one referral level of doubler-points. ^^^
+ }
+
+ // Update usage counter
+ $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET doubler_counter=doubler_counter+1 WHERE config='0' LIMIT 1", __FILE__, __LINE__);
+ $CONFIG['doubler_counter']++;
+
+ // Set constant
+ define('__DOUBLER_MSG', LOAD_TEMPLATE("doubler_reflink", true, $_POST['userid']));
+ }
+ else
+ {
+ // Not enougth points left
+ define('__ERROR_MSG', DOUBLER_FORM_NO_POINTS_LEFT);
+ }
+
+ }
+ elseif ($status == "CONFIRMED")
+ {
+ // Account is unconfirmed!
+ define('__ERROR_MSG', DOUBLER_FORM_WRONG_PASS);
+ }
+ elseif ($status == "UNCONFIRMED")
+ {
+ // Account is unconfirmed!
+ define('__ERROR_MSG', DOUBLER_FORM_STATUS_UNCONFIRMED);
+ }
+ elseif ($status == "LOCKED")
+ {
+ // Account is locked by admin / holiday!
+ define('__ERROR_MSG', DOUBLER_FORM_STATUS_LOCKED);
+ }
+ elseif ($_POST['points'] < $CONFIG['doubler_min'])
+ {
+ // Not enougth points entered
+ define('__ERROR_MSG', DOUBLER_FORM_POINTS_MIN);
+ }
+ elseif ($_POST['points'] > $CONFIG['doubler_max'])
+ {
+ // Too much points entered
+ define('__ERROR_MSG', DOUBLER_FORM_POINTS_MAX);
+ }
+ elseif ($probe_nickname)
+ {
+ // Cannot resolv nickname -> userid
+ define('__ERROR_MSG', DOUBLER_FORM_404_NICKNAME);
+ }
+ else
+ {
+ // Wrong password or account not found
+ define('__ERROR_MSG', DOUBLER_FORM_404_MEMBER);
+ }
+ }
+ elseif (empty($_POST['userid']))
+ {
+ // Login not entered
+ define('__ERROR_MSG', DOUBLER_FORM_404_LOGIN);
+ }
+ elseif (empty($_POST['pass']))
+ {
+ // Password not entered
+ define('__ERROR_MSG', DOUBLER_FORM_404_PASSWORD);
+ }
+ elseif (empty($_POST['points']))
+ {
+ // points not entered
+ define('__ERROR_MSG', DOUBLER_FORM_404_POINTS);
+ }
+ }
+
+ // Set messages to nothing
+ if (!defined('__DOUBLER_MSG')) define('__DOUBLER_MSG', "");
+ if (!defined('__ERROR_MSG')) define('__ERROR_MSG' , "");
+
+ // Shall I check for points immediately?
+ if ($CONFIG['doubler_send_mode'] == "DIRECT") require(PATH."inc/doubler_send.php");
+
+ // Output header
+ include(PATH."inc/header.php");
+
+ // Banner in text
+ define('__DOUBLER_BANNER', LOAD_TEMPLATE("doubler_banner", true));
+
+ // Load header/footer templates
+ define('__DOUBLER_HEADER', LOAD_TEMPLATE("doubler_header", true));
+ define('__DOUBLER_FOOTER', LOAD_TEMPLATE("doubler_footer", true));
+
+ if (!empty($uid))
+ {
+ // Transfer userid/nickname to constant
+ define('__REFID', $uid);
+ }
+ elseif (!empty($GLOBALS['refid']))
+ {
+ // Transfer userid/nickname to constant
+ define('__REFID', $GLOBALS['refid']);
+ }
+ else
+ {
+ // Transfer default refid to constant
+ define('__REFID', $CONFIG['def_refid']);
+ }
+
+ // Percent values etc.
+ define('__CHARGE_VALUE', TRANSLATE_COMMA($CONFIG['doubler_charge'] * 100));
+ define('__REF_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_ref'] * 100));
+ define('__TOTAL_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_points']));
+ define('__MIN_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_min']));
+ define('__MAX_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_max']));
+
+ // Text "Enter login"
+ if (EXT_IS_ACTIVE("nickname"))
+ {
+ // Choose login/nickname
+ define('DOUBLER_ENTER_LOGIN', GUEST_ENTER_LOGIN_NICKNAME);
+ }
+ else
+ {
+ // Simple login ID
+ define('DOUBLER_ENTER_LOGIN', GUEST_ENTER_LOGIN);
+ }
+
+ // Which mail-send-mode did the admin setup?
+ switch ($CONFIG['doubler_send_mode'])
+ {
+ case "DIRECT":
+ define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_DIRECT);
+ break;
+
+ case "RESET":
+ define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_RESET);
+ break;
+ }
+
+ // Generate table with already payed out doubles
+ define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE("0", "Y", "N", "DESC"));
+
+ // Generate timemark
+ define('__TIMEOUT_MARK', CREATE_FANCY_TIME($CONFIG['doubler_timeout']));
+
+ // Usage counter
+ define('__DOUBLER_COUNTER', $CONFIG['doubler_counter']);
+
+ // Points left to doubler
+ define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));
+
+ // Output neccessary form for this
+ LOAD_TEMPLATE("doubler_index");
+
+ // Output footer
+ include(PATH."inc/footer.php");
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL(URL."/install.php");
+}
+
+// Really all done here... ;-)
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 10/12/2003 *\r
- * =============== Last change: 10/12/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : img.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Image code for multi-purposes *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Code-Bild fuer verschiedene Zwecke *\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
-// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )\r
-require_once("inc/libs/security_functions.php");\r
-\r
-// Init "action" and "what"\r
-global $what, $action;\r
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";\r
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);\r
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);\r
-\r
-// Set�module\r
-$GLOBALS['module'] = "img"; $CSS = -1;\r
-\r
-// Load the required file(s)\r
-require ("inc/config.php");\r
-\r
-if (defined('mxchange_installed') && (mxchange_installed))\r
-{\r
- if (!empty($_GET['code']))\r
- {\r
- // Generate image\r
- GENERATE_IMAGE(bigintval($_GET['code']));\r
- }\r
-}\r
- else\r
-{\r
- // You have to configure first!\r
- LOAD_URL("install.php");\r
-}\r
-\r
-// Really all done here... ;-)\r
-die();\r
-\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 10/12/2003 *
+ * =============== Last change: 10/12/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : img.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Image code for multi-purposes *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Code-Bild fuer verschiedene Zwecke *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 *
+ ************************************************************************/
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
+if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
+
+// Set�module
+$GLOBALS['module'] = "img"; $CSS = -1;
+
+// Load the required file(s)
+require ("inc/config.php");
+
+if (defined('mxchange_installed') && (mxchange_installed))
+{
+ if (!empty($_GET['code']))
+ {
+ // Generate image
+ GENERATE_IMAGE(bigintval($_GET['code']));
+ }
+}
+ else
+{
+ // You have to configure first!
+ LOAD_URL("install.php");
+}
+
+// Really all done here... ;-)
+die();
+
+//
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 05/29/2004 *\r
- * =============== Last change: 11/26/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : autopurge.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Automatical purging of outdated mail links *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Auto-Loeschung von veralteten Mail-Links *\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
-if (($CONFIG['auto_purge_active'] == "Y") && ($CONFIG['auto_purge'] > 0))\r
-{\r
- // First calculate the timestamp\r
- if (function_exists('CREATE_TIME_SELECTIONS'))\r
- {\r
- $PURGE = time() - $CONFIG['auto_purge'];\r
- }\r
- else\r
- {\r
- $PURGE = time() - $CONFIG['auto_purge'] * 24 * 60 * 60;\r
- }\r
-\r
- // Init variables\r
- $admin_points = "0";\r
-\r
- // Then check for outdated mail order. We don't delete them just the confirmation links will be deleted.\r
- $result = SQL_QUERY_ESC("SELECT s.id, s.userid, s.pool_id, t.price\r
-FROM "._MYSQL_PREFIX."_user_stats AS s\r
-LEFT JOIN "._MYSQL_PREFIX."_payments AS t\r
-ON s.payment_id=t.id\r
-WHERE s.timestamp_ordered <= %s ORDER BY s.userid",\r
- array(bigintval($PURGE)), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result) > 0)\r
- {\r
- // Start deleting procedure\r
- $uid = "0"; $points = "0";\r
- while(list($mid, $sender, $pool, $price) = SQL_FETCHROW($result))\r
- {\r
- // Check if confirmation links are purged or not\r
- $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d LIMIT 1",\r
- array(bigintval($mid)), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result_links) == 1)\r
- {\r
- // Free memory\r
- SQL_FREERESULT($result_links);\r
-\r
- // At least one link was found, enougth to pay back the points\r
- if (($uid != $sender) && ($uid > 0) && ($points > 0))\r
- {\r
- // Directly add points back to senders account\r
- AUTOPURGE_ADD_POINTS($uid, $points);\r
- $points = "0";\r
- }\r
- // Add points\r
- $uid = $sender; $points += $price; $admin_points += $price;\r
-\r
- // Remove confirmation links from queue\r
- $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d",\r
- array(bigintval($mid)), __FILE__, __LINE__);\r
-\r
- // Update status of order\r
- $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='DELETED' WHERE id=%d LIMIT 1",\r
- array(bigintval($pool)), __FILE__, __LINE__);\r
- }\r
- }\r
-\r
- // Add last points to last user account\r
- if ($points > 0) AUTOPURGE_ADD_POINTS($uid, $points);\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- // Is the 'bonus' extension installed and activated?\r
- if (EXT_IS_ACTIVE("bonus", true))\r
- {\r
- // Check for bonus campaigns\r
- $result = SQL_QUERY_ESC("SELECT id, points FROM "._MYSQL_PREFIX."_bonus WHERE data_type='SEND' AND timestamp <= %s ORDER BY id",\r
- array(bigintval($PURGE)), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result) > 0)\r
- {\r
- // Start deleting procedure\r
- $points = "0";\r
- while (list($bid, $price) = SQL_FETCHROW($result))\r
- {\r
- // Check if confirmation links are purged or not\r
- $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%d",\r
- array(bigintval($bid)), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result_links) > 0)\r
- {\r
- // At least one link was found, enougth to pay back the points\r
- $points += $price * SQL_NUMROWS($result_links);\r
-\r
- // Free memory\r
- SQL_FREERESULT($result_links);\r
-\r
- // Remove confirmation links from queue\r
- $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%d",\r
- array(bigintval($bid)), __FILE__, __LINE__);\r
-\r
- // Update status of order\r
- $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET data_type='DELETED' WHERE id=%d LIMIT 1",\r
- array(bigintval($bid)), __FILE__, __LINE__);\r
- }\r
- }\r
-\r
- // Add points to jackpot\r
- ADD_JACKPOT($points);\r
-\r
- // Add points for the admin\r
- $admin_points += $points;\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result);\r
- }\r
-\r
- // Add points from deleted accounts to jackpot, but here just add to notify mail\r
- if ($admin_points > 0)\r
- {\r
- // Send mail to admin\r
- if (GET_EXT_VERSION("admins") >= "0.4.1")\r
- {\r
- SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_SUBJECT, "admin_autopurge_points", TRANSLATE_COMMA($points), "0");\r
- }\r
- else\r
- {\r
- $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_points", TRANSLATE_COMMA($points), "0");\r
- SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_SUBJECT, $msg);\r
- }\r
- }\r
-}\r
-\r
-// Shall I look for inactive accounts and autopurge inactive accounts?\r
-if ($CONFIG['ap_inactive'] == "Y")\r
-{\r
- // Ok, let's have a look...\r
- $since = bigintval(time() - $CONFIG['ap_in_since']);\r
- $EXCLUDE_LIST = " AND d.userid != c.def_refid";\r
-\r
- // Check for more extensions\r
- if (EXT_IS_ACTIVE("beg")) $EXCLUDE_LIST .= " AND d.userid != c.beg_uid";\r
- if (EXT_IS_ACTIVE("bonus")) $EXCLUDE_LIST .= " AND d.userid != c.bonus_uid";\r
- if (EXT_IS_ACTIVE("doubler")) $EXCLUDE_LIST .= " AND d.userid != c.doubler_uid";\r
-\r
- // Check for new holiday extension\r
- if (GET_EXT_VERSION("holiday") >= "0.1.3")\r
- {\r
- $EXCLUDE_LIST .= " AND d.holiday_active = 'N'";\r
- }\r
-\r
- // Check for all accounts\r
- $result_inactive = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.email, d.last_online\r
-FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c\r
-WHERE d.status='CONFIRMED' AND d.joined < %s AND d.last_online < %s AND d.ap_notified < %s\r
-".$EXCLUDE_LIST."\r
-ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);\r
-\r
- if (SQL_NUMROWS($result_inactive) > 0)\r
- {\r
- // Prepare variables and constants...\r
- $UIDs = "";\r
- define('__INACTIVE_SINCE', ($CONFIG['ap_in_since'] / 60 / 60));\r
- define('__INACTIVE_TIME' , ($CONFIG['ap_in_time'] / 60 / 60));\r
-\r
- // Mark found accounts as inactive and send an email\r
- while(list($uid, $email, $last) = SQL_FETCHROW($result_inactive))\r
- {\r
- // Remember userids for the admin\r
- $UIDs .= $uid.", ";\r
-\r
- // Get date/time from timestamp\r
- $last = MAKE_DATETIME($last, "0");\r
-\r
- // Load mail template\r
- $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $last, bigintval($uid));\r
- SEND_EMAIL($email, AUTOPURGE_MEMBER_INACTIVE_SUBJECT, $msg);\r
-\r
- // Update this account\r
- $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%d LIMIT 1",\r
- array(bigintval($uid)), __FILE__, __LINE__);\r
- }\r
-\r
- // Remove last comma\r
- $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));\r
-\r
- // Send mail notification to admin\r
- if (GET_EXT_VERSION("admins") >= "0.4.1")\r
- {\r
- SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_INACTIVE_SUBJECT, "admin_autopurge_inactive", $UIDs, "");\r
- }\r
- else\r
- {\r
- $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_inactive", $UIDs, "");\r
- SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_INACTIVE_SUBJECT, $msg);\r
- }\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result_inactive);\r
-\r
- // Now let's have a look for inactive accounts we want to delete we newly use the same exclude list\r
- // here for e.g. excluding holiday users\r
- $time = bigintval(time() - $CONFIG['ap_in_time']);\r
- $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online\r
-FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c\r
-WHERE status='CONFIRMED' AND joined < %s AND last_online< %s AND ap_notified < %s\r
-".$EXCLUDE_LIST."\r
-ORDER BY userid",\r
- array($since, $since, $time), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result_inactive) > 0)\r
- {\r
- // Prepare variable...\r
- $UIDs = "";\r
-\r
- // Delete inactive accounts\r
- while (list($uid, $email, $last) = SQL_FETCHROW($result_inactive))\r
- {\r
- // Remember userids for the admin\r
- $UIDs .= $uid.", ";\r
-\r
- // Get date/time from timestamp\r
- $last = MAKE_DATETIME($last, "0");\r
-\r
- // Finnaly delete this inactive account\r
- DELETE_USER_ACCOUNT(bigintval($uid), LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $last, ""));\r
- }\r
-\r
- // Remove last comma\r
- $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));\r
-\r
- // Send mail notification to admin\r
- if ($CONFIG['ap_un_mail'] == "Y")\r
- {\r
- if (GET_EXT_VERSION("admins") >= "0.4.1")\r
- {\r
- SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_DELETE_SUBJECT, "admin_autopurge_delete", $UIDs, "");\r
- }\r
- else\r
- {\r
- $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_delete", $UIDs, "");\r
- SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_DELETE_SUBJECT, $msg);\r
- }\r
- }\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result_inactive);\r
-}\r
-\r
-// Shall I auto-purge unconfirmed accounts?\r
-if ($CONFIG['ap_unconfirmed'] == "Y")\r
-{\r
- // Init variables and find unconfirmed accounts which I shall auto-purge\r
- $time = bigintval(time() - $CONFIG['ap_un_time']);\r
- $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined FROM "._MYSQL_PREFIX."_user_data WHERE status='UNCONFIRMED' AND joined < %s ORDER BY userid",\r
- array($time), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result_uncon) > 0)\r
- {\r
- // Prepare variable...\r
- $UIDs = "";\r
- define('__UNCONFIRMED_TIME' , ($CONFIG['ap_un_time'] / 60 / 60));\r
-\r
- // Delete inactive accounts\r
- while (list($uid, $email, $joined) = SQL_FETCHROW($result_uncon))\r
- {\r
- // Remember userids for the admin\r
- $UIDs .= $uid.", ";\r
-\r
- // Get date/time from timestamp\r
- $joined = MAKE_DATETIME($joined, "0");\r
-\r
- // Finnaly delete this inactive account\r
- DELETE_USER_ACCOUNT($uid, LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $joined, ""));\r
- }\r
-\r
- // Remove last comma\r
- $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));\r
-\r
- // Send mail notification to admin\r
- if ($CONFIG['ap_un_mail'] == "Y")\r
- {\r
- if (GET_EXT_VERSION("admins") >= "0.4.1")\r
- {\r
- SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT, "admin_autopurge_unconfirmed", $UIDs, "");\r
- }\r
- else\r
- {\r
- $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_unconfirmed", $UIDs, "");\r
- SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT, $msg);\r
- }\r
- }\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result_uncon);\r
-}\r
-\r
-// Check version (must be > 0.0)\r
-if ((GET_EXT_VERSION("task") > "0.0") && ($CONFIG['ap_tasks'] == "Y"))\r
-{\r
- // Purge deleted tasks (no notification to admin)\r
- $since = bigintval(time() - $CONFIG['ap_tasks_time']);\r
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE status='DELETED' AND task_created <= %s",\r
- array($since), __FILE__, __LINE__);\r
- $DELETED = SQL_AFFECTEDROWS();\r
-\r
- if (($DELETED > 0) && ($CONFIG['ap_tasks_mail'] == "Y"))\r
- {\r
- // Send out email to admin\r
- if (GET_EXT_VERSION("admins") >= "0.4.1")\r
- {\r
- SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_TASKS_SUBJECT, "admin_autopurge_tsks", $DELETED, "");\r
- }\r
- else\r
- {\r
- $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_tsks", $DELETED, "");\r
- SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_TASKS_SUBJECT, $msg);\r
- }\r
- }\r
-}\r
-\r
-// Search for mails from deleted members?\r
-if ($CONFIG['ap_del_mails'])\r
-{\r
- // Okay, let's check for them...\r
- $since = bigintval(time() - $CONFIG['ap_dm_timeout']);\r
- $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",\r
- array($since), __FILE__, __LINE__);\r
-\r
- // Reset counter...\r
- $DELETED = 0;\r
-\r
- // Do we have "purged" mails?\r
- if (SQL_NUMROWS($result_mails) > 0)\r
- {\r
- // Okay, check for their sender's\r
- while(list($sender) = SQL_FETCHROW($result_mails))\r
- {\r
- // Check now...\r
- $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));\r
- if ($found == 0)\r
- {\r
- // Okay we found some mails!\r
- $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE sender=%d",\r
- array(bigintval($sender)), __FILE__, __LINE__);\r
- $DELETED += SQL_AFFECTEDROWS();\r
-\r
- // Reset query (to prevent possible errors) ...\r
- $since = bigintval(time() - $CONFIG['ap_dm_timeout']);\r
- $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",\r
- array($since), __FILE__, __LINE__);\r
- }\r
- }\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result_mails);\r
-\r
- // Now let's check for stats entries as well\r
- $since = bigintval(time() - $CONFIG['ap_dm_timeout']);\r
- $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",\r
- array($since), __FILE__, __LINE__);\r
-\r
- // Do we have "purged" mails?\r
- if (SQL_NUMROWS($result_mails) > 0)\r
- {\r
- // Okay, check for their sender's\r
- while(list($sender) = SQL_FETCHROW($result_mails))\r
- {\r
- // Check now...\r
- $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));\r
- if ($found == 0)\r
- {\r
- // Okay we found some mails!\r
- $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE sender=%d", array(bigintval($sender)), __FILE__, __LINE__);\r
- $DELETED += SQL_AFFECTEDROWS();\r
-\r
- // Reset query (to prevent possible errors) ...\r
- $since = bigintval(time() - $CONFIG['ap_dm_timeout']);\r
- $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_user_stats WHERE data_type='DELETED' AND timestamp_send <= %s ORDER BY sender",\r
- array($since), __FILE__, __LINE__);\r
- }\r
- }\r
- }\r
-\r
- // Free memory\r
- SQL_FREERESULT($result_mails);\r
-\r
- // Do we have deleted mails and the admin want's to receive a notification\r
- if (($DELETED > 0) && ($CONFIG['ap_dm_notify'] == "Y"))\r
- {\r
- // Send out email to admin\r
- if (GET_EXT_VERSION("admins") >= "0.4.1")\r
- {\r
- SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, "admin_autopurge_del_mails", $DELETED, "");\r
- }\r
- else\r
- {\r
- $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_del_mails", $DELETED, "");\r
- SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, $msg);\r
- }\r
- }\r
-}\r
-\r
-if (EXT_IS_ACTIVE("rallye"))\r
-{\r
- // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)\r
- require_once(PATH."inc/libs/rallye_functions.php");\r
- RALLYE_DELETE_EXPIRED_RALLYES();\r
-}\r
-//\r
-if (EXT_IS_ACTIVE("bonus"))\r
-{\r
- // Check for expired turbo bonus lines\r
- require_once(PATH."inc/libs/bonus_functions.php");\r
- BONUS_PURGE_EXPIRED_TURBO_BONUS();\r
-}\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 05/29/2004 *
+ * =============== Last change: 11/26/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : autopurge.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Automatical purging of outdated mail links *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Auto-Loeschung von veralteten Mail-Links *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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);
+}
+
+if (($CONFIG['auto_purge_active'] == "Y") && ($CONFIG['auto_purge'] > 0))
+{
+ // First calculate the timestamp
+ if (function_exists('CREATE_TIME_SELECTIONS'))
+ {
+ $PURGE = time() - $CONFIG['auto_purge'];
+ }
+ else
+ {
+ $PURGE = time() - $CONFIG['auto_purge'] * 24 * 60 * 60;
+ }
+
+ // Init variables
+ $admin_points = "0";
+
+ // Then check for outdated mail order. We don't delete them just the confirmation links will be deleted.
+ $result = SQL_QUERY_ESC("SELECT s.id, s.userid, s.pool_id, t.price
+FROM "._MYSQL_PREFIX."_user_stats AS s
+LEFT JOIN "._MYSQL_PREFIX."_payments AS t
+ON s.payment_id=t.id
+WHERE s.timestamp_ordered <= %s ORDER BY s.userid",
+ array(bigintval($PURGE)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) > 0)
+ {
+ // Start deleting procedure
+ $uid = "0"; $points = "0";
+ while(list($mid, $sender, $pool, $price) = SQL_FETCHROW($result))
+ {
+ // Check if confirmation links are purged or not
+ $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d LIMIT 1",
+ array(bigintval($mid)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_links) == 1)
+ {
+ // Free memory
+ SQL_FREERESULT($result_links);
+
+ // At least one link was found, enougth to pay back the points
+ if (($uid != $sender) && ($uid > 0) && ($points > 0))
+ {
+ // Directly add points back to senders account
+ AUTOPURGE_ADD_POINTS($uid, $points);
+ $points = "0";
+ }
+ // Add points
+ $uid = $sender; $points += $price; $admin_points += $price;
+
+ // Remove confirmation links from queue
+ $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d",
+ array(bigintval($mid)), __FILE__, __LINE__);
+
+ // Update status of order
+ $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='DELETED' WHERE id=%d LIMIT 1",
+ array(bigintval($pool)), __FILE__, __LINE__);
+ }
+ }
+
+ // Add last points to last user account
+ if ($points > 0) AUTOPURGE_ADD_POINTS($uid, $points);
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Is the 'bonus' extension installed and activated?
+ if (EXT_IS_ACTIVE("bonus", true))
+ {
+ // Check for bonus campaigns
+ $result = SQL_QUERY_ESC("SELECT id, points FROM "._MYSQL_PREFIX."_bonus WHERE data_type='SEND' AND timestamp <= %s ORDER BY id",
+ array(bigintval($PURGE)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) > 0)
+ {
+ // Start deleting procedure
+ $points = "0";
+ while (list($bid, $price) = SQL_FETCHROW($result))
+ {
+ // Check if confirmation links are purged or not
+ $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%d",
+ array(bigintval($bid)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_links) > 0)
+ {
+ // At least one link was found, enougth to pay back the points
+ $points += $price * SQL_NUMROWS($result_links);
+
+ // Free memory
+ SQL_FREERESULT($result_links);
+
+ // Remove confirmation links from queue
+ $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%d",
+ array(bigintval($bid)), __FILE__, __LINE__);
+
+ // Update status of order
+ $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET data_type='DELETED' WHERE id=%d LIMIT 1",
+ array(bigintval($bid)), __FILE__, __LINE__);
+ }
+ }
+
+ // Add points to jackpot
+ ADD_JACKPOT($points);
+
+ // Add points for the admin
+ $admin_points += $points;
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+ }
+
+ // Add points from deleted accounts to jackpot, but here just add to notify mail
+ if ($admin_points > 0)
+ {
+ // Send mail to admin
+ if (GET_EXT_VERSION("admins") >= "0.4.1")
+ {
+ SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_SUBJECT, "admin_autopurge_points", TRANSLATE_COMMA($points), "0");
+ }
+ else
+ {
+ $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_points", TRANSLATE_COMMA($points), "0");
+ SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_SUBJECT, $msg);
+ }
+ }
+}
+
+// Shall I look for inactive accounts and autopurge inactive accounts?
+if ($CONFIG['ap_inactive'] == "Y")
+{
+ // Ok, let's have a look...
+ $since = bigintval(time() - $CONFIG['ap_in_since']);
+ $EXCLUDE_LIST = " AND d.userid != c.def_refid";
+
+ // Check for more extensions
+ if (EXT_IS_ACTIVE("beg")) $EXCLUDE_LIST .= " AND d.userid != c.beg_uid";
+ if (EXT_IS_ACTIVE("bonus")) $EXCLUDE_LIST .= " AND d.userid != c.bonus_uid";
+ if (EXT_IS_ACTIVE("doubler")) $EXCLUDE_LIST .= " AND d.userid != c.doubler_uid";
+
+ // Check for new holiday extension
+ if (GET_EXT_VERSION("holiday") >= "0.1.3")
+ {
+ $EXCLUDE_LIST .= " AND d.holiday_active = 'N'";
+ }
+
+ // Check for all accounts
+ $result_inactive = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.email, d.last_online
+FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c
+WHERE d.status='CONFIRMED' AND d.joined < %s AND d.last_online < %s AND d.ap_notified < %s
+".$EXCLUDE_LIST."
+ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
+
+ if (SQL_NUMROWS($result_inactive) > 0)
+ {
+ // Prepare variables and constants...
+ $UIDs = "";
+ define('__INACTIVE_SINCE', ($CONFIG['ap_in_since'] / 60 / 60));
+ define('__INACTIVE_TIME' , ($CONFIG['ap_in_time'] / 60 / 60));
+
+ // Mark found accounts as inactive and send an email
+ while(list($uid, $email, $last) = SQL_FETCHROW($result_inactive))
+ {
+ // Remember userids for the admin
+ $UIDs .= $uid.", ";
+
+ // Get date/time from timestamp
+ $last = MAKE_DATETIME($last, "0");
+
+ // Load mail template
+ $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $last, bigintval($uid));
+ SEND_EMAIL($email, AUTOPURGE_MEMBER_INACTIVE_SUBJECT, $msg);
+
+ // Update this account
+ $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET ap_notified=UNIX_TIMESTAMP() WHERE userid=%d LIMIT 1",
+ array(bigintval($uid)), __FILE__, __LINE__);
+ }
+
+ // Remove last comma
+ $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
+
+ // Send mail notification to admin
+ if (GET_EXT_VERSION("admins") >= "0.4.1")
+ {
+ SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_INACTIVE_SUBJECT, "admin_autopurge_inactive", $UIDs, "");
+ }
+ else
+ {
+ $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_inactive", $UIDs, "");
+ SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_INACTIVE_SUBJECT, $msg);
+ }
+ }
+
+ // Free memory
+ SQL_FREERESULT($result_inactive);
+
+ // Now let's have a look for inactive accounts we want to delete we newly use the same exclude list
+ // here for e.g. excluding holiday users
+ $time = bigintval(time() - $CONFIG['ap_in_time']);
+ $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online
+FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c
+WHERE status='CONFIRMED' AND joined < %s AND last_online< %s AND ap_notified < %s
+".$EXCLUDE_LIST."
+ORDER BY userid",
+ array($since, $since, $time), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_inactive) > 0)
+ {
+ // Prepare variable...
+ $UIDs = "";
+
+ // Delete inactive accounts
+ while (list($uid, $email, $last) = SQL_FETCHROW($result_inactive))
+ {
+ // Remember userids for the admin
+ $UIDs .= $uid.", ";
+
+ // Get date/time from timestamp
+ $last = MAKE_DATETIME($last, "0");
+
+ // Finnaly delete this inactive account
+ DELETE_USER_ACCOUNT(bigintval($uid), LOAD_EMAIL_TEMPLATE("member_autopurge_delete", $last, ""));
+ }
+
+ // Remove last comma
+ $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
+
+ // Send mail notification to admin
+ if ($CONFIG['ap_un_mail'] == "Y")
+ {
+ if (GET_EXT_VERSION("admins") >= "0.4.1")
+ {
+ SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_DELETE_SUBJECT, "admin_autopurge_delete", $UIDs, "");
+ }
+ else
+ {
+ $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_delete", $UIDs, "");
+ SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_DELETE_SUBJECT, $msg);
+ }
+ }
+ }
+
+ // Free memory
+ SQL_FREERESULT($result_inactive);
+}
+
+// Shall I auto-purge unconfirmed accounts?
+if ($CONFIG['ap_unconfirmed'] == "Y")
+{
+ // Init variables and find unconfirmed accounts which I shall auto-purge
+ $time = bigintval(time() - $CONFIG['ap_un_time']);
+ $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined FROM "._MYSQL_PREFIX."_user_data WHERE status='UNCONFIRMED' AND joined < %s ORDER BY userid",
+ array($time), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_uncon) > 0)
+ {
+ // Prepare variable...
+ $UIDs = "";
+ define('__UNCONFIRMED_TIME' , ($CONFIG['ap_un_time'] / 60 / 60));
+
+ // Delete inactive accounts
+ while (list($uid, $email, $joined) = SQL_FETCHROW($result_uncon))
+ {
+ // Remember userids for the admin
+ $UIDs .= $uid.", ";
+
+ // Get date/time from timestamp
+ $joined = MAKE_DATETIME($joined, "0");
+
+ // Finnaly delete this inactive account
+ DELETE_USER_ACCOUNT($uid, LOAD_EMAIL_TEMPLATE("member_autopurge_unconfirmed", $joined, ""));
+ }
+
+ // Remove last comma
+ $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
+
+ // Send mail notification to admin
+ if ($CONFIG['ap_un_mail'] == "Y")
+ {
+ if (GET_EXT_VERSION("admins") >= "0.4.1")
+ {
+ SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT, "admin_autopurge_unconfirmed", $UIDs, "");
+ }
+ else
+ {
+ $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_unconfirmed", $UIDs, "");
+ SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT, $msg);
+ }
+ }
+ }
+
+ // Free memory
+ SQL_FREERESULT($result_uncon);
+}
+
+// Check version (must be > 0.0)
+if ((GET_EXT_VERSION("task") > "0.0") && ($CONFIG['ap_tasks'] == "Y"))
+{
+ // Purge deleted tasks (no notification to admin)
+ $since = bigintval(time() - $CONFIG['ap_tasks_time']);
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE status='DELETED' AND task_created <= %s",
+ array($since), __FILE__, __LINE__);
+ $DELETED = SQL_AFFECTEDROWS();
+
+ if (($DELETED > 0) && ($CONFIG['ap_tasks_mail'] == "Y"))
+ {
+ // Send out email to admin
+ if (GET_EXT_VERSION("admins") >= "0.4.1")
+ {
+ SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_TASKS_SUBJECT, "admin_autopurge_tsks", $DELETED, "");
+ }
+ else
+ {
+ $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_tsks", $DELETED, "");
+ SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_TASKS_SUBJECT, $msg);
+ }
+ }
+}
+
+// Search for mails from deleted members?
+if ($CONFIG['ap_del_mails'])
+{
+ // Okay, let's check for them...
+ $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+ $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",
+ array($since), __FILE__, __LINE__);
+
+ // Reset counter...
+ $DELETED = 0;
+
+ // Do we have "purged" mails?
+ if (SQL_NUMROWS($result_mails) > 0)
+ {
+ // Okay, check for their sender's
+ while(list($sender) = SQL_FETCHROW($result_mails))
+ {
+ // Check now...
+ $fount = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));
+ if ($found == 0)
+ {
+ // Okay we found some mails!
+ $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE sender=%d",
+ array(bigintval($sender)), __FILE__, __LINE__);
+ $DELETED += SQL_AFFECTEDROWS();
+
+ // Reset query (to prevent possible errors) ...
+ $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+ $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",
+ array($since), __FILE__, __LINE__);
+ }
+ }
+ }
+
+ // Free memory
+ SQL_FREERESULT($result_mails);
+
+ // Now let's check for stats entries as well
+ $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+ $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_pool WHERE data_type='DELETED' AND timestamp <= %s ORDER BY sender",
+ array($since), __FILE__, __LINE__);
+
+ // Do we have "purged" mails?
+ if (SQL_NUMROWS($result_mails) > 0)
+ {
+ // Okay, check for their sender's
+ while(list($sender) = SQL_FETCHROW($result_mails))
+ {
+ // Check now...
+ $found = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1", array(bigintval($sender)), __FILE__, __LINE__));
+ if ($found == 0)
+ {
+ // Okay we found some mails!
+ $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE sender=%d", array(bigintval($sender)), __FILE__, __LINE__);
+ $DELETED += SQL_AFFECTEDROWS();
+
+ // Reset query (to prevent possible errors) ...
+ $since = bigintval(time() - $CONFIG['ap_dm_timeout']);
+ $result_mails = SQL_QUERY_ESC("SELECT sender FROM "._MYSQL_PREFIX."_user_stats WHERE data_type='DELETED' AND timestamp_send <= %s ORDER BY sender",
+ array($since), __FILE__, __LINE__);
+ }
+ }
+ }
+
+ // Free memory
+ SQL_FREERESULT($result_mails);
+
+ // Do we have deleted mails and the admin want's to receive a notification
+ if (($DELETED > 0) && ($CONFIG['ap_dm_notify'] == "Y"))
+ {
+ // Send out email to admin
+ if (GET_EXT_VERSION("admins") >= "0.4.1")
+ {
+ SEND_ADMIN_EMAILS_PRO(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, "admin_autopurge_del_mails", $DELETED, "");
+ }
+ else
+ {
+ $msg = LOAD_EMAIL_TEMPLATE("admin_autopurge_del_mails", $DELETED, "");
+ SEND_ADMIN_EMAILS(AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT, $msg);
+ }
+ }
+}
+
+if (EXT_IS_ACTIVE("rallye"))
+{
+ // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
+ require_once(PATH."inc/libs/rallye_functions.php");
+ RALLYE_DELETE_EXPIRED_RALLYES();
+}
+//
+if (EXT_IS_ACTIVE("bonus"))
+{
+ // Check for expired turbo bonus lines
+ require_once(PATH."inc/libs/bonus_functions.php");
+ BONUS_PURGE_EXPIRED_TURBO_BONUS();
+}
+//
+?>
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 08/25/2003 *\r
- * =============== Last change: 04/16/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : config.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Your configuration data (MySQL) *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Ihre Konfigurationsdaten (MySQL) *\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 (!defined('__SECURITY'))\r
-{\r
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
- require($INC);\r
-}\r
-\r
-/************************************************************************\r
- * PLEASE DO NOT EDIT THE COMMENTS! install.php NEEDS THEM! *\r
- ************************************************************************/\r
-\r
-if (function_exists('date_default_timezone_set')) {\r
- // CFG: TIME-ZONE\r
- @date_default_timezone_set("Europe/Berlin");\r
-}\r
-\r
-// Most of these constants are old and deprecated. We don't use them either.\r
-// You can still feel free to use them in your templates / scripts if you like :-)\r
-define('VERSION', "v0.2.1");\r
-define('AUTHOR' , "Roland Häder");\r
-define('TITLE', "MXChange - Mail Exchange");\r
-define('COPY', "© 2003 - 2008, by <A href=\"http://www.mxchange.org\" target=\"_blank\" rel=\"external\" title=\"{!TITLE!} {!VERSION!}\">Roland Häder</A>");\r
-\r
-// CFG: ERROR_REPORTING\r
-@error_reporting(0);\r
-\r
-// CFG: REGISTER-GLOBALS\r
-@import_request_variables('');\r
-\r
-// CFG: SITE-KEY\r
-define('SITE_KEY', "gg42ny8-4yng23498-mf423igum-mtu248utn42-mf4839gun43");\r
-\r
-// CFG: DATE-KEY\r
-define('DATE_KEY', date("d-m-Y (l-F-T)", time()));\r
-\r
-// CFG: DEFAULT-LANGUAGE\r
-define('DEFAULT_LANG', "de");\r
-\r
-// CFG: NULLPASS-WARNING\r
-define('warn_no_pass', true);\r
-\r
-// CFG: WRITE-FOOTER\r
-define('WRITE_FOOTER', true);\r
-\r
-// CFG: OUTPUT-MODE\r
-define('OUTPUT_MODE', "render");\r
-\r
-// CFG: MAIN_TITLE\r
-define('MAIN_TITLE', "Your mail-exchanger title");\r
-\r
-// CFG: SLOGAN\r
-define('SLOGAN', "Your cool slogan here");\r
-\r
-// Auto-detection...\r
-$URL = "http://".getenv('SERVER_NAME').dirname($_SERVER['PHP_SELF']);\r
-while (substr($URL, -1, 1) == "/") { $URL = substr($URL, 0, -1); }\r
-$PATH = substr(dirname(__FILE__), 0, -3);\r
-\r
-// CFG: HOST-URL (without trailing '/' !)\r
-define('URL', $URL);\r
-\r
-// CFG: SERVER-PATH\r
-define('PATH', $PATH);\r
-\r
-// CFG: WEBMASTER\r
-define('WEBMASTER', "you@some-hoster.tld.invalid");\r
-\r
-// CFG: INSTALLED\r
-define('mxchange_installed', false);\r
-\r
-// CFG: ADMIN-SETUP\r
-define('admin_registered', false);\r
-\r
-// CFG: FRAMESET\r
-define('frameset_active', false);\r
-\r
-// CFG: DEBUG-MODE (if enabled all mails will be *displayed* and *not* send!)\r
-define('DEBUG_MODE', false);\r
-\r
-// When we are not installing\r
-if (!defined('mxchange_installing')) define('mxchange_installing', false);\r
-\r
-// Language stuff (default is german)\r
-require_once(PATH."inc/language.php");\r
-\r
-// We need general functions and database stuff here\r