X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mailid_top.php;h=05b86518e6e37c7f8f2f352f6264719e40bb698a;hb=f9cc6f432459393d1c3a220e5270705d341a350e;hp=921effc2eef02796b4b23e833fd231049f5ded3d;hpb=d6834211baacaa54b282898fe54dc8c1511f046b;p=mailer.git diff --git a/mailid_top.php b/mailid_top.php index 921effc2ee..05b86518e6 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -42,15 +42,14 @@ $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; $GLOBALS['module'] = "mailid"; $CSS = 0; // Load the required file(s) -require ("inc/config.php"); +require("inc/config.php"); -if (isBooleanConstantAndTrue('mxchange_installed')) -{ +if (isBooleanConstantAndTrue('mxchange_installed')) { // Is the extension active if (!EXT_IS_ACTIVE("mailid", true)) { // Is not activated/installed yet! - ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "register")); - } + ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid")); + } // END - if // Secure all data $url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = ""; @@ -61,25 +60,22 @@ if (isBooleanConstantAndTrue('mxchange_installed')) if (!empty($_GET['mode'])) $mode = $_GET['mode']; // 01 1 12 2 2 21 1 2 2 10 - if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) - { + if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) { + // No image? Then output header if ($mode != "img") require_once(PATH."inc/header.php"); // Maybe he wants to confirm an email? - if ($url_mid > 0) - { + if ($url_mid > 0) { $result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s AND userid=%s LIMIT 1", array($url_mid, $url_uid), __FILE__, __LINE__); $type = "mailid"; $DATA = $url_mid; - } - elseif ($url_bid > 0) - { + } elseif ($url_bid > 0) { $result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s AND userid=%s LIMIT 1", array($url_bid, $url_uid), __FILE__, __LINE__); $type = "bonusid"; $DATA = $url_bid; } - if (SQL_NUMROWS($result) == 1) - { + + if (SQL_NUMROWS($result) == 1) { // Is the stats ID valid? list($lid, $ltype) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -87,16 +83,18 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { case "NORMAL": $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); + array($url_mid), __FILE__, __LINE__); break; case "BONUS": $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); break; } - if (SQL_NUMROWS($result_mailid) == 1) - { + + // Entry found? + if (SQL_NUMROWS($result_mailid) == 1) { + // Load data list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid); // Correct notification switch in non-bonus mails @@ -110,32 +108,33 @@ if (isBooleanConstantAndTrue('mxchange_installed')) // Is the user's ID unlocked? $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) - { + array($url_uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { // Load data list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result); + + // Free some memory SQL_FREERESULT($result); - if ($status == "CONFIRMED") - { + if ($status == "CONFIRMED") { // Update last activity $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); + array($url_uid), __FILE__, __LINE__); // User has confirmed his account so we can procede... switch ($ltype) { case "NORMAL": $result = SQL_QUERY_ESC("SELECT payment_id FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { list($pay) = SQL_FETCHROW($result); $time = GET_PAY_POINTS($pay, "time"); $payment = GET_PAY_POINTS($pay, "payment"); $VALID = true; - } + } // END - if // Free memory... SQL_FREERESULT($result); @@ -143,9 +142,10 @@ if (isBooleanConstantAndTrue('mxchange_installed')) case "BONUS": $result = SQL_QUERY_ESC("SELECT time, points FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { list($time, $payment) = SQL_FETCHROW($result); $VALID = true; } @@ -154,19 +154,17 @@ if (isBooleanConstantAndTrue('mxchange_installed')) SQL_FREERESULT($result); break; } - if ($VALID) - { + + // Is this entry valid? + if ($VALID) { if (($time == "0") && ($payment > 0)) $time = "1"; - if (($time > 0) && ($payment > 0)) - { - if (!empty($code)) - { + if (($time > 0) && ($payment > 0)) { + if (!empty($code)) { // Generate code $img_code = GEN_RANDOM_CODE($_CONFIG['code_length'], $code, $url_uid, $DATA); - } + } // END - if - switch ($mode) - { + switch ($mode) { case "add": // Init stats data $stats_data = 0; @@ -176,7 +174,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { case "NORMAL": $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); + array($url_mid), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -188,7 +186,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) case "BONUS": $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -334,33 +332,26 @@ if (isBooleanConstantAndTrue('mxchange_installed')) else OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (5)"); } else OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (4)"); - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (3)"); } - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (2)"); } - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (1)"); } - if ($mode != "img") - { + + // Insert footer if no image + if ($mode != "img") { // Write footer require_once(PATH."inc/footer.php"); - } + } // END - if } -} - elseif ($mode != "img") -{ +} elseif ($mode != "img") { // You have to configure first! LOAD_URL("install.php"); }