Huge rewrite:
[mailer.git] / beg.php
diff --git a/beg.php b/beg.php
index e92a8f11bd96189c45fb9fb8ae8648091511ad15..27bb97df84504d8646f695e3fd77282a31bc6029 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -46,7 +46,7 @@ $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['module'] = 'beg';
 $GLOBALS['refid']  = 0;
 $GLOBALS['output_mode'] = -1;
-$msg = null;
+$errorCode = null;
 
 // Load the required file(s)
 require('inc/config-global.php');
@@ -78,7 +78,7 @@ if (REQUEST_ISSET_GET('uid')) {
                                array(REQUEST_GET('uid')), __FILE__, __LINE__);
                } else {
                        // Nickname entered but nickname is not active
-                       $msg = getCode('EXTENSION_PROBLEM');
+                       $errorCode = getCode('EXTENSION_PROBLEM');
                        $uid = -1;
                }
        } else {
@@ -137,8 +137,8 @@ if (REQUEST_ISSET_GET('uid')) {
                                // 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())",
-                               array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
+                               SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (`userid`, `remote_ip`,`sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
+                                       array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
 
                                // Was is successfull?
                                $pay (SQL_AFFECTEDROWS() == 1);
@@ -207,28 +207,28 @@ if (REQUEST_ISSET_GET('uid')) {
                loadIncludeOnce('inc/footer.php');
        } elseif (($status != 'CONFIRMED') && ($status != 'failed')) {
                // Maybe locked/unconfirmed account?
-               $msg = generateErrorCodeFromUserStatus($status);
+               $errorCode = generateErrorCodeFromUserStatus($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",
-               array(REQUEST_GET('uid')), __FILE__, __LINE__);
+                       array(REQUEST_GET('uid')), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Locked account
-                       $msg = getCode('ACCOUNT_LOCKED');
+                       $errorCode = getCode('ACCOUNT_LOCKED');
                } else {
                        // Invalid nickname! (404)
-                       $msg = getCode('USER_404');
+                       $errorCode = getCode('USER_404');
                }
 
                // Free memory
                SQL_FREERESULT($result);
        } elseif ($uid == getConfig('beg_uid')) {
                // Webmaster's ID cannot beg for points!
-               $msg = getCode('BEG_SAME_AS_OWN');
+               $errorCode = getCode('BEG_SAME_AS_OWN');
        }
 
        // Reload to index module
-       if ((!empty($msg)) && (!empty($msg))) redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=beg');
+       if ((!empty($errorCode)) && (!empty($errorCode))) redirectToUrl('modules.php?module=index&msg=' . $errorCode . '&ext=beg');
 } else {
        // No userid entered
        redirectToUrl('modules.php?module=index');