-// Is the script installed?
-if (isInstalled()) {
- // 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) {
- // Probe for nickname extension and if a nickname was supplied by URL
- $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round($GLOBALS['refid']).'') != $GLOBALS['refid']));
-
- // Do we have nickname or userid set?
- if ($probe_nickname === true) {
- // 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__);
+// Probe for referal id
+if (isGetRequestElementSet('refid')) $GLOBALS['refid'] = getRequestElement('refid');
+
+// Only check this if refid is provided!
+if (determineReferalId() > 0) {
+ // Do we have nickname or userid set?
+ if (isNicknameUsed(determineReferalId())) {
+ // 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(determineReferalId()), __FILE__, __LINE__);
+ } else {
+ // Direct userid entered
+ $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ array(determineReferalId()), __FILE__, __LINE__);
+ }
+
+ // Load data
+ list($rid, $status_ref) = SQL_FETCHROW($result);
+ $GLOBALS['refid'] = bigintval($rid);
+
+ // Free memory
+ SQL_FREERESULT($result);
+} // END - if
+
+// Init userid
+$userid = 0;
+
+// If no account was found set default refid and status to CONFIRMED
+if (empty($GLOBALS['refid'])) {
+ // Determine referal id again
+ $GLOBALS['refid'] = determineReferalId();
+ $status = 'CONFIRMED';
+} // END - if
+
+// Init content array
+$content = array(
+ 'message' => '',
+);
+
+// Begin with doubler script...
+if (isFormSent()) {
+ // Secure points (so only integer/double values are allowed
+ setRequestPostElement('points', bigintval(postRequestElement('points')));
+
+ // Begin with doubling process
+ if ((isPostRequestElementSet('userid')) && (isPostRequestElementSet('pass')) && (isPostRequestElementSet('points'))) {
+ // Probe for nickname extension and if a nickname was entered
+ if (isNickNameUsed(postRequestElement('userid'))) {
+ // Nickname in URL, so load the id
+ $result = SQL_QUERY_ESC("SELECT `userid`, `status`, `password` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `nickname`='%s' LIMIT 1",
+ array(postRequestElement('userid')), __FILE__, __LINE__);