$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
// Get current day (01 to 31), month (01 to 12) and year (4-digits year)
$DAY = date("d", time());
// Get current day (01 to 31), month (01 to 12) and year (4-digits year)
$DAY = date("d", time());
-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['autopurge_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
}
// Only confirmed members shall receive birthday mails...
$result_birthday = SQL_QUERY_ESC("SELECT userid, email, birth_year
FROM "._MYSQL_PREFIX."_user_data
ORDER BY userid",
array($DAY, $MONTH, $VALUE), __FILE__, __LINE__);
ORDER BY userid",
array($DAY, $MONTH, $VALUE), __FILE__, __LINE__);
// Prepare array for loading template
$content = array(
'age' => $AGE,
'points' => $_CONFIG['birthday_points'],
'check' => "",
);
// Prepare array for loading template
$content = array(
'age' => $AGE,
'points' => $_CONFIG['birthday_points'],
'check' => "",
);
- for ($idx = 0; $idx < 4; $idx++)
- {
- $content['check'] .= GEN_RANDOM_CODE("8", rand(0, "$MONTH$DAY"), $uid, ($AGE*($idx+1)));
+
+ for ($idx = 0; $idx < 4; $idx++) {
+ $content['check'] .= GEN_RANDOM_CODE("8", mt_rand(0, "$MONTH$DAY"), $uid, ($AGE*($idx+1)));
- $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_birthday (userid, points, chk_value) VALUES ('%s', '%s', '%s' )",
+ $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_birthday (userid, points, chk_value) VALUES ('%s','%s','%s' )",
array(bigintval($uid), $_CONFIG['birthday_points'], $content['check']), __FILE__, __LINE__);
// Load email template with confirmation link
$msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($uid));
array(bigintval($uid), $_CONFIG['birthday_points'], $content['check']), __FILE__, __LINE__);
// Load email template with confirmation link
$msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($uid));
// Load default email template and fill in the age
$msg = LOAD_EMAIL_TEMPLATE("member_birthday", $AGE, $uid);
}
// Send email
// Load default email template and fill in the age
$msg = LOAD_EMAIL_TEMPLATE("member_birthday", $AGE, $uid);
}
// Send email