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 > ".(time() - $_CONFIG['beg_timeout'])." OR (timeout > ".(time() - $_CONFIG['beg_uid_timeout'])." AND userid=%s)) AND remote_ip='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_beg_ips WHERE (timeout > (UNIX_TIMESTAMP() - ".$_CONFIG['beg_timeout'].") OR (timeout > (UNIX_TIMESTAMP() - ".$_CONFIG['beg_uid_timeout'].") AND userid=%s)) AND remote_ip='%s' LIMIT 1",
array($uid, getenv('REMOTE_ADDR')), __FILE__, __LINE__);
if ((SQL_NUMROWS($result) == 0) && ($points > 0) && (!$login)) {
// Free memory
// Shall I look for inactive accounts and autopurge inactive accounts?
if ($_CONFIG['ap_inactive'] == "Y") {
// Ok, let's have a look...
- $since = bigintval($_CONFIG['ap_in_since']);
+ $since = bigintval($_CONFIG['ap_inactive_since']);
$EXCLUDE_LIST = " AND d.userid != ".$_CONFIG['def_refid'];
// Check for more extensions
if (SQL_NUMROWS($result_inactive) > 0) {
// Prepare variables and constants...
$UIDs = "";
- define('__INACTIVE_SINCE', ($_CONFIG['ap_in_since'] / 60 / 60));
+ define('__INACTIVE_SINCE', ($_CONFIG['ap_inactive_since'] / 60 / 60));
define('__INACTIVE_TIME' , ($_CONFIG['ap_in_time'] / 60 / 60));
// Mark found accounts as inactive and send an email
define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "342");
+define('CURR_SVN_REVISION', "343");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
// Remove old entries
$OLD = $_CONFIG['beg_timeout'];
if ($_CONFIG['beg_uid_timeout'] > $OLD) $OLD = $_CONFIG['beg_uid_timeout'];
- $result_ext = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_beg_ips WHERE timeout < ".(time() - $OLD - 60*60), __FILE__, __LINE__);
+ $result_ext = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_beg_ips WHERE timeout < (UNIX_TIMESTAMP() -".($OLD - 60*60).")", __FILE__, __LINE__);
// Check for beg rallye is active and send mails out
if (($_CONFIG['beg_rallye'] == "Y") && ($_CONFIG['beg_new_mem_notify'] == "Y")) {
{
global $_CONFIG;
// Remove entries
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus_turbo WHERE timemark < ".(time() - $_CONFIG['bonus_timeout']), __FILE__, __LINE__);
+ $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus_turbo WHERE timemark < (UNIX_TIMESTAMP() - ".$_CONFIG['bonus_timeout'].")", __FILE__, __LINE__);
if (SQL_AFFECTEDROWS() > 0) {
// Send out email to admin
SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_TURBO_SUBJECT, "admin_autopurge_turbo", $DELETED, "");
function RALLYE_ADD_TOPUSERS($rallye,$default=0)
{
global $_CONFIG;
- $since = (time() - $_CONFIG['ap_in_since']);
+ $since = (time() - $_CONFIG['ap_inactive_since']);
// First check how many prices are set
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level",
global $DATA, $_CONFIG;
// Latest online time
- $since = (time() - $_CONFIG['ap_in_since']);
+ $since = (time() - $_CONFIG['ap_inactive_since']);
// Load rallye data
list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
if (EXT_IS_ACTIVE("autopurge")) {
// Start finding them...
- $since = (time() - $_CONFIG['ap_in_since']);
+ $since = (time() - $_CONFIG['ap_inactive_since']);
$EXCLUDE_LIST = " AND d.userid != ".$_CONFIG['def_refid']."";
// Check for more extensions
// Autopurge installed?
$LAST = ""; $ONLINE = "";
- if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_in_since'] > 0)) {
+ if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_inactive_since'] > 0)) {
// Use last online timestamp to keep inactive members away from here
$LAST = " AND last_online >= ";
- $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+ $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
}
$SQLs[] = "SELECT ".$USE." AS active_bonus FROM "._MYSQL_PREFIX."_user_data
// Autopurge installed?
$LAST = ""; $ONLINE = "";
- if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_in_since'] > 0)) {
+ if ((EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_inactive_since'] > 0)) {
// Use last online timestamp to keep inactive members away from here
$LAST = " AND last_online >= ";
- $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+ $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
}
$SQLs[] = "SELECT userid FROM "._MYSQL_PREFIX."_user_data
}
//
-function TRANSFER_AUTPPURGE($max, $age)
-{
+function TRANSFER_AUTPPURGE($max, $age) {
// First get total in-going lines
$result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_user_transfers_in ORDER BY id", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > $max)
- {
+ if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
// This will make it really old, so the final removal query will find it
$result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_transfers_in SET time_trans='0' ORDER BY id LIMIT ".$remove, __FILE__, __LINE__);
}
+
// Second get total out-going lines
$result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_user_transfers_out ORDER BY id", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > $max)
- {
+ if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
}
// Remove old in-going transfers
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_transfers_in WHERE time_trans < ".(time() - $age), __FILE__, __LINE__);
+ $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_transfers_in WHERE time_trans < (UNIX_TIMESTAMP() - ".$age.")", __FILE__, __LINE__);
$REMOVE = SQL_AFFECTEDROWS();
// Remove old out-going transfers
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_transfers_out WHERE time_trans < ".(time() - $age), __FILE__, __LINE__);
+ $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_transfers_out WHERE time_trans < (UNIX_TIMESTAMP() - ".$age.")", __FILE__, __LINE__);
$REMOVE += SQL_AFFECTEDROWS();
// Only send email to admin(s) when we have removed entries
// Shall I include only active members?
$ADD = "%s"; $VALUE = "";
-if (($_CONFIG['birthday_active']) && (EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_in_since'] > 0) && ($_CONFIG['ap_inactive'] == "Y"))
-{
- $ADD = " AND last_online >= %d";
- $VALUE = bigintval(time() - $_CONFIG['ap_in_since']);
+if (($_CONFIG['birthday_active']) && (EXT_IS_ACTIVE("autopurge")) && ($_CONFIG['ap_inactive'] == "Y") && ($_CONFIG['ap_inactive_since'] > 0)) {
+ $ADD = " AND last_online >= (UNIX_TIMESTAP() - %s)";
+ $VALUE = $_CONFIG['ap_inactive_since'];
}
// 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 < ".(time() - (ONE_DAY*364)).$ADD."
+WHERE status='CONFIRMED' AND birth_day=%s AND birth_month=%s AND birthday_sent < (UNIX_TIMESTAMP() - ".(ONE_DAY * 364).")".$ADD."
ORDER BY userid",
array($DAY, $MONTH, $VALUE), __FILE__, __LINE__);
-if (SQL_NUMROWS($result_birthday) > 0)
-{
+if (SQL_NUMROWS($result_birthday) > 0) {
// Start sending out birthday mails
- while (list($uid, $email, $byear) = SQL_FETCHROW($result_birthday))
- {
+ while (list($uid, $email, $byear) = SQL_FETCHROW($result_birthday)) {
// Calculate own timestamp for birthday and today
- $BD = $byear + 12*$MONTH + 365*$DAY;
- $NOW = $YEAR + 12*$MONTH + 365*$DAY;
+ $BD = $byear + 12 * $MONTH + 365 * $DAY;
+ $NOW = $YEAR + 12 * $MONTH + 365 * $DAY;
// Simply subtract both values and you got the age... :)
$AGE = $NOW - $BD;
- if ($_CONFIG['birthday_points'] > 0)
- {
+ if ($_CONFIG['birthday_points'] > 0) {
// Prepare array for loading template
$content = array(
'age' => $AGE,
'points' => $_CONFIG['birthday_points'],
'check' => "",
);
- for ($idx = 0; $idx < 4; $idx++)
- {
+
+ for ($idx = 0; $idx < 4; $idx++) {
$content['check'] .= GEN_RANDOM_CODE("8", rand(0, "$MONTH$DAY"), $uid, ($AGE*($idx+1)));
}
// Load email template with confirmation link
$msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($uid));
- }
- else
- {
+ } else {
// Load default email template and fill in the age
$msg = LOAD_EMAIL_TEMPLATE("member_birthday", $AGE, $uid);
}
case 'Y': define('__YES_UN', " checked"); define('__NO_UN', ""); break;
case 'N': define('__YES_UN', ""); define('__NO_UN', " checked"); break;
}
- define('__AP_IN_SINCE', $_CONFIG['ap_in_since']);
+ define('__AP_IN_SINCE', $_CONFIG['ap_inactive_since']);
define('__AP_IN_TIME' , $_CONFIG['ap_in_time']);
define('__AP_UN_TIME' , $_CONFIG['ap_un_time']);
define('__AP_NOTIFY_DEL_MAILS' , ADD_SELECTION("yn", $_CONFIG['ap_dm_notify'] , "ap_dm_notify"));
// Output time selection boxes
- define('__AP_IN_SINCE' , CREATE_TIME_SELECTIONS($_CONFIG['ap_in_since'] , "ap_inactive_since" , "MWDh"));
+ define('__AP_IN_SINCE' , CREATE_TIME_SELECTIONS($_CONFIG['ap_inactive_since'] , "ap_inactive_since" , "MWDh"));
define('__AP_IN_TIME' , CREATE_TIME_SELECTIONS($_CONFIG['ap_in_time'] , "ap_inactive_time" , "MWDh"));
define('__AP_UN_TIME' , CREATE_TIME_SELECTIONS($_CONFIG['ap_un_time'] , "ap_unconfirmed_time", "MWDh"));
define('__AP_TASK_TIME' , CREATE_TIME_SELECTIONS($_CONFIG['ap_tasks_time'], "ap_tasks_time" , "MWDh"));
ADD_DESCR("admin", basename(__FILE__));
// Ok, let's have a look...
-$since = bigintval(time() - $_CONFIG['ap_in_since']);
+$since = bigintval(time() - $_CONFIG['ap_inactive_since']);
$EXCLUDE_LIST = " AND d.userid != ".$_CONFIG['def_refid']."";
// Check for more extensions
{
// Use last online timestamp to keep inactive members away from here
$LAST = " AND last_online >= %s";
- $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+ $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
}
// Check if at least one is in the active rallye
}
// Prepare constant for timemark
- define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - $_CONFIG['ap_in_since'], "2"));
+ define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - $_CONFIG['ap_inactive_since'], "2"));
// Load final template
LOAD_TEMPLATE("admin_list_beg");
if (EXT_IS_ACTIVE("autopurge")) {
// Use last online timestamp to keep inactive members away from here
$LAST = " AND last_online >= %s";
- $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+ $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
}
// Check if at least one is in the active rallye
}
// Prepare constant for timemark
- define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - $_CONFIG['ap_in_since'], "2"));
+ define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - $_CONFIG['ap_inactive_since'], "2"));
// Load final template
LOAD_TEMPLATE("admin_list_bonus");
$ACTIONS[] = $act;
// Fix weight
- $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='".$cnt."' WHERE id='".$id."' LIMIT 1", __FILE__, __LINE__);
+ $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort=%s WHERE id=%s LIMIT 1",
+ array($cnt, $id), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Count one up
}
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHERE act='logout' AND (what='' OR what IS NULL) LIMIT 1", __FILE__, __LINE__);
+$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHERE action='logout' AND (what='' OR what IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
-foreach ($ACTIONS as $act)
-{
- $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE act='".$act."' AND what != '' AND what IS NOT NULL ORDER BY sort", __FILE__, __LINE__);
+foreach ($ACTIONS as $act) {
+ $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort",
+ array($act), __FILE__, __LINE__);
$cnt = 1;
- while (list($id) = SQL_FETCHROW($result_fix))
- {
+ while (list($id) = SQL_FETCHROW($result_fix)) {
// Fix weight
- $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='".$cnt."' WHERE id='".$id."' LIMIT 1", __FILE__, __LINE__);
+ $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort=%s WHERE id=%s LIMIT 1",
+ array($cnt, $id), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Count one up
$cnt++;
}
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHERE act='logout' AND (what='' OR what IS NULL) LIMIT 1", __FILE__, __LINE__);
+$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHERE action='logout' AND (what='' OR what IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
-foreach ($ACTIONS as $act)
-{
- $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE act='".$act."' AND what != '' AND what IS NOT NULL ORDER BY sort", __FILE__, __LINE__);
+foreach ($ACTIONS as $act) {
+ $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort",
+ array($act), __FILE__, __LINE__);
$cnt = 1;
- while (list($id) = SQL_FETCHROW($result_fix))
- {
+ while (list($id) = SQL_FETCHROW($result_fix)) {
// Fix weight
- $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='".$cnt."' WHERE id='".$id."' LIMIT 1", __FILE__, __LINE__);
+ $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort=%s WHERE id=%s LIMIT 1",
+ array($cnt, $id), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Count one up
// First fix all main menus (what="")...
$result_fix = SQL_QUERY("SELECT id, action FROM "._MYSQL_PREFIX."_member_menu WHERE (what='' OR what IS NULL) AND action != 'logout' ORDER BY sort ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
-while(list($id, $act) = SQL_FETCHROW($result_fix))
-{
+while(list($id, $act) = SQL_FETCHROW($result_fix)) {
// Store action value for later usage in sorting sub menus
$ACTIONS[] = $act;
// Fix weight
- $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='".$cnt."' WHERE id='".$id."' LIMIT 1", __FILE__, __LINE__);
+ $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET sort=%s WHERE id=%s LIMIT 1",
+ array($cnt, $id), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Count one up
$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='999' WHERE action='logout' AND (what='' OR what IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
-foreach ($ACTIONS as $act)
-{
- $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='".$act."' AND what != '' AND what IS NOT NULL ORDER BY sort", __FILE__, __LINE__);
+foreach ($ACTIONS as $act) {
+ $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort",
+ array($act), __FILE__, __LINE__);
$cnt = 1;
- while (list($id) = SQL_FETCHROW($result_fix))
- {
+ while (list($id) = SQL_FETCHROW($result_fix)) {
// Fix weight
- $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='".$cnt."' WHERE id='".$id."' LIMIT 1", __FILE__, __LINE__);
+ $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET sort=%s WHERE id=%s LIMIT 1",
+ array($cnt, $id), __FILE__, __LINE__);
$REP += SQL_AFFECTEDROWS();
// Count one up
{
// Use last online timestamp to keep inactive members away from here
$LAST = " AND last_online >= %s";
- $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+ $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
}
// Let's check if there are some points left we can "pay"...
{
// Use last online timestamp to keep inactive members away from here
$LAST = " AND last_online >= %s";
- $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
+ $ONLINE = bigintval(time() - $_CONFIG['ap_inactive_since']);
}
// Let's check if there are some points left we can "pay"...
define('__TRANSFER_ALL_LINK', $total);
}
- if (isset($_POST['ok']))
- {
+ if (isset($_POST['ok'])) {
// Save settings
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET opt_in='%s' WHERE userid=%s LIMIT 1",
array($_POST['opt_in'], $GLOBALS['userid']), __FILE__, __LINE__);
// "Settings saved..."
OUTPUT_HTML("<P><STRONG class=\"member_done\">".SETTINGS_SAVED."</STRONG></P>");
}
+
switch ($opt_in)
{
case 'Y':
}
// Check for latest out-transfers
- $result = SQL_QUERY_ESC("SELECT time_trans FROM "._MYSQL_PREFIX."_user_transfers_out WHERE time_trans > ".(time() - $_CONFIG['transfer_timeout'])." AND userid=%s ORDER BY time_trans DESC LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 0)
- {
+ $result = SQL_QUERY_ESC("SELECT time_trans FROM "._MYSQL_PREFIX."_user_transfers_out WHERE time_trans > (UNIX_TIMESTAMP() - ".$_CONFIG['transfer_timeout'].") AND userid=%s ORDER BY time_trans DESC LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 0) {
// Load template
define('__TRANSFER_SETTINGS_CONTENT', LOAD_TEMPLATE("member_transfer_settings", true));
- }
- else
- {
+ } else {
// Load newest transaction
list($newest) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
define('__TRANSFER_SETTINGS_CONTENT', TRANSFER_LATEST_IS_1.MAKE_DATETIME($newest, "3").TRANSFER_LATEST_IS_2);
}
+
// Load template
LOAD_TEMPLATE("member_transfer_overview");
break;
{
// Extension "autopurge" is inactive or purging of inactive accounts is deactivated
$whereStatement1 = "";
- $whereStatement2 = 0;
- $whereStatement3 = bigintval($_CONFIG['beg_ranks']);
+ $whereStatement2 = bigintval($_CONFIG['beg_ranks']);
// Let's check if there are some points left we can "pay"...
if (EXT_IS_ACTIVE("autopurge"))
{
// Use last online stamp only when autopurge for inactive members is activated
- if (($_CONFIG['ap_in_since'] > 0) && ($_CONFIG['beg_active'] == "Y"))
+ if (($_CONFIG['ap_inactive_since'] > 0) && ($_CONFIG['beg_active'] == "Y"))
{
// Okay, include last online timestamp
- $whereStatement1 = "AND last_online >=";
- $whereStatement2 = bigintval(time() - $_CONFIG['ap_in_since']);
- $whereStatement3 = bigintval($_CONFIG['beg_ranks']);
+ $whereStatement1 = sprintf("AND last_online >= (UNIX_TIMESTAMP() - %s)", bigintval($_CONFIG['ap_inactive_since']));;
+ $whereStatement2 = bigintval($_CONFIG['beg_ranks']);
}
}
// SQL string to check for accounts
$result_main = SQL_QUERY_ESC("SELECT userid, email, beg_points
-FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' ".$whereStatement1." %s AND beg_points > 0 ORDER BY beg_points DESC, userid LIMIT %s",
- array($whereStatement2, $whereStatement3), __FILE__, __LINE__);
+FROM "._MYSQL_PREFIX."_user_data
+WHERE status='CONFIRMED' ".$whereStatement1." AND beg_points > 0
+ORDER BY beg_points DESC, userid
+LIMIT %s",
+ array($whereStatement2), __FILE__, __LINE__);
- if (SQL_NUMROWS($result_main) > 0)
- {
+ if (SQL_NUMROWS($result_main) > 0) {
// Load our winners...
$UIDs = "";
- while(list($uid, $email, $points) = SQL_FETCHROW($result_main))
- {
+ while(list($uid, $email, $points) = SQL_FETCHROW($result_main)) {
// Add points to user's account directly
$result_data = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points
SET points=points+%s WHERE ref_depth=0 AND userid=%s LIMIT 1",
array($points, bigintval($uid)), __FILE__, __LINE__);
// Update mediadata as well
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
// Update database
MEDIA_UPDATE_ENTRY(array("total_points"), "add", $points);
}
if ($curr == "00") $curr = "12";
// Reset accounts
- $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET beg_points=0.00000 WHERE beg_points > 0",
- __FILE__, __LINE__);
+ $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET beg_points=0.00000 WHERE beg_points > 0", __FILE__, __LINE__);
}
// Free memory
if (EXT_IS_ACTIVE("autopurge"))
{
// Use last online stamp only when autopurge for inactive members is activated
- if ($_CONFIG['ap_in_since'] > 0)
+ if ($_CONFIG['ap_inactive_since'] > 0)
{
// Okay, include last online timestamp
$whereStatement1 = "WHERE status='CONFIRMED' AND last_online >=";
- $whereStatement2 = bigintval(time() - $_CONFIG['ap_in_since']);
+ $whereStatement2 = bigintval(time() - $_CONFIG['ap_inactive_since']);
$whereStatement3 = bigintval($_CONFIG['bonus_ranks']);
}
}