}
// Set cookie when default refid > 0
- if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) {
+ if (!isSessionVariableSet('refid') || (isValidUserId($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) {
// Default is not found
$found = false;
getModule(),
$action,
getWhat(),
- $userid,
+ makeDatabaseUserId($userid),
makeDatabaseUserId(determineReferalId()),
$isMember,
$isAdmin,
getModule(),
$action,
getWhat(),
- $userid,
+ makeDatabaseUserId($userid),
makeDatabaseUserId(determineReferalId()),
$isMember,
$isAdmin,
`id`, `gender`, `surname`, `family`, `email`, `status`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`,
UNIX_TIMESTAMP(`last_online`) AS `last_online`,
- `points_amount`, `points_used`, `remote_addr`
+ `points_amount`, `points_used`,
+ (`points_amount` + `points_used`) AS `points`,
+ `remote_addr`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
ORDER BY
$content['email'] = generateEmailLink($content['email'], 'sponsor_data');
$content['sponsor_created'] = generateDateTime($content['sponsor_created'], 2);
$content['last_online'] = generateDateTime($content['last_online'], 2);
- $content['points'] = ($content['points_amount'] - $content['points_used']);
// Load row template
$OUT .= loadTemplate('admin_list_sponsor_row', true, $content);
$result_main = SQL_QUERY_ESC("SELECT
`id`, `gender`, `surname`, `family`, `email`, `remote_addr`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`,
- `points_amount`, `points_used`, `refid`
+ `points_amount`, `points_used`,
+ (`points_amount` + `points_used`) AS `points`,
+ `refid`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
WHERE
// Load data
$content = SQL_FETCHARRAY($result_main);
- // Add total amount
- $content['points'] = ($content['points_amount'] - $content['points_used']);
-
// Check for open payments and close them
$result = SQL_QUERY_ESC("SELECT
so.admin_id, so.pay_count,
// Init some data
$ret = '';
- if (empty($GLOBALS['refid'])) $GLOBALS['refid'] = '0';
// Base directory
$basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
// No refid by default
$URL = 'modules.php?module=index';
-if (determineReferalId() != 0) {
+if (isValidUserId(determineReferalId())) {
// Test if nickname or numeric id
if (isExtensionActive('nickname')) {
// Nickname in URL, so load the id
if (isValidUserId(determineReferalId())) {
// Update ref counter
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
- array(determineReferalId()), __FILE__, __LINE__);
+ array(makeDatabaseUserId(determineReferalId())), __FILE__, __LINE__);
// Base URL for redirection
switch (getConfig('refid_target')) {
$URL = 'modules.php?module=index&what=sponsor_reg&refid=';
// Do we have a referal id?
-if (!empty($GLOBALS['refid'])) {
+if (isValidUserId($GLOBALS['refid'])) {
// We have an refid here. So we simply add it
$URL .= $GLOBALS['refid'];
} else {