-// Is the script installed?
-if (!isInstalled()) {
- // You have to install first!
- redirectToUrl('install.php');
-} // END - if
-
-// Probe for referal ID
-if (REQUEST_ISSET_GET('refid')) $GLOBALS['refid'] = REQUEST_GET('refid');
-
-// Only check this if refid is provided!
-if ($GLOBALS['refid'] > 0) {
- // Do we have nickname or userid set?
- if (isNicknameUsed($GLOBALS['refid'])) {
- // Nickname in URL, so load the ID
- $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
- array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
- } else {
- // Direct userid entered
- $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
- array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
- }
-
- // Load data
- list($rid, $status_ref) = SQL_FETCHROW($result);
- $GLOBALS['refid'] = bigintval($rid);
-
- // Free memory
- SQL_FREERESULT($result);
-} // END - if
-
-// Init userid
-$uid = 0;
-
-// If no account was found set default refid and status to CONFIRMED
-if (empty($GLOBALS['refid'])) {
- $GLOBALS['refid'] = getConfig('def_refid');
- $status = 'CONFIRMED';
-} // END - if