$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Tell everyone we are in this module
-$GLOBALS['module'] = "mailid"; $CSS = "0";
+$GLOBALS['module'] = "mailid"; $CSS = 0;
// Load the required file(s)
require ("inc/config.php");
-if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed')))
+if (isBooleanConstantAndTrue('mxchange_installed'))
{
// Is the extension active
if (!EXT_IS_ACTIVE("mailid", true)) {
}
// Secure all data
- $url_uid = "0"; $url_bid = "0"; $url_mid = "0"; $code = "0"; $mode = "";
+ $url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = "";
if (!empty($_GET['uid'])) $url_uid = bigintval($_GET['uid']);
if (!empty($_GET['mailid'])) $url_mid = bigintval($_GET['mailid']);
if (!empty($_GET['bonusid'])) $url_bid = bigintval($_GET['bonusid']);
if (SQL_NUMROWS($result) == 1)
{
// Is the stats ID valid?
- list($link_id, $ltype) = SQL_FETCHROW($result);
+ list($lid, $ltype) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
switch ($ltype)
{
if ($ltype == "BONUS") $sender = 0;
// Is the user's ID unlocked?
- $result = SQL_QUERY_ESC("SELECT status, sex, surname, family, ref_payout FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
array($url_uid), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1)
{
// Load data
- list($status, $sex, $sname, $fname, $ref_pay) = SQL_FETCHROW($result);
+ list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if ($status == "CONFIRMED")
switch ($mode)
{
case "add":
+ // Init stats data
+ $stats_data = 0;
+
// Count clicks
switch ($ltype)
{
case "NORMAL":
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks+1 WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
array($url_mid), __FILE__, __LINE__);
// Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
// Update database
MEDIA_UPDATE_ENTRY(array("total_clicks", "normal_clicks"), "add", 1);
}
+ $stats_data = $url_mid;
break;
case "BONUS":
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks+1 WHERE id=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
array($url_bid), __FILE__, __LINE__);
// Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
// Update database
MEDIA_UPDATE_ENTRY(array("total_clicks", "bonus_clicks"), "add", 1);
}
+ $stats_data = $url_bid;
break;
}
define('_TEMPLATE_BANNER', LOAD_TEMPLATE("mailid_banner", true));
// Only when user extension = v0.1.2: Update mails-confirmed counter
- if (GET_EXT_VERSION("user") >= "0.1.2")
- {
+ if (GET_EXT_VERSION("user") >= "0.1.2") {
// Update counter
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed+1 WHERE userid=%s LIMIT 1",
- array($url_uid), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+
+ // Update random confirmed as well?
+ if (GET_EXT_VERSION("user") >= "0.3.4") {
+ // Update second counter
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
+ } // END - if
}
+ // Insert stats record
+ USER_STATS_INSERT_RECORD($url_uid, $type, $stats_data);
+
// Right code entered?
- if (bigintval($_POST['gfx_check']) == $img_code)
- {
+ if (bigintval($_POST['gfx_check']) == $img_code) {
// Right code entered add points and remove entry
if (($ref_pay > 0) && ($_CONFIG['allow_direct_pay'] == "N"))
{
- // Don't add points over the referral system
+ // Don't add points over the referal system
$locked = true;
$template = "mailid_points_locked";
}
else
{
- // Add points over referral system
+ // Add points over referal system
$locked = false;
$template = "mailid_points_done";
}
array($url_uid), __FILE__, __LINE__);
// Add points
- $DEPTH = 0;
+ unset($DEPTH);
ADD_POINTS_REFSYSTEM($url_uid, $payment, false, "0", $locked);
// Shall I add bonus points for "turbo clickers" ?
// Remove link from table
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
- array(bigintval($link_id)), __FILE__, __LINE__);
+ array(bigintval($lid)), __FILE__, __LINE__);
// Load total points
define('__TOTAL_POINTS', TRANSLATE_COMMA(
// Load template
LOAD_TEMPLATE($template);
- }
- else
- {
+ } else {
// Wrong image code! So add points to sender's account
- $DEPTH = 0;
+ unset($DEPTH);
ADD_POINTS_REFSYSTEM($sender, $payment, false, 0, false, "direct");
// Remove link from table
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE id=%s LIMIT 1",
- array(bigintval($link_id)), __FILE__, __LINE__);
+ array(bigintval($lid)), __FILE__, __LINE__);
// Load template
LOAD_TEMPLATE("mailid_points_failed");
define('_UID_VALUE' , $url_uid );
define('_TYPE_VALUE', $type);
define('_DATA_VALUE', $DATA);
- define('_RAND_VALUE', rand(0, 99999));
+ define('_RAND_VALUE', mt_rand(0, 99999));
define('_TEMPLATE_BANNER', LOAD_TEMPLATE("mailid_banner", true));
// Load template