More misc fixes and rewrites (sorry, lame description)
[mailer.git] / birthday_confirm.php
index 003c93fbd186e359dbf95f9e477f5d7720b250ff..70332e33f76b089126513652de93ad298407de55 100644 (file)
@@ -39,9 +39,8 @@
 // Load security stuff here
 require('inc/libs/security_functions.php');
 
-// Init "action" and "what"
-$GLOBALS['what'] = '';
-$GLOBALS['action'] = '';
+// Init start time
+$GLOBALS['startTime'] = microtime(true);
 
 // Set module
 $GLOBALS['module'] = 'birthday_confirm';
@@ -67,11 +66,16 @@ $chk = bigintval(REQUEST_GET('check'), false);
 
 // Check if link is not clicked so far
 $result = SQL_QUERY_ESC("SELECT b.points, d.gender, d.surname, d.family, d.status, d.ref_payout
-FROM `{!_MYSQL_PREFIX!}_user_birthday` AS b
-INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON b.userid=d.userid
-WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1",
-array($uid, $chk), __FILE__, __LINE__);
+FROM
+       `{!_MYSQL_PREFIX!}_user_birthday` AS b
+INNER JOIN
+       `{!_MYSQL_PREFIX!}_user_data` AS d
+ON
+       b.userid=d.userid
+WHERE
+       b.userid=%s AND b.chk_value='%s'
+LIMIT 1",
+       array($uid, $chk), __FILE__, __LINE__);
 //* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk).'/'.strlen(REQUEST_GET('check')).'/'.SQL_NUMROWS($result).")<br />\n";
 
 // Prepare content
@@ -99,7 +103,7 @@ if (SQL_NUMROWS($result) == 1) {
                } // END - if
 
                // Remove entry from table
-               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE userid=%s AND chk_value='%s' LIMIT 1",
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1",
                        array($uid, $chk), __FILE__, __LINE__);
 
                // "Translate" some data