require_once("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
+global $what, $action, $startTime;
+$GLOBALS['startTime'] = microtime(true);
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
require ("inc/config.php");
// Is the script installed?
-if (defined('mxchange_installed') && (mxchange_installed))
+if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
{
// Probe for referral ID
if (!empty($_GET['refid'])) $GLOBALS['refid'] = bigintval($_GET['refid']);
$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"; }
+ if (empty($GLOBALS['refid'])) { $GLOBALS['refid'] = $_CONFIG['def_refid']; $status = "CONFIRMED"; }
// Begin with doubler script...
if (isset($_POST['ok']))
$_POST['points'] = bigintval(round(str_replace(",", ".", $_POST['points'])));
// Probe for enough points
- $probe_points = (($_POST['points'] >= $CONFIG['doubler_min']) && ($_POST['points'] <= $CONFIG['doubler_max']));
+ $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))
$DOUBLER_UID = $uid;
// Calulcate points
- $POINTS = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_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)
+ 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
}
// 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",
+ $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;
+ $_CONFIG['doubler_points'] += $points;
// Destroy cache
if (GET_EXT_VERSION("cache") >= "0.1.2")
{
- if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy();
+ if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
}
// Add second line for the referral but only when uid != refid
{
// 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__);
+ 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']++;
+ $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']));
// Account is locked by admin / holiday!
define('__ERROR_MSG', DOUBLER_FORM_STATUS_LOCKED);
}
- elseif ($_POST['points'] < $CONFIG['doubler_min'])
+ elseif ($_POST['points'] < $_CONFIG['doubler_min'])
{
// Not enougth points entered
define('__ERROR_MSG', DOUBLER_FORM_POINTS_MIN);
}
- elseif ($_POST['points'] > $CONFIG['doubler_max'])
+ elseif ($_POST['points'] > $_CONFIG['doubler_max'])
{
// Too much points entered
define('__ERROR_MSG', DOUBLER_FORM_POINTS_MAX);
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");
+ if ($_CONFIG['doubler_send_mode'] == "DIRECT") require(PATH."inc/doubler_send.php");
// Output header
include(PATH."inc/header.php");
else
{
// Transfer default refid to constant
- define('__REFID', $CONFIG['def_refid']);
+ 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']));
+ 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"))
}
// Which mail-send-mode did the admin setup?
- switch ($CONFIG['doubler_send_mode'])
+ switch ($_CONFIG['doubler_send_mode'])
{
case "DIRECT":
define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_DIRECT);
define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE("0", 'Y', 'N', "DESC"));
// Generate timemark
- define('__TIMEOUT_MARK', CREATE_FANCY_TIME($CONFIG['doubler_timeout']));
+ define('__TIMEOUT_MARK', CREATE_FANCY_TIME($_CONFIG['doubler_timeout']));
// Usage counter
- define('__DOUBLER_COUNTER', $CONFIG['doubler_counter']);
+ define('__DOUBLER_COUNTER', $_CONFIG['doubler_counter']);
// Points left to doubler
define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));
else
{
// You have to configure first!
- LOAD_URL(URL."/install.php");
+ LOAD_URL("install.php");
}
// Really all done here... ;-)