From: Roland Häder Date: Fri, 20 Feb 2009 00:13:26 +0000 (+0000) Subject: More improved SQL queries X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c47144dd555bbab4acdf9085e4623900dedb0e7c;p=mailer.git More improved SQL queries --- diff --git a/beg.php b/beg.php index e1e41d1e34..2f99b68a26 100644 --- a/beg.php +++ b/beg.php @@ -121,7 +121,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // User id valid and not webmaster's id? if (($uid > 0) && (getConfig('beg_uid') != $uid)) { // Update counter - 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 diff --git a/inc/autopurge/purge-inact.php b/inc/autopurge/purge-inact.php index 3303cda344..bcf5a92470 100644 --- a/inc/autopurge/purge-inact.php +++ b/inc/autopurge/purge-inact.php @@ -68,7 +68,7 @@ if (getConfig('autopurge_inactive') == "Y") { // Check for all accounts $result_inactive = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.email, d.last_online FROM `{!_MYSQL_PREFIX!}_user_data` AS d -WHERE d.status='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s) +WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s) ".$EXCLUDE_LIST." ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__); @@ -110,7 +110,7 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__); $time = bigintval(getConfig('ap_in_time')); $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online FROM `{!_MYSQL_PREFIX!}_user_data` AS d -WHERE status='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND last_online < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s) +WHERE `status`='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND last_online < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s) ".$EXCLUDE_LIST." ORDER BY userid", array($since, $since, $time), __FILE__, __LINE__); diff --git a/inc/autopurge/purge-tsks.php b/inc/autopurge/purge-tsks.php index 7c82489ddd..07dbc704c5 100644 --- a/inc/autopurge/purge-tsks.php +++ b/inc/autopurge/purge-tsks.php @@ -51,7 +51,7 @@ if ((GET_EXT_VERSION("task") > "0.0") && (getConfig('ap_tasks') == "Y")) { // Purge deleted tasks (no notification to admin) SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` -WHERE status='DELETED' AND task_created <= (UNIX_TIMESTAMP() - %s)", +WHERE `status`='DELETED' AND task_created <= (UNIX_TIMESTAMP() - %s)", array($since), __FILE__, __LINE__); $DELETED = SQL_AFFECTEDROWS(); diff --git a/inc/autopurge/purge-unconfirmed.php b/inc/autopurge/purge-unconfirmed.php index f834a18be5..c8e1c68f38 100644 --- a/inc/autopurge/purge-unconfirmed.php +++ b/inc/autopurge/purge-unconfirmed.php @@ -49,7 +49,7 @@ if (getConfig('autopurge_unconfirmed') == "Y") { $time = bigintval(getConfig('ap_un_time')); $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) +WHERE `status`='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) ORDER BY userid ASC", array($time), __FILE__, __LINE__); if (SQL_NUMROWS($result_uncon) > 0) { diff --git a/inc/doubler_send.php b/inc/doubler_send.php index 02d7b56d84..bdf6d7b282 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -59,7 +59,7 @@ $result_total = SQL_QUERY_ESC("SELECT DISTINCT d.id, d.userid, d.points, d.remot FROM `{!_MYSQL_PREFIX!}_doubler` AS d LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS u ON d.userid=u.userid -WHERE u.status='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed='N' AND d.is_ref='N' +WHERE u.`status`='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed='N' AND d.is_ref='N' ORDER BY d.timemark", array($DOUBLER_POINTS, $min), __FILE__, __LINE__); // Check for accounts with limitation @@ -67,7 +67,7 @@ $result_main = SQL_QUERY_ESC("SELECT DISTINCT d.id, d.userid, d.points, d.remote FROM `{!_MYSQL_PREFIX!}_doubler` AS d LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS u ON d.userid=u.userid -WHERE u.status='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed='N' AND d.is_ref='N' +WHERE u.`status`='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed='N' AND d.is_ref='N' ORDER BY d.timemark LIMIT %d", array($DOUBLER_POINTS, $min, getConfig('doubler_max_sent')), __FILE__, __LINE__); diff --git a/inc/extensions.php b/inc/extensions.php index c299557333..07fd2858b0 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -243,7 +243,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr } } elseif (($task_id > 0) && (!empty($ext_name))) { // Remove task from system when id and extension's name is valid - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND status='NEW' LIMIT 1", + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND `status`='NEW' LIMIT 1", array(bigintval($task_id)), __FILE__, __LINE__); } diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 2c3ef53d4f..be096d76bd 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -600,7 +600,7 @@ PRIMARY KEY (id) case "0.4.9": // SQL queries for v0.4.9 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE `user_hash` `user_hash` VARCHAR(255) NULL DEFAULT NULL"; - $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_user_data` SET user_hash=NULL WHERE user_hash IS NOT NULL AND status='CONFIRMED'"; + $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_user_data` SET user_hash=NULL WHERE user_hash IS NOT NULL AND `status`='CONFIRMED'"; $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD UNIQUE (`user_hash`)"; // Update notes (these will be set as task text!) diff --git a/inc/extensions/ext-task.php b/inc/extensions/ext-task.php index 0c718ad238..86309cb85b 100644 --- a/inc/extensions/ext-task.php +++ b/inc/extensions/ext-task.php @@ -52,7 +52,7 @@ case "register": // Do stuff when installation is running (modules.php?module=ad // SQL commands to run $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('task', NULL, 'Aufgaben-Management','1','Erweitertes Aufgaben-Management zur leichten verwaltung der vom System erzeugten Aufgaben.')"; $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('task','list_task','Aufgaben auflisten','1','Alle Ihnen zugewiesenen Aufgaben auflisten (keine Updates).')"; - $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_task_system` SET status='SOLVED' WHERE status='CLOSED'"; + $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `status`='SOLVED' WHERE `status`='CLOSED'"; // Enable CSS file? $EXT_CSS = "Y"; diff --git a/inc/functions.php b/inc/functions.php index f071322d04..73084e5fa5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1955,7 +1955,7 @@ function VALIDATE_URL ($URL, $compile=true) { return (((substr($URL, 0, 7) == "http://") || (substr($URL, 0, 8) == "https://")) && (strlen($URL) >= 12)); } // -function MEMBER_ACTION_LINKS($uid, $status="") { +function MEMBER_ACTION_LINKS ($uid, $status = "") { // Define all main targets $TARGETS = array("del_user", "edit_user", "lock_user", "add_points", "sub_points"); diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 47bb4712c1..e23ef169da 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -131,7 +131,7 @@ function ADMINS_CHECK_ACL($act, $wht) { // Create email link to admins's account function ADMINS_CREATE_EMAIL_LINK($email, $mod="admin") { - $locked = " AND status='CONFIRMED'"; + $locked = " AND `status`='CONFIRMED'"; if (IS_ADMIN()) $locked = ""; if (strpos("@", $email) > 0) { // Create email link diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index fb4fa4a8a5..25146a04db 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -53,7 +53,7 @@ function RALLYE_AUTOSTART_RALLYES($result) array(bigintval($id)), __FILE__, __LINE__); // Do a snapshot off all user refs - $result_user = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); + $result_user = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); // Transfer all neccessary data to the global $DATA array $DATA['uid_cnt'] = SQL_NUMROWS($result_user); @@ -102,7 +102,7 @@ function RALLYE_AUTOSTART_RALLYES($result) FROM `{!_MYSQL_PREFIX!}_user_points` AS p LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid -WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s", +WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s", array(getConfig('ref_payout'), bigintval($uid)), __FILE__, __LINE__); list($cpoints) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); @@ -213,7 +213,7 @@ WHERE u.rallye_id=%s AND r.counter > 0 ORDER BY u.refs DESC", $result_ref = SQL_QUERY_ESC("SELECT DISTINCT p.points FROM `{!_MYSQL_PREFIX!}_user_points` AS p LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid -WHERE d.userid=%s AND d.status='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s +WHERE d.userid=%s AND d.`status`='CONFIRMED' AND p.ref_depth=1 AND d.max_mails > 0 AND d.mails_confirmed >= %s LIMIT 1", array(bigintval($uid), getConfig('ref_payout')), __FILE__, __LINE__); list($refpoints) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); @@ -371,7 +371,7 @@ function RALLYE_EXPIRE_RALLYES($result) // active = 0: account is deleted or locked $result = SQL_QUERY_ESC("SELECT COUNT(userid) AS active FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE userid=%s AND status='CONFIRMED' +WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); list($active) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -474,7 +474,7 @@ function RALLYE_LOAD_USER_DATA($uids_array) $uid_string = implode(",", $uids_array['uid']); // Load users - $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN(%s) AND status='CONFIRMED' ORDER BY userid LIMIT %s", + $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN(%s) AND `status`='CONFIRMED' ORDER BY userid LIMIT %s", array($uid_string, count($uids_array)), __FILE__, __LINE__); $ret = ""; while (list($u, $gender, $surname, $family, $email) = SQL_FETCHROW($result)) @@ -538,7 +538,7 @@ function RALLYE_LOAD_USERS_ARRAY ($rallye) { FROM `{!_MYSQL_PREFIX!}_user_points` AS p LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid -WHERE d.status='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s", +WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s", array(getConfig('ref_payout'), bigintval($uid)), __FILE__, __LINE__); list($refpoints) = SQL_FETCHROW($result_ref); SQL_FREERESULT($result_ref); @@ -595,7 +595,7 @@ function RALLYE_LIST_WINNERS ($rallye, $default=0) { // Check status // active = 1: account is still confirmed // active = 0: account is deleted or locked - $result_active = SQL_QUERY_ESC("SELECT COUNT(userid) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result_active = SQL_QUERY_ESC("SELECT COUNT(userid) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($DATA['uid'][$idx])), __FILE__, __LINE__); list($active) = SQL_FETCHROW($result_active); SQL_FREERESULT($result_active); diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 48300f1b1d..26fd2fa935 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -265,7 +265,7 @@ function IS_SPONSOR () { if ((isSessionVariableSet('sponsorid'))) && (isSessionVariableSet('sponsorpass')))) { // Check cookies against database records... $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` -WHERE id='%s' AND password='%s' AND status='CONFIRMED' LIMIT 1", +WHERE id='%s' AND password='%s' AND `status`='CONFIRMED' LIMIT 1", array(bigintval(get_session('sponsorid')), get_session('sponsorpass')), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // All is fine @@ -436,7 +436,7 @@ function SPONSOR_SAVE_DATA ($POST, $content) { $EMAIL = true; // Okay, has changed then add status with UNCONFIRMED and new hash code - $SQL .= " status='EMAIL', hash='%s',"; + $SQL .= " `status`='EMAIL', hash='%s',"; // Generate hash code $HASH = md5(session_id().":".$POST['email'].":".GET_REMOTE_ADDR().":".GET_USER_AGENT().":".time()); diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index a20d2f8e10..d928ad7df4 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -264,7 +264,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) { global $SURFBAR_CACHE; // Search for the requested action/status combination in database - $result = SQL_QUERY_ESC("SELECT new_status FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE action='%s' AND status='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT new_status FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE action='%s' AND `status`='%s' LIMIT 1", array($action, $status), __FILE__, __LINE__); // Is the entry there? @@ -432,7 +432,7 @@ function SURFBAR_MEMBER_EXECUTE_EDIT_ACTION ($urlData) { if (true) { //if (($urlData['views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) { // Run the query - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET url='%s', views_allowed=%s, views_max=%s WHERE id=%s AND status='%s' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET url='%s', views_allowed=%s, views_max=%s WHERE id=%s AND `status`='%s' LIMIT 1", array($urlData['url'], $urlData['edit']['limit'], $urlData['edit']['limit'], $urlData['id'], $urlData['status']), __FILE__, __LINE__); // All fine @@ -463,7 +463,7 @@ function SURFBAR_HANDLE_SELF_MAINTENANCE () { // Handle URLs which limit has depleted function SURFBAR_HANDLE_DEPLETED_VIEWS () { // Get all URLs - $urlArray = SURFBAR_GET_URL_DATA("0", "views_max", "id", "ASC", "id", " AND views_allowed>0 AND status='ACTIVE'"); + $urlArray = SURFBAR_GET_URL_DATA("0", "views_max", "id", "ASC", "id", " AND views_allowed>0 AND `status`='ACTIVE'"); // Do we have some entries? if (count($urlArray) > 0) { @@ -865,7 +865,7 @@ function SURFBAR_GET_TOTAL_URLS ($status="ACTIVE", $excludeUserId=0) { // Get amount from database $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM `{!_MYSQL_PREFIX!}_surfbar_urls` -WHERE userid NOT IN (".implode(",", $UIDs['uid']).") AND status='%s'", +WHERE userid NOT IN (".implode(",", $UIDs['uid']).") AND `status`='%s'", array($status), __FILE__, __LINE__ ); @@ -907,7 +907,7 @@ function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="",$exclude="") { $ADD = sprintf(" AND status IN('%s')", implode("','", $status)); } elseif (!empty($status)) { // Only URLs with this status - $ADD = sprintf(" AND status='%s'", $status); + $ADD = sprintf(" AND `status`='%s'", $status); } elseif (is_array($exclude)) { // Exclude URLs with these status $ADD = sprintf(" AND status NOT IN('%s')", implode("','", $exclude)); @@ -1124,7 +1124,7 @@ function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) { FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS u INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON u.userid=d.userid -WHERE u.userid NOT IN (%s,0) AND u.status='ACTIVE' +WHERE u.userid NOT IN (%s,0) AND u.`status`='ACTIVE' GROUP BY u.userid ORDER BY u.userid ASC", array($GLOBALS['userid']), __FILE__, __LINE__); @@ -1134,7 +1134,7 @@ ORDER BY u.userid ASC", FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS u INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON u.userid=d.userid -WHERE u.status='ACTIVE' +WHERE u.`status`='ACTIVE' GROUP BY u.userid ORDER BY u.userid ASC", __FILE__, __LINE__); } @@ -1235,7 +1235,7 @@ function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array()) // Update the status now // ---------- Comment out for debugging/developing member actions! --------- - //SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET status='%s' WHERE id=%s LIMIT 1", + //SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET `status`='%s' WHERE id=%s LIMIT 1", // array($newStatus, bigintval($urlId)), __FILE__, __LINE__); // ---------- Comment out for debugging/developing member actions! --------- @@ -1408,7 +1408,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_salts` AS sbs ON sbu.id=sbs.url_id LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l ON sbu.id=l.url_id -WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) AND sbu.status='ACTIVE'".$ADD." +WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) AND sbu.`status`='ACTIVE'".$ADD." GROUP BY sbu.id", __FILE__, __LINE__); // Log last query @@ -1456,7 +1456,7 @@ function SURFBAR_GET_ACTION_ARRAY ($status) { $returnArray = array(); // Get all assigned actions - $result = SQL_QUERY_ESC("SELECT action FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE status='%s' ORDER BY `id` ASC", + $result = SQL_QUERY_ESC("SELECT action FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE `status`='%s' ORDER BY `id` ASC", array($status), __FILE__, __LINE__); // Some entries there? @@ -1533,7 +1533,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_salts` AS sbs ON sbu.id=sbs.url_id LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l ON sbu.id=l.url_id -WHERE sbu.userid NOT IN (".implode(",", $UIDs['uid']).") AND sbu.status='ACTIVE' AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))".$ADD." +WHERE sbu.userid NOT IN (".implode(",", $UIDs['uid']).") AND sbu.`status`='ACTIVE' AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))".$ADD." GROUP BY sbu.id ORDER BY l.last_surfed ASC, sbu.id ASC LIMIT %s,1", @@ -1547,7 +1547,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_salts` AS sbs ON sbu.id=sbs.url_id LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l ON sbu.id=l.url_id -WHERE sbu.userid != %s AND sbu.status='ACTIVE' AND sbu.id=%s AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) +WHERE sbu.userid != %s AND sbu.`status`='ACTIVE' AND sbu.id=%s AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) LIMIT 1", array($GLOBALS['userid'], bigintval($urlId)), __FILE__, __LINE__ ); diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index 4b7dc98d3b..a0930207bf 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -63,7 +63,7 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) if (!$JOBS_DONE) { // New extensions or updates found - $value = GET_TOTAL_DATA(GET_CURRENT_ADMIN_ID(), "task_system", "id", "assigned_admin", true, " AND status='NEW' AND task_type='EXTENSION_UPDATE'"); + $value = GET_TOTAL_DATA(GET_CURRENT_ADMIN_ID(), "task_system", "id", "assigned_admin", true, " AND `status`='NEW' AND task_type='EXTENSION_UPDATE'"); if ($value > 0) { define('__TASK_UPDATE_VALUE', "".$value.""); @@ -262,7 +262,7 @@ function OUTPUT_ADVANCED_OVERVIEW (&$result_main) // Check for all accounts $SQLs[] = "SELECT DISTINCT d.userid, d.email, d.last_online FROM `{!_MYSQL_PREFIX!}_user_data` AS d -WHERE d.status='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - ".$since.") AND d.last_online < (UNIX_TIMESTAMP() - ".$since.") AND d.ap_notified < (UNIX_TIMESTAMP() - ".$since.") +WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - ".$since.") AND d.last_online < (UNIX_TIMESTAMP() - ".$since.") AND d.ap_notified < (UNIX_TIMESTAMP() - ".$since.") ".$EXCLUDE_LIST." ORDER BY d.userid"; $WHATs[] = "list_autopurge"; @@ -280,7 +280,7 @@ ORDER BY d.userid"; if (EXT_IS_ACTIVE("payout")) { // List new payout requests - $SQLs[] = "SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE status='NEW' ORDER BY userid"; + $SQLs[] = "SELECT userid FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY userid"; $WHATs[] = "list_payouts"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_PAYOUTS_WAITING'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_PAYOUTS_WAITING_TITLE'); @@ -347,7 +347,7 @@ ORDER BY d.userid"; $SQLs[] = "SELECT ".$USE." AS points FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND ".$USE.">0".$LAST." +WHERE `status`='CONFIRMED' AND ".$USE.">0".$LAST." ORDER BY points DESC, userid"; $WHATs[] = "list_bonus"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_BONUS'); @@ -365,7 +365,7 @@ ORDER BY points DESC, userid"; } $SQLs[] = "SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND beg_points>0".$LAST." +WHERE `status`='CONFIRMED' AND beg_points>0".$LAST." ORDER BY beg_points DESC, userid"; $WHATs[] = "list_beg"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_BEG'); @@ -424,7 +424,7 @@ ORDER BY beg_points DESC, userid"; $TITLEs[] = getMessage('TASK_ADMIN_LIST_ENGINE_TITLE'); // List all pending accounts - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_engine_accounts` WHERE status='UNCONFIRMED' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_engine_accounts` WHERE `status`='UNCONFIRMED' ORDER BY `id`"; $WHATs[] = "unlock_engine"; $DESCRs[] = getMessage('TASK_ADMIN_UNLOCK_ENGINE'); $TITLEs[] = getMessage('TASK_ADMIN_UNLOCK_ENGINE_TITLE'); @@ -450,31 +450,31 @@ ORDER BY beg_points DESC, userid"; $TITLEs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_TITLE'); // List confirmed sponsor accounts - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE status='CONFIRMED' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='CONFIRMED' ORDER BY `id`"; $WHATs[] = "list_sponsor"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_CONFIRMED'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_CONFIRMED_TITLE'); // List unconfirmed sponsor accounts - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE status='UNCONFIRMED' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='UNCONFIRMED' ORDER BY `id`"; $WHATs[] = "list_sponsor"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_UNCONFIRMED'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_UNCONFIRMED_TITLE'); // List locked sponsor accounts - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE status='LOCKED' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='LOCKED' ORDER BY `id`"; $WHATs[] = "list_sponsor"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_LOCKED'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_LOCKED_TITLE'); // List waiting sponsor accounts to be approved - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE status='PENDING' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `status`='PENDING' ORDER BY `id`"; $WHATs[] = "unlock_sponsor"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_PENDING'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_PENDING_TITLE'); // Waiting payments - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE pay_status='PENDING' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE pay_`status`='PENDING' ORDER BY `id`"; $WHATs[] = "list_sponsor_pays"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_ORDERS'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_SPONSOR_ORDERS_TITLE'); @@ -518,7 +518,7 @@ ORDER BY beg_points DESC, userid"; $TITLEs[] = getMessage('TASK_ADMIN_LIST_SURFBAR_URLS_ALL_TITLE'); // List all pending URLs in surfbar - $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_surfbar_urls` WHERE status='PENDING' ORDER BY `id`"; + $SQLs[] = "SELECT id FROM `{!_MYSQL_PREFIX!}_surfbar_urls` WHERE `status`='PENDING' ORDER BY `id`"; $WHATs[] = "unlock_surfbar_urls"; $DESCRs[] = getMessage('TASK_ADMIN_LIST_SURFBAR_URLS_PENDING'); $TITLEs[] = getMessage('TASK_ADMIN_LIST_SURFBAR_URLS_PENDING_TITLE'); diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 0e37d985be..03fbfae67b 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -193,7 +193,7 @@ function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) { // Create email link to user's account function USER_CREATE_EMAIL_LINK($email, $mod="admin") { // Show contact link only if user is confirmed by default - $locked = " AND status='CONFIRMED'"; + $locked = " AND `status`='CONFIRMED'"; // But admins shall always see it if (IS_ADMIN()) $locked = ""; @@ -269,13 +269,13 @@ function USER_DO_LOGIN ($uid, $passwd) { $password = ""; $uid2 = ""; $dmy = ""; $online = 0; $login = 0; if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID($uid))) { // Nickname entered - $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1", array($uid), __FILE__, __LINE__); list($uid2, $password, $online, $login) = SQL_FETCHROW($result); if (!empty($uid2)) $uid = bigintval($uid2); } else { // Direct userid entered - $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array($uid, $hash), __FILE__, __LINE__); list($uid2, $password, $online, $login) = SQL_FETCHROW($result); } @@ -302,7 +302,7 @@ function USER_DO_LOGIN ($uid, $passwd) { $hash = generateHash($passwd); // ... and update database - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET password='%s' WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array($hash, $uid), __FILE__, __LINE__); // No login bonus by default diff --git a/inc/mails/beg_mails.php b/inc/mails/beg_mails.php index f0aa99ed67..5fa9212564 100644 --- a/inc/mails/beg_mails.php +++ b/inc/mails/beg_mails.php @@ -82,7 +82,7 @@ case "N": // Begging rallye is deactivated if (!empty($SQL)) { // The SQL command needs to be finisched here (only confirmed accounts!) - $SQL .= ") AND status='CONFIRMED' ORDER BY last_online ASC"; + $SQL .= ") AND `status`='CONFIRMED' ORDER BY last_online ASC"; // Prepare data for the template define('__BEG_MIN_POINTS' , TRANSLATE_COMMA(getConfig('beg_points'))); diff --git a/inc/mails/birthday_mails.php b/inc/mails/birthday_mails.php index be67b650fd..f843766557 100644 --- a/inc/mails/birthday_mails.php +++ b/inc/mails/birthday_mails.php @@ -58,7 +58,7 @@ if ((getConfig('birthday_active')) && (EXT_IS_ACTIVE("autopurge")) && (getConfig // Only confirmed members shall receive birthday mails... $result_birthday = SQL_QUERY_ESC("SELECT userid, email, birth_year FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND birth_day=%s AND birth_month=%s AND birthday_sent < (UNIX_TIMESTAMP() - ".(getConfig('one_day') * 364).")".$ADD." +WHERE `status`='CONFIRMED' AND birth_day=%s AND birth_month=%s AND birthday_sent < (UNIX_TIMESTAMP() - ".(getConfig('one_day') * 364).")".$ADD." ORDER BY userid", array($DAY, $MONTH, $VALUE), __FILE__, __LINE__); diff --git a/inc/mails/bonus_mails.php b/inc/mails/bonus_mails.php index 48590a115c..591ae9e2e6 100644 --- a/inc/mails/bonus_mails.php +++ b/inc/mails/bonus_mails.php @@ -76,7 +76,7 @@ case "N": // Active rallye is deactivated if (!empty($SQL)) { // The SQL command needs to be finisched here (only confirmed accounts!) - $SQL .= ") AND status='CONFIRMED' ORDER BY last_online ASC"; + $SQL .= ") AND `status`='CONFIRMED' ORDER BY last_online ASC"; // Normal notification mails or bonus mails? $MAIL_MODE = ((getConfig('bonus_notify_points') > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus"))); diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index f9e89a7031..e87f4d5606 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -101,7 +101,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) { // At last - but not least - check for own and new unassigned tasks... $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM `{!_MYSQL_PREFIX!}_task_system` -WHERE assigned_admin='%s' OR (assigned_admin='0' AND status='NEW') +WHERE assigned_admin='%s' OR (assigned_admin='0' AND `status`='NEW') ORDER BY userid DESC, task_type DESC, subject, task_created DESC", array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__); @@ -124,7 +124,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { // Assign / do tasks $OUT = ""; $SW = 2; foreach ($POST['task'] as $id => $sel) { - $result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')) LIMIT 1", + $result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND `status`='NEW')) LIMIT 1", array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__); if (SQL_NUMROWS($result_task) == 1) { // Task is valid... @@ -378,7 +378,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { } // Update query - $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM `{!_MYSQL_PREFIX!}_task_system` WHERE assigned_admin=%s OR (assigned_admin=0 AND status='NEW') ORDER BY task_created DESC", + $result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created FROM `{!_MYSQL_PREFIX!}_task_system` WHERE assigned_admin=%s OR (assigned_admin=0 AND `status`='NEW') ORDER BY task_created DESC", array(GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__); } // END - if diff --git a/inc/modules/admin/what-add_points.php b/inc/modules/admin/what-add_points.php index 81ddb82b78..cf783511a8 100644 --- a/inc/modules/admin/what-add_points.php +++ b/inc/modules/admin/what-add_points.php @@ -47,7 +47,7 @@ if ($_GET['u_id'] == "all") { // Add points to all accounts if ((isset($_POST['ok'])) && ($_POST['points'] > 0)) { define('__POINTS_VALUE', $_POST['points']); - $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); + $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); while (list($uid) = SQL_FETCHROW($result_main)) { // Remove depth to prevent booking errors. This is a bad coding // practice, thats also why we need to write this project from @@ -79,7 +79,7 @@ if ($_GET['u_id'] == "all") { } } elseif (!empty($_GET['u_id'])) { // User ID found in URL so we use this give him some credits - $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($_GET['u_id'])), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Selected user does exist diff --git a/inc/modules/admin/what-chk_regs.php b/inc/modules/admin/what-chk_regs.php index 93e8b41697..8001828b0e 100644 --- a/inc/modules/admin/what-chk_regs.php +++ b/inc/modules/admin/what-chk_regs.php @@ -43,7 +43,7 @@ ADD_DESCR ("admin", basename(__FILE__)); // Check for accounts $result = SQL_QUERY("SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, user_hash FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='UNCONFIRMED' +WHERE `status`='UNCONFIRMED' ORDER BY userid ASC", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index ffdecb854a..68f4307228 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -41,21 +41,18 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); $SEL = 0; -if (isset($_POST['edit'])) -{ +if (isset($_POST['edit'])) { // Check if at least one module is selected $SEL = SELECTION_COUNT($_POST['sel']); - if ($SEL > 0) - { + if ($SEL > 0) { // Output header $OUT = ""; $SW = 2; // Edit selected modules - foreach ($_POST['sel'] as $id => $sel) - { + foreach ($_POST['sel'] as $id => $sel) { // Load module data $result = SQL_QUERY_ESC("SELECT module, title, locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE id=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); + array(bigintval($id)), __FILE__, __LINE__); list($mod, $title, $locked, $hidden, $admin, $mem) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -78,23 +75,17 @@ if (isset($_POST['edit'])) // Load main template LOAD_TEMPLATE("admin_mods_edit"); - } - else - { + } else { // Nothing selected LOAD_TEMPLATE("admin_settings_saved", false, MODS_NOTHING_SELECTED); - OUTPUT_HTML("
"); // Remove maybe confusing data unset($_POST['edit']); unset($_POST['change']); } -} - elseif (isset($_POST['change'])) -{ +} elseif (isset($_POST['change'])) { // Change modules - foreach ($_POST['sel'] as $id => $sel) - { + foreach ($_POST['sel'] as $id => $sel) { // Secure ID number $id = bigintval($id); @@ -104,29 +95,24 @@ if (isset($_POST['edit'])) } // Remove cache file if version matches - if (GET_EXT_VERSION("cache") >= "0.1.2") - { + if (GET_EXT_VERSION("cache") >= "0.1.2") { if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile(); } // Entries updated LOAD_TEMPLATE("admin_settings_saved", false, MODS_CHANGED); - OUTPUT_HTML("
"); } -if ($SEL == 0) -{ +if ($SEL == 0) { // Load module data (We do not need to check if there's at least one...) $result = SQL_QUERY("SELECT id, module, locked, hidden, admin_only, title, mem_only, clicks FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY module", __FILE__, __LINE__); $OUT = ""; $SW = 2; - while (list($id, $mod, $locked, $hidden, $admin, $title, $mem) = SQL_FETCHROW($result)) - { + while (list($id, $mod, $locked, $hidden, $admin, $title, $mem) = SQL_FETCHROW($result)) { // Reset title to --- if it is NULL if (empty($title)) $title = "---"; - if (($mod == "index") || ($mod == "login")) - { + if (($mod == "index") || ($mod == "login")) { // Add link to detail statistics $mod = "".$mod.""; } diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php index fd1e6faf1e..598eb8cf5e 100644 --- a/inc/modules/admin/what-config_payouts.php +++ b/inc/modules/admin/what-config_payouts.php @@ -74,7 +74,7 @@ VALUES ('%s', %d, %d,'%s','%s','%s','%s','%s','%s','%s')", } // Payout requests by your members -$result_mem = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE status='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__); +$result_mem = SQL_QUERY("SELECT id FROM `{!_MYSQL_PREFIX!}_user_payouts` WHERE `status`='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__); $display = true; if ((isset($_POST['edit'])) && (SELECTION_COUNT($_POST['sel']) > 0)) { diff --git a/inc/modules/admin/what-list_autopurge.php b/inc/modules/admin/what-list_autopurge.php index cafee4597d..fffc66ef86 100644 --- a/inc/modules/admin/what-list_autopurge.php +++ b/inc/modules/admin/what-list_autopurge.php @@ -55,7 +55,7 @@ if (GET_EXT_VERSION("holiday") >= "0.1.3") $EXCLUDE_LIST .= " AND d.holiday_acti // Check for all accounts $result = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.gender, d.surname, d.family, d.email, d.joined, d.last_online, d.ap_notified FROM `{!_MYSQL_PREFIX!}_user_data` AS d -WHERE d.status='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s) +WHERE d.`status`='CONFIRMED' AND d.joined < (UNIX_TIMESTAMP() - %s) AND d.last_online < (UNIX_TIMESTAMP() - %s) AND d.ap_notified < (UNIX_TIMESTAMP() - %s) ".$EXCLUDE_LIST." ORDER BY d.userid", array(getConfig('ap_inactive_since'), getConfig('ap_inactive_since'), getConfig('ap_inactive_since')), __FILE__, __LINE__); diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index 8619711604..7c000fc934 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -60,7 +60,7 @@ if (getConfig('beg_rallye') == "Y") { // Check if at least one is in the active rallye $result = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points, last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND beg_points > 0".$LAST." +WHERE `status`='CONFIRMED' AND beg_points > 0".$LAST." ORDER BY beg_points DESC, last_online DESC, userid", array($ONLINE), __FILE__, __LINE__); diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index e170f50333..0a97f1cea6 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -75,7 +75,7 @@ if (getConfig('bonus_active') == "Y") { // Check if at least one is in the active rallye $result = SQL_QUERY_ESC("SELECT userid AS uid, email, gender, surname, family, ".$USE." AS points, last_online AS last FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND ".$USE." > 0".$LAST." +WHERE `status`='CONFIRMED' AND ".$USE." > 0".$LAST." ORDER BY points DESC, last_online DESC, userid", array($ONLINE), __FILE__, __LINE__); diff --git a/inc/modules/admin/what-list_country.php b/inc/modules/admin/what-list_country.php index 8dbb524de2..c80463e1c8 100644 --- a/inc/modules/admin/what-list_country.php +++ b/inc/modules/admin/what-list_country.php @@ -62,7 +62,6 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Display message LOAD_TEMPLATE("admin_settings_saved", false, $MSG); - OUTPUT_HTML("
"); } elseif ((isset($_POST['change'])) && (!empty($_POST['id']))) { // Change all status ADMIN_CHANGE_ACTIVATION_STATUS($_POST['id'], "countries", "is_active"); @@ -156,7 +155,6 @@ if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr' // Display message LOAD_TEMPLATE("admin_settings_saved", false, $MSG); - OUTPUT_HTML("
"); } // Load currenty setup country codes to list diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index c8a623047f..d248df10f1 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -126,7 +126,7 @@ if (!empty($_GET['pid'])) { } // Clear payout request - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET status='ACCEPTED' WHERE id=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='ACCEPTED' WHERE id=%s LIMIT 1", array(bigintval($_GET['pid'])), __FILE__, __LINE__); // Send out mail @@ -165,7 +165,7 @@ if (!empty($_GET['pid'])) { } // Clear payout request - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET status='REJECTED' WHERE id=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='REJECTED' WHERE id=%s LIMIT 1", array(bigintval($_GET['pid'])), __FILE__, __LINE__); // Send out mail diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index 669457c5b2..32dfa7dd03 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -87,7 +87,6 @@ SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE id if (!empty($MSG)) { // Output message LOAD_TEMPLATE("admin_settings_saved", false, $MSG); - OUTPUT_HTML("
"); } } @@ -114,7 +113,6 @@ if (isset($_POST['add'])) { // Output message LOAD_TEMPLATE("admin_settings_saved", false, $MSG); - OUTPUT_HTML("
"); } elseif ((isset($_POST['edit'])) || (isset($_POST['del']))) { // Load all data $OUT = ""; $SW = 2; diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index 3e8f80cb75..abdf5274d0 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -49,15 +49,15 @@ if (empty($_GET['type'])) $_GET['type'] = "your"; switch ($_GET['type']) { case "your": // List only your own open (new) tasks - $whereStatement = "assigned_admin='".GET_CURRENT_ADMIN_ID()."' AND status='NEW' AND task_type != 'EXTENSION_UPDATE'"; + $whereStatement = "assigned_admin='".GET_CURRENT_ADMIN_ID()."' AND `status`='NEW' AND task_type != 'EXTENSION_UPDATE'"; break; case "updates": // List only updates assigned to you - $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND status='NEW' AND task_type = 'EXTENSION_UPDATE'"; + $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND `status`='NEW' AND task_type = 'EXTENSION_UPDATE'"; break; case "solved": // List only solved tasks assigned to you - $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND status='SOLVED'"; + $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND `status`='SOLVED'"; break; case "unassigned": // List unassigned (but not deleted) tasks @@ -65,11 +65,11 @@ case "unassigned": // List unassigned (but not deleted) tasks break; case "deleted": // List all deleted - $whereStatement = "status='DELETED'"; + $whereStatement = "`status`='DELETED'"; break; case "closed": // List all closed - $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND status='CLOSED'"; + $whereStatement = "assigned_admin=".GET_CURRENT_ADMIN_ID()." AND `status`='CLOSED'"; break; default: // Unknown type diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index ca6a77dbd3..5dd9832419 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -207,10 +207,10 @@ LIMIT 1", // Is a WHERE statement already there? if (!empty($whereStatement)) { // Then append the status column - $whereStatement .= sprintf(" AND status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['status'])))); + $whereStatement .= sprintf(" AND `status`='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['status'])))); } else { // Start a new one - $whereStatement = sprintf(" WHERE status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['status'])))); + $whereStatement = sprintf(" WHERE `status`='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['status'])))); } } elseif (isset($_GET['mode'])) { // Choose what we need to list @@ -251,7 +251,7 @@ LIMIT 1", $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset']; $result = SQL_QUERY($SQL, __FILE__, __LINE__); - $result_user = SQL_QUERY("SELECT emails_sent FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED'", __FILE__, __LINE__); + $result_user = SQL_QUERY("SELECT emails_sent FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED'", __FILE__, __LINE__); $user_count = SQL_NUMROWS($result_user); SQL_FREERESULT($result_user); diff --git a/inc/modules/admin/what-lock_sponsor.php b/inc/modules/admin/what-lock_sponsor.php index 2cfe38d92f..1fbb825981 100644 --- a/inc/modules/admin/what-lock_sponsor.php +++ b/inc/modules/admin/what-lock_sponsor.php @@ -78,7 +78,7 @@ if (!empty($_GET['id'])) { SEND_EMAIL($email, $subject, $msg); // Update sponsor's account - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET status='".$status."' WHERE id='%s' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$status."' WHERE id='%s' LIMIT 1", array(bigintval($_GET['id'])), __FILE__, __LINE__); } elseif (!empty($_POST['no'])) { // No don't lock / unlock now! diff --git a/inc/modules/admin/what-lock_user.php b/inc/modules/admin/what-lock_user.php index 1a4c705d50..88b2fff97b 100644 --- a/inc/modules/admin/what-lock_user.php +++ b/inc/modules/admin/what-lock_user.php @@ -58,11 +58,11 @@ if (!empty($_GET['u_id'])) { // Ok, lock the account! if (GET_EXT_VERSION("user") >= "0.3.5") { // Lock with reason - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET status='LOCKED',lock_reason='%s',lock_timestamp=NOW() WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='LOCKED',lock_reason='%s',lock_timestamp=NOW() WHERE userid=%s LIMIT 1", array($_POST['reason'], bigintval($_GET['u_id'])), __FILE__, __LINE__); } else { // Lock with no lock reason saved - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET status='LOCKED' WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='LOCKED' WHERE userid=%s LIMIT 1", array(bigintval($_GET['u_id'])), __FILE__, __LINE__); } @@ -82,11 +82,11 @@ if (!empty($_GET['u_id'])) { // Ok, unlock the account! if (GET_EXT_VERSION("user") >= "0.3.5") { // Reset lock reason as well - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET status='CONFIRMED',lock_reason='',lock_timestamp='0000-00-00 00:00' WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED',lock_reason='',lock_timestamp='0000-00-00 00:00' WHERE userid=%s LIMIT 1", array(bigintval($_GET['u_id'])), __FILE__, __LINE__); } else { // No lock reason to reset - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET status='CONFIRMED' WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED' WHERE userid=%s LIMIT 1", array(bigintval($_GET['u_id'])), __FILE__, __LINE__); } diff --git a/inc/modules/admin/what-overview.php b/inc/modules/admin/what-overview.php index 20a10573a7..21452467c8 100644 --- a/inc/modules/admin/what-overview.php +++ b/inc/modules/admin/what-overview.php @@ -82,8 +82,7 @@ if ($JOBS_DONE) { } elseif (!$taskExt) { if (EXT_IS_ACTIVE("task")) { // Output warning message - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(EXTENSION_WARNING_EXT_INACTIVE, "task")); - OUTPUT_HTML("
"); + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('EXTENSION_WARNING_EXT_INACTIVE'), "task")); } // List selected tasks on overview when task management is not active diff --git a/inc/modules/admin/what-send_newsletter.php b/inc/modules/admin/what-send_newsletter.php index 2db5f51889..f18caeab52 100644 --- a/inc/modules/admin/what-send_newsletter.php +++ b/inc/modules/admin/what-send_newsletter.php @@ -43,7 +43,7 @@ ADD_DESCR("admin", __FILE__); if (isset($_POST['ok'])) { $result = SQL_QUERY("SELECT userid, email FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND nl_receive='Y' +WHERE `status`='CONFIRMED' AND nl_receive='Y' ORDER BY userid ASC", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Members are available so we can send out the newsletter! diff --git a/inc/modules/admin/what-sub_points.php b/inc/modules/admin/what-sub_points.php index 4a2f026956..ec18232d4d 100644 --- a/inc/modules/admin/what-sub_points.php +++ b/inc/modules/admin/what-sub_points.php @@ -47,10 +47,10 @@ if ($_GET['u_id'] == "all") { // Add points to all accounts define('__POINTS_VALUE', $_POST['points']); if ((isset($_POST['ok'])) && ($_POST['points'] > 0)) { - $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); + $result_main = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); while (list($uid) = SQL_FETCHROW($result_main)) { // User ID found in URL so we use this give him some credits - $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); // Entry found? @@ -88,7 +88,7 @@ if ($_GET['u_id'] == "all") { } } elseif (!empty($_GET['u_id'])) { // User ID found in URL so we use this give him some credits - $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($_GET['u_id'])),__FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Selected user does exist diff --git a/inc/modules/admin/what-theme_import.php b/inc/modules/admin/what-theme_import.php index 9dbff1f165..41ac3d296f 100644 --- a/inc/modules/admin/what-theme_import.php +++ b/inc/modules/admin/what-theme_import.php @@ -77,7 +77,6 @@ VALUES ('%s','N','%s','%s')", // Output message LOAD_TEMPLATE("admin_settings_saved", false, $msg); - OUTPUT_HTML("
"); } // END - if // Initialize array diff --git a/inc/modules/admin/what-unlock_sponsor.php b/inc/modules/admin/what-unlock_sponsor.php index ae866f7c9c..a4c552c97c 100644 --- a/inc/modules/admin/what-unlock_sponsor.php +++ b/inc/modules/admin/what-unlock_sponsor.php @@ -52,8 +52,8 @@ if (isset($_POST['ok'])) { // Load his personal data $result_main = SQL_QUERY_ESC("SELECT gender, surname, family, email, remote_addr, sponsor_created, points_amount, refid FROM `{!_MYSQL_PREFIX!}_sponsor_data` -WHERE status='PENDING' AND id='%s' LIMIT 1", - array($id), __FILE__, __LINE__); +WHERE `status`='PENDING' AND id='%s' LIMIT 1", + array($id), __FILE__, __LINE__); $refid = 0; if (SQL_NUMROWS($result_main) == 1) { // Load data and free memory @@ -67,7 +67,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_paytypes` AS sp ON sp.id=so.payid WHERE so.sponsorid='%s' ORDER BY sp.pay_name", - array($id), __FILE__, __LINE__); + array($id), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Payment does exist while (list($aid, $count, $ordered, $status, $pname, $prate, $pcurr) = SQL_FETCHROW($result)) @@ -103,9 +103,9 @@ ORDER BY sp.pay_name", SQL_FREERESULT($result_main); // Unlock sponsor account - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET status='CONFIRMED' -WHERE id='%s' AND status='PENDING' LIMIT 1", - array($id), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='CONFIRMED' +WHERE id='%s' AND `status`='PENDING' LIMIT 1", + array($id), __FILE__, __LINE__); // Update, if applyable, referal count and points if (($refid > 0) && ($refid != $id)) { @@ -113,7 +113,7 @@ WHERE id='%s' AND status='PENDING' LIMIT 1", SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_amount=points_amount+%s, ref_count=ref_count+1 WHERE id='%s' LIMIT 1", - array(getConfig('sponsor_ref_points'), bigintval($refid)), __FILE__, __LINE__); + array(getConfig('sponsor_ref_points'), bigintval($refid)), __FILE__, __LINE__); // Whas that update fine? if (SQL_AFFECTEDROWS() == 1) { @@ -122,7 +122,7 @@ WHERE id='%s' LIMIT 1", (points_amount - points_used) AS points, receive_warnings, ref_count AS refs FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE id='%s' LIMIT 1", - array(bigintval($refid)), __FILE__, __LINE__); + array(bigintval($refid)), __FILE__, __LINE__); $REFERRAL = SQL_FETCHARRAY($result); // Send warnings out? @@ -134,7 +134,7 @@ WHERE id='%s' LIMIT 1", // Send notification to referal $REF_MSG = LOAD_EMAIL_TEMPLATE("sponsor_ref_notify", $REFERRAL); - SEND_EMAIL($REFERRAL['email'], SPONSOR_REF_NOTIFY_SUBJ, $REF_MSG); + SEND_EMAIL($REFERRAL['email'], getMessage('SPONSOR_REF_NOTIFY_SUBJ'), $REF_MSG); } // Free memory @@ -151,7 +151,7 @@ WHERE id='%s' LIMIT 1", // So let's send the email away $msg = LOAD_EMAIL_TEMPLATE("sponsor_unlocked", $content); - SEND_EMAIL($email, SPONSOR_UNLOCKED_SUBJ, $msg); + SEND_EMAIL($email, getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg); } } else { // Nothing selected @@ -163,9 +163,14 @@ WHERE id='%s' LIMIT 1", } // Begin listing of all pending sponsor accounts -$result = SQL_QUERY("SELECT id, gender, surname, family, email, remote_addr, sponsor_created -FROM `{!_MYSQL_PREFIX!}_sponsor_data` -WHERE status='PENDING' ORDER BY `id`", __FILE__, __LINE__); +$result = SQL_QUERY("SELECT + id, gender, surname, family, email, remote_addr, sponsor_created +FROM + `{!_MYSQL_PREFIX!}_sponsor_data` +WHERE + `status`='PENDING' +ORDER BY + `id`", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Entries found so let's list them! diff --git a/inc/modules/admin/what-unlock_surfbar_urls.php b/inc/modules/admin/what-unlock_surfbar_urls.php index 78af53c22b..3e52edd27e 100644 --- a/inc/modules/admin/what-unlock_surfbar_urls.php +++ b/inc/modules/admin/what-unlock_surfbar_urls.php @@ -64,7 +64,7 @@ if ((isset($_POST['unlock'])) && (is_array($_POST['id'])) && (count($_POST['id'] // List all URLs $result = SQL_QUERY("SELECT id, userid, url, UNIX_TIMESTAMP(registered) AS registered FROM `{!_MYSQL_PREFIX!}_surfbar_urls` -WHERE status='PENDING' +WHERE `status`='PENDING' ORDER BY `id` ASC", __FILE__, __LINE__); // Do we have some URLs left? diff --git a/inc/modules/guest/what-active.php b/inc/modules/guest/what-active.php index 2a6845808d..6221433fef 100644 --- a/inc/modules/guest/what-active.php +++ b/inc/modules/guest/what-active.php @@ -52,7 +52,7 @@ if (EXT_IS_ACTIVE("nickname")) $ADD = "nickname"; // Check for members who were active only this day $result = SQL_QUERY_ESC("SELECT userid, ".$ADD.", last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE last_online >= %s AND status='CONFIRMED' +WHERE last_online >= %s AND `status`='CONFIRMED' ORDER BY last_online DESC LIMIT %s", array(START_TDAY, getConfig('active_limit')), __FILE__, __LINE__); diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index 33ebc71eb2..a41e757126 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -45,14 +45,14 @@ if (!empty($_GET['hash'])) { $uid = 0; // Search for an unconfirmed or confirmed account - $result = SQL_QUERY_ESC("SELECT userid, email, refid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE user_hash='%s' AND (status='UNCONFIRMED' OR status='CONFIRMED') LIMIT 1", + $result = SQL_QUERY_ESC("SELECT userid, email, refid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE user_hash='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1", array($_GET['hash']), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Ok, he want's to confirm now so we load some data list ($uid, $email, $rid) = SQL_FETCHROW($result); // Unlock his account (but only when it is on UNCONFIRMED!) - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET status='CONFIRMED', ref_payout=%s, user_hash=NULL WHERE user_hash='%s' AND status='UNCONFIRMED' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED', ref_payout=%s, user_hash=NULL WHERE user_hash='%s' AND `status`='UNCONFIRMED' LIMIT 1", array(getConfig('ref_payout'), $_GET['hash']), __FILE__, __LINE__); if (SQL_AFFECTEDROWS() == 1) { $msg = LOAD_EMAIL_TEMPLATE("confirm-member", array('points' => getConfig('points_register')), bigintval($uid)); diff --git a/inc/modules/guest/what-mediadata.php b/inc/modules/guest/what-mediadata.php index 5fa8585278..7c51cb9540 100644 --- a/inc/modules/guest/what-mediadata.php +++ b/inc/modules/guest/what-mediadata.php @@ -77,13 +77,13 @@ if ($TEST > time()) { } // User who can receive mails -$result_max = SQL_QUERY("SELECT COUNT(max_mails) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__); +$result_max = SQL_QUERY("SELECT COUNT(max_mails) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__); list($dummy) = SQL_FETCHROW($result_max); SQL_FREERESULT($result_max); define('user_max_mails', $dummy); // Users who can receive mails today -$result_rec = SQL_QUERY("SELECT COUNT(receive_mails) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' AND receive_mails > 0", __FILE__, __LINE__); +$result_rec = SQL_QUERY("SELECT COUNT(receive_mails) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND receive_mails > 0", __FILE__, __LINE__); list($dummy) = SQL_FETCHROW($result_rec); SQL_FREERESULT($result_rec); define('user_max_rec', $dummy); diff --git a/inc/modules/guest/what-sponsor_login.php b/inc/modules/guest/what-sponsor_login.php index 87f1adfd7e..1cd64496cc 100644 --- a/inc/modules/guest/what-sponsor_login.php +++ b/inc/modules/guest/what-sponsor_login.php @@ -64,7 +64,7 @@ company, position, tax_ident, street_nr1, street_nr2, country, zip, city, email, phone, fax, cell, points_amount AS points, last_pay AS pay, last_curr AS curr FROM `{!_MYSQL_PREFIX!}_sponsor_data` -WHERE hash='%s' AND (status='UNCONFIRMED' OR status='EMAIL') +WHERE hash='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1", array($_GET['hash']), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Sponsor found, load his data... @@ -78,8 +78,8 @@ LIMIT 1", array($_GET['hash']), __FILE__, __LINE__); // Unconfirmed account or changed email address? if ($SPONSOR['status'] == "UNCONFIRMED") { // Set account to pending - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET status='PENDING' -WHERE id='%s' AND hash='%s' AND status='UNCONFIRMED' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='PENDING' +WHERE id='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1", array(bigintval($SPONSOR['id']), $_GET['hash']), __FILE__, __LINE__); // Check on success @@ -99,8 +99,8 @@ WHERE id='%s' AND hash='%s' AND status='UNCONFIRMED' LIMIT 1", } } elseif ($SPONSOR['status'] == "EMAIL") { // Changed email adress need to be confirmed - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET status='CONFIRMED' -WHERE id='%s' AND hash='%s' AND status='EMAIL' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='CONFIRMED' +WHERE id='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1", array(bigintval($SPONSOR['id']), $_GET['hash']), __FILE__, __LINE__); // Check on success @@ -133,7 +133,7 @@ WHERE id='%s' AND hash='%s' AND status='EMAIL' LIMIT 1", // Check email $result = SQL_QUERY_ESC("SELECT id, hash, status, remote_addr, gender, surname, family, sponsor_created FROM `{!_MYSQL_PREFIX!}_sponsor_data` -WHERE email='%s' AND (status='UNCONFIRMED' OR status='EMAIL') LIMIT 1", +WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1", array($_POST['email']), __FILE__, __LINE__); // Entry found? @@ -179,7 +179,7 @@ WHERE email='%s' AND (status='UNCONFIRMED' OR status='EMAIL') LIMIT 1", // Check email $result = SQL_QUERY_ESC("SELECT id, hash, remote_addr, gender, surname, family, sponsor_created FROM `{!_MYSQL_PREFIX!}_sponsor_data` -WHERE email='%s' AND id='%s' AND status='CONFIRMED' LIMIT 1", +WHERE email='%s' AND id='%s' AND `status`='CONFIRMED' LIMIT 1", array($_POST['email'], bigintval($_POST['id'])), __FILE__, __LINE__); // Entry found? if (SQL_NUMROWS($result) == 1) { @@ -235,7 +235,6 @@ WHERE id='%s' AND password='%s' LIMIT 1", } else { // Cookie setup failed! LOAD_TEMPLATE("admin_settings_saved", false, SPONSPOR_COOKIE_SETUP_FAILED); - OUTPUT_HTML("
"); // Login formular and other links LOAD_TEMPLATE("guest_sponsor_login"); @@ -244,7 +243,6 @@ WHERE id='%s' AND password='%s' LIMIT 1", // Status is not fine $content = constant('SPONSOR_LOGIN_FAILED_'.strtoupper($status).''); LOAD_TEMPLATE("admin_settings_saved", false, $content); - OUTPUT_HTML("
"); // Login formular and other links LOAD_TEMPLATE("guest_sponsor_login"); @@ -252,7 +250,6 @@ WHERE id='%s' AND password='%s' LIMIT 1", } else { // Account missing or wrong pass! We shall not find this out for the "hacker folks"... LOAD_TEMPLATE("admin_settings_saved", false, SPONSOR_LOGIN_FAILED_404_WRONG_PASS); - OUTPUT_HTML("
"); // Login formular and other links LOAD_TEMPLATE("guest_sponsor_login"); diff --git a/inc/modules/guest/what-stats.php b/inc/modules/guest/what-stats.php index 7fa594a0df..08bcfcf699 100644 --- a/inc/modules/guest/what-stats.php +++ b/inc/modules/guest/what-stats.php @@ -52,16 +52,16 @@ switch (getConfig('guest_stats')) { case "MEMBERS": // Statistics about your members // Members yesterday / today online - $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_YDAY." AND last_online < ".START_TDAY." AND status='CONFIRMED'", __FILE__, __LINE__)); - $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_TDAY." AND status='CONFIRMED'", __FILE__, __LINE__)); + $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_YDAY." AND last_online < ".START_TDAY." AND `status`='CONFIRMED'", __FILE__, __LINE__)); + $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".START_TDAY." AND `status`='CONFIRMED'", __FILE__, __LINE__)); // Yesterday / today registered $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".START_YDAY." AND joined < ".START_TDAY, __FILE__, __LINE__)); $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".START_TDAY, __FILE__, __LINE__)); // Only males / females - $male = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='M' AND status='CONFIRMED'", __FILE__, __LINE__)); - $female = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='F' AND status='CONFIRMED'", __FILE__, __LINE__)); + $male = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='M' AND `status`='CONFIRMED'", __FILE__, __LINE__)); + $female = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE gender='F' AND `status`='CONFIRMED'", __FILE__, __LINE__)); // Unconfirmed accounts $unconfirmed = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status != 'CONFIRMED'", __FILE__, __LINE__)); @@ -74,7 +74,7 @@ case "MEMBERS": // Statistics about your members for ($idx = 1; $idx < 13; $idx++) { $month = $idx; if ($idx < 10) $month = "0".$idx; - $months[$month] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE birth_month=%s AND status='CONFIRMED'", + $months[$month] = SQL_NUMROWS(SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE birth_month=%s AND `status`='CONFIRMED'", array(bigintval($month)), __FILE__, __LINE__)); } diff --git a/inc/modules/guest/what-top10.php b/inc/modules/guest/what-top10.php index f6bc1f06a1..b2c8104d52 100644 --- a/inc/modules/guest/what-top10.php +++ b/inc/modules/guest/what-top10.php @@ -51,7 +51,7 @@ FROM {!_MYSQL_PREFIX!}_user_data WHERE total_logins > 0 AND - status='CONFIRMED' + `status`='CONFIRMED' ORDER BY total_logins DESC LIMIT %s", @@ -115,7 +115,7 @@ ON p.userid=d.userid WHERE p.points > 0 AND - d.status='CONFIRMED' + d.`status`='CONFIRMED' GROUP BY p.userid ORDER BY @@ -181,7 +181,7 @@ ON r.userid=d.userid WHERE r.counter > 0 AND - d.status='CONFIRMED' + d.`status`='CONFIRMED' GROUP BY r.userid ORDER BY diff --git a/inc/modules/member/what-beg2.php b/inc/modules/member/what-beg2.php index 81237f37b7..49d608a0d6 100644 --- a/inc/modules/member/what-beg2.php +++ b/inc/modules/member/what-beg2.php @@ -55,7 +55,7 @@ if (EXT_IS_ACTIVE("autopurge")) { // Let's check if there are some points left we can "pay"... $result = SQL_QUERY_ESC("SELECT userid, beg_points AS beg, last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE beg_points > 0 AND status='CONFIRMED'".$LAST." +WHERE beg_points > 0 AND `status`='CONFIRMED'".$LAST." ORDER BY beg_points DESC, last_online DESC, userid LIMIT %s", array($ONLINE, getConfig('beg_ranks')), __FILE__, __LINE__); diff --git a/inc/modules/member/what-bonus.php b/inc/modules/member/what-bonus.php index 3b01a6f210..e405e625a3 100644 --- a/inc/modules/member/what-bonus.php +++ b/inc/modules/member/what-bonus.php @@ -72,7 +72,7 @@ if (EXT_IS_ACTIVE("autopurge")) { // Let's check if there are some points left we can "pay"... $result = SQL_QUERY_ESC("SELECT userid, ".$USE." AS points, last_online FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE ".$USE." > 0 AND status='CONFIRMED'".$LAST." +WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$LAST." ORDER BY points DESC, last_online DESC, userid LIMIT %s", array($ONLINE, getConfig('bonus_ranks')), __FILE__, __LINE__); diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index f1627a9584..3f39d1517e 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -198,7 +198,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", $result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM `{!_MYSQL_PREFIX!}_user_cats` AS c LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON c.userid=d.userid -WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0".$ADD." +WHERE c.cat_id=%s AND c.userid != '%s' AND d.`status`='CONFIRMED' AND d.receive_mails > 0".$ADD." ORDER BY d.%s %s", array( bigintval($_POST['cat']), @@ -428,7 +428,7 @@ array( $result_holiday = SQL_QUERY_ESC("SELECT DISTINCT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d LEFT JOIN `{!_MYSQL_PREFIX!}_user_holidays` AS h ON d.userid=h.userid -WHERE d.userid=%s AND d.receive_mails > 0 AND d.status='CONFIRMED' AND d.holiday_active='Y' +WHERE d.userid=%s AND d.receive_mails > 0 AND d.`status`='CONFIRMED' AND d.holiday_active='Y' AND h.holiday_start < UNIX_TIMESTAMP() AND h.holiday_end > UNIX_TIMESTAMP() LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); if (SQL_NUMROWS($result_holiday) == 1) { @@ -442,7 +442,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); if (!$HOL_ACTIVE) { // Check if the user want's to receive mails? - $result_ver = SQL_QUERY_ESC("SELECT zip FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s".$HTML." AND receive_mails > 0 AND status='CONFIRMED' LIMIT 1", + $result_ver = SQL_QUERY_ESC("SELECT zip FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s".$HTML." AND receive_mails > 0 AND `status`='CONFIRMED' LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); if ((SQL_NUMROWS($result_ver) == 1) && (!empty($_POST['zip'])) && (getConfig('order_multi_page') == "Y")) { diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index 4219cca7ff..3a3e730f1b 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -159,27 +159,21 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { if (empty($_POST['primera_nickname'])) { // Nothing entered in Primus nickname LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_USERNAME); - OUTPUT_HTML("
"); } elseif (empty($_POST['primera_password'])) { // Nothing entered in Primera password LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_PASSWORD); - OUTPUT_HTML("
"); } elseif (empty($_POST['amount'])) { // Nothing entered in amount LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT); - OUTPUT_HTML("
"); } elseif ($_POST['amount'] != bigintval($_POST['amount'])) { // Only numbers in amount! LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_AMOUNT); - OUTPUT_HTML("
"); } elseif ($_POST['amount'] < getConfig('primera_min_payout')) { // Not enougth entered! LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_AMOUNT_SMALLER_MIN, bigintval(getConfig('primera_min_payout')))); - OUTPUT_HTML("
"); } elseif ($_POST['amount'] > $points) { // Not enougth points left! LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points))); - OUTPUT_HTML("
"); } else { // All is fine here so do the payout $success = PRIMERA_EXECUTE_PAYOUT($_POST['primera_nickname'], md5($_POST['primera_password']), $_POST['amount']); @@ -206,11 +200,9 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { } elseif ((GET_PRIMERA_ERROR_CODE() == "user_failed") || (GET_PRIMERA_ERROR_CODE() == "own_failed") || (GET_PRIMERA_ERROR_CODE() == "amount_failed") || (GET_PRIMERA_ERROR_CODE() == "api_amount_failed")) { // Wrong login data LOAD_TEMPLATE("admin_settings_saved", false, GET_PRIMERA_ERROR_MESSAGE()); - OUTPUT_HTML("
"); } else { // Something went wrong LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_PAYOUT_FAILED, GET_PRIMERA_ERROR_MESSAGE())); - OUTPUT_HTML("
"); } } break; diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php index 7bd83a4acd..e751a5a9d2 100644 --- a/inc/modules/member/what-refback.php +++ b/inc/modules/member/what-refback.php @@ -72,18 +72,17 @@ if ((isset($_POST['edit'])) && (isset($_POST['id']))) { LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_REFBACK_DONE')); } elseif (isset($status['message'])) { // Something went wrong with error message - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(MEMBER_REFBACK_ERROR_MESSAGE, $status['message'])); + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('MEMBER_REFBACK_ERROR_MESSAGE'), $status['message'])); } else { // No message found - LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_REFBACK_ERROR_EMPTY_MESSAGE); + LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_REFBACK_ERROR_EMPTY_MESSAGE')); } } else { // Percents out-of-bounds ;-) - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(MEMBER_REFBACK_ERROR_OUT_OF_BOUNDS, getConfig('refback_min_perc'), getConfig('refback_max_perc'))); + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('MEMBER_REFBACK_ERROR_OUT_OF_BOUNDS'), getConfig('refback_min_perc'), getConfig('refback_max_perc'))); } // Insert line - OUTPUT_HTML("
"); } else { // Read data from refback table $content = GET_USER_REF_ENTRY($_POST['id']); diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 8c9abb01db..3f7c0308c7 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -99,7 +99,7 @@ case "new": // Start new transfer } // Re-check receivers and own personal data - $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN ('%s','%s') AND status='CONFIRMED' ORDER BY userid LIMIT 2", + $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email".$ADD." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN ('%s','%s') AND `status`='CONFIRMED' ORDER BY userid LIMIT 2", array($GLOBALS['userid'], bigintval($_POST['to_uid'])), __FILE__, __LINE__); $valid_data = (SQL_NUMROWS($result) == 2); @@ -226,11 +226,11 @@ case "new": // Start new transfer // Load member list if (EXT_IS_ACTIVE("nickname")) { // Load userid and nickname - $result = SQL_QUERY_ESC("SELECT userid, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid", + $result = SQL_QUERY_ESC("SELECT userid, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid", array($GLOBALS['userid']), __FILE__, __LINE__); } else { // Load only userid - $result = SQL_QUERY_ESC("SELECT userid, userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE status='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid", + $result = SQL_QUERY_ESC("SELECT userid, userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY userid", array($GLOBALS['userid']), __FILE__, __LINE__); } diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index b5f4913e6d..8e5465d241 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -201,23 +201,18 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { if (empty($_POST['wds66_id'])) { // Nothing entered in WDS66 user ID LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_USERNAME); - OUTPUT_HTML("
"); } elseif (empty($_POST['wds66_password'])) { // Nothing entered in WDS66 password LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_PASSWORD); - OUTPUT_HTML("
"); } elseif (empty($_POST['amount'])) { // Nothing entered in amount LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_AMOUNT); - OUTPUT_HTML("
"); } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) { // Only numbers in account ID! LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_USERNAME); - OUTPUT_HTML("
"); } elseif ($_POST['amount'] != bigintval($_POST['amount'])) { // Only numbers in amount! LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_AMOUNT); - OUTPUT_HTML("
"); } else { // Check input data depending on the mode and execute the requested mode switch ($_GET['mode']) { @@ -225,7 +220,6 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { if ($_POST['amount'] < getConfig('wernis_min_withdraw')) { // Not enougth entered! LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval(getConfig('wernis_min_withdraw')))); - OUTPUT_HTML("
"); } else { // All is fine here so do the withdraw $success = WERNIS_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']); @@ -244,11 +238,9 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { } elseif ((GET_WERNIS_ERROR_CODE() == "user_failed") || (GET_WERNIS_ERROR_CODE() == "own_failed") || (GET_WERNIS_ERROR_CODE() == "amount_failed")) { // Wrong login data LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE()); - OUTPUT_HTML("
"); } else { // Something went wrong LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_WITHDRAW_FAILED, GET_WERNIS_ERROR_MESSAGE())); - OUTPUT_HTML("
"); } } break; @@ -257,11 +249,9 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { if ($_POST['amount'] < getConfig('wernis_min_payout')) { // Not enougth entered! LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval(getConfig('wernis_min_payout')))); - OUTPUT_HTML("
"); } elseif ($_POST['amount'] > $points) { // Not enougth points left! LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points))); - OUTPUT_HTML("
"); } else { // All is fine here so do the withdraw $success = WERNIS_EXECUTE_PAYOUT($_POST['wds66_id'], $_POST['amount']); @@ -279,11 +269,9 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { } elseif ((GET_WERNIS_ERROR_CODE() == "user_failed") || (GET_WERNIS_ERROR_CODE() == "own_failed") || (GET_WERNIS_ERROR_CODE() == "amount_failed") || (GET_WERNIS_ERROR_CODE() == "api_amount_failed")) { // Wrong login data LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE()); - OUTPUT_HTML("
"); } else { // Something went wrong LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_WITHDRAW_FAILED, GET_WERNIS_ERROR_MESSAGE())); - OUTPUT_HTML("
"); } } break; diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index 6f659675d4..17a38d2a8b 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -70,7 +70,7 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC // SQL string to check for accounts $result_main = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points AS points FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED'".$whereStatement1." AND beg_points > 0 +WHERE `status`='CONFIRMED'".$whereStatement1." AND beg_points > 0 ORDER BY beg_points DESC, userid LIMIT %s", array($whereStatement2), __FILE__, __LINE__); diff --git a/inc/monthly/monthly_bonus.php b/inc/monthly/monthly_bonus.php index 3f2cfe959a..d90c75d387 100644 --- a/inc/monthly/monthly_bonus.php +++ b/inc/monthly/monthly_bonus.php @@ -48,7 +48,7 @@ $curr = date("m", time()); if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($CSS != 1)) { // Extension "autopurge" is inactive or purging of inactive accounts is deactivated - $whereStatement1 = "WHERE status='CONFIRMED'"; + $whereStatement1 = "WHERE `status`='CONFIRMED'"; $whereStatement2 = bigintval(getConfig('bonus_ranks')); // Shall I keep inactive members away from here? (mostly wanted in an "active-rallye" ...) @@ -56,7 +56,7 @@ if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($CS // Use last online stamp only when autopurge for inactive members is activated if (getConfig('ap_inactive_since') > 0) { // Okay, include last online timestamp - $whereStatement1 = sprintf("WHERE status='CONFIRMED' AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since')); + $whereStatement1 = sprintf("WHERE `status`='CONFIRMED' AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since')); $whereStatement2 = bigintval(getConfig('bonus_ranks')); } // END - if } // END - if diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 7afa45ddfe..0c85a3f765 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -728,7 +728,7 @@ function SEND_MODE_MAILS($mod, $modes) { global $DATA; // Load hash - $result_main = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result_main = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__); if (SQL_NUMROWS($result_main) == 1) { // Load hash from database @@ -1139,7 +1139,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid if ($locked) $data = "locked_points"; // Check user account - $result_user = SQL_QUERY_ESC("SELECT refid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result_user = SQL_QUERY_ESC("SELECT refid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},numRows=".SQL_NUMROWS($result_user).",points={$points}
\n"; @@ -1766,7 +1766,7 @@ function GET_TOTAL_RECEIVERS ($mode="normal") { // Query database $result_all = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE status='CONFIRMED' AND receive_mails > 0 ".PREPARE_SQL_HTML_HOLIDAY($mode), +WHERE `status`='CONFIRMED' AND receive_mails > 0 ".PREPARE_SQL_HTML_HOLIDAY($mode), __FILE__, __LINE__); // Get num rows @@ -1809,7 +1809,7 @@ function ADD_CATEGORY_OPTIONS ($mode) { $uid_cnt = 0; while (list($ucat) = SQL_FETCHROW($result_uids)) { $result_ver = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE userid=%s AND status='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML_HOLIDAY($mode)." LIMIT 1", +WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML_HOLIDAY($mode)." LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); $uid_cnt += SQL_NUMROWS($result_ver); @@ -1937,11 +1937,11 @@ function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") { if ((EXT_IS_ACTIVE("html_mail")) && ($mode == "html")) { // Only include HTML receivers - $result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.status='CONFIRMED' AND d.html='Y'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s", + $result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.html='Y'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s", array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FILE__, __LINE__); } else { // Include all - $result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.status='CONFIRMED'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s", + $result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s", array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FILE__, __LINE__); } diff --git a/inc/pool/pool-user.php b/inc/pool/pool-user.php index 99e50f6845..96b1280cbd 100644 --- a/inc/pool/pool-user.php +++ b/inc/pool/pool-user.php @@ -301,7 +301,7 @@ if (SQL_NUMROWS($result_main) > 0) { ); // We have to pay back some points to the sender (we add them directly :-P) - $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); $DATA[10] = $PB; $DATA[11] = $cnt_back[$uid]; diff --git a/inc/reset/reset_daily.php b/inc/reset/reset_daily.php index 03451375fe..1538627883 100644 --- a/inc/reset/reset_daily.php +++ b/inc/reset/reset_daily.php @@ -53,7 +53,7 @@ if (GET_EXT_VERSION("order") >= "0.1.1") { } // Transfer points from locked_points to points -$result_daily = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE ref_payout=0 AND status='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); +$result_daily = SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE ref_payout=0 AND `status`='CONFIRMED' ORDER BY userid", __FILE__, __LINE__); //* DEBUG: */ echo basename(__FILE__).":payout=0;daily|numRows=".SQL_NUMROWS($result_daily)."
\n"; if (SQL_NUMROWS($result_daily) > 0) diff --git a/lead-confirm.php b/lead-confirm.php index 793814e683..ae91870937 100644 --- a/lead-confirm.php +++ b/lead-confirm.php @@ -59,7 +59,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Is the cookie set? if (isSessionVariableSet('lead_uid')) { // Is the user-account unlocked and valid? - $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", array(bigintval(get_session('lead_uid'))), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Secure the ID number diff --git a/show_bonus.php b/show_bonus.php index d86e5fedbf..e614d11aab 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -81,7 +81,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { FROM `{!_MYSQL_PREFIX!}_user_data` AS d RIGHT JOIN `{!_MYSQL_PREFIX!}_bonus_turbo` AS b ON d.userid=b.userid -WHERE d.status='CONFIRMED' AND d.userid=%s AND b.%s=%s +WHERE d.`status`='CONFIRMED' AND d.userid=%s AND b.%s=%s LIMIT 1", array(bigintval($_GET['uid']), $t, bigintval($_GET['d'])), __FILE__, __LINE__);