-// No refid by default
-$URL = 'index.php';
-
-// Invalid request by default
-$ref = 0;
-
-// Base URL for redirection
-switch (getConfig('refid_target')) {
- case 'register':
- $URL = 'modules.php?module=index&what=register&refid=';
- break;
-
- case 'index':
- $URL = 'index.php?refid=';
- break;
-} // END - switch
-
-// Get referal ID from ref or refid variable
-if (isGetRequestElementSet('ref')) $ref = getRequestElement('ref');
- elseif (isGetRequestElementSet('refid')) $ref = getRequestElement('refid');
-
-if (!empty($ref)) {
- // Test if nickname or numeric id
- if (isExtensionActive('nickname')) {
- // Nickname in URL, so load the ID
- $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `nickname`='%s' LIMIT 1",
- array($ref), __FILE__, __LINE__);
-
- // Do we have an entry?
- if (SQL_NUMROWS($result) == 1) {
- // Load userid
- list($ref) = SQL_FETCHROW($result);
- } else {
- // So do we have a userid?
- $result2 = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`='%s' LIMIT 1",
- array($ref), __FILE__, __LINE__);