]> git.mxchange.org Git - mailer.git/blobdiff - beg.php
A lot more constants rewritten, deprecated variables with same constant name removed
[mailer.git] / beg.php
diff --git a/beg.php b/beg.php
index cd4b2f6363ed08de5c4b0a734c59d61fc4f76362..123ff8054fe87e51bf0dfbd2c96d2fece20b44ec 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
-require_once("inc/libs/security_functions.php");
+require("inc/libs/security_functions.php");
 
 // Init "action" and "what"
 global $what, $action, $startTime;
@@ -70,7 +70,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                if ("".($_GET['uid'] + 0)."" !== "".$_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",
+                               $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
@@ -79,7 +79,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                        }
                } else {
                        // Direct userid
-                       $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
                                array(bigintval($_GET['uid'])), __FILE__, __LINE__);
                }
 
@@ -121,11 +121,11 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                // User id valid and not webmaster's id?
                if (($uid > 0) && (getConfig('beg_uid') != $uid)) {
                        // Update counter
-                       $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET beg_clicks=beg_clicks+1 WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
+                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET beg_clicks=beg_clicks+1 WHERE userid=%s 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 > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND userid=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_beg_ips` WHERE (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND userid=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1",
                                array($uid, GET_REMOTE_ADDR(), session_id()), __FILE__, __LINE__);
 
                        // Entry not found, points set and not logged in?
@@ -136,7 +136,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                        // Remember remote address, userid and timestamp for next click
                                        // but only when there is no admin begging.
                                        // Admins shall be able to test it!
-                                       SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_beg_ips (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
+                                       SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
                                                array($uid, GET_REMOTE_ADDR(), session_id()), __FILE__, __LINE__);
 
                                        // Was is successfull?
@@ -186,7 +186,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                        SQL_FREERESULT($result);
 
                        // Include header
-                       require_once(PATH."inc/header.php");
+                       LOAD_INC_ONCE("inc/header.php");
 
                        // Load final template
                        LOAD_TEMPLATE("beg_link");
@@ -205,16 +205,13 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                        }
 
                        // Include footer
-                       require_once(PATH."inc/footer.php");
+                       LOAD_INC_ONCE("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
-                       }
+                       $msg = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
                } 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",
+                       $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
@@ -238,7 +235,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                LOAD_URL("modules.php?module=index");
        }
 } else {
-       // You have to configure first!
+       // You have to install first!
        LOAD_URL("install.php");
 }