- if (SQL_NUMROWS($result) == 1) {
- // Load data
- list($pool, $URL, $EXTRA_TITLE) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Is the user's ID unlocked?
- $result = SQL_QUERY_ESC("SELECT status, gender, surname, family FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($url_uid), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- list($status, $gender, $sname, $fname) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- if ($status == "CONFIRMED") {
- // User has confirmed his account so we can procede...
- switch ($ltype)
- {
- case "NORMAL":
- $result = SQL_QUERY_ESC("SELECT payment_id FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1",
- array(bigintval($pool)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
- list($pay) = SQL_FETCHROW($result);
- $time = GET_PAY_POINTS($pay, "time");
- $payment = GET_PAY_POINTS($pay, "payment");
- $VALID = true;
- }
-
- // Free memory
- SQL_FREERESULT($result);
+ // Is the user id valid?
+ if (fetchUserData($data['userid']) === TRUE) {
+ // Is the user status CONFIRMED?
+ if (getUserData('status') == 'CONFIRMED') {
+ // User has confirmed his account so we can procede...
+ // @TODO Rewrite this to a filter
+ switch ($data['link_type']) {
+ case 'NORMAL':
+ $result = sqlQueryEscaped("SELECT `payment_id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
+ array(bigintval($data['pool_id'])), __FILE__, __LINE__);
+
+ // Entry found?
+ if (sqlNumRows($result) == 1) {
+ $data = merge_array($data, sqlFetchArray($result));
+ $data['time'] = getPaymentTime($data['payment_id']);
+ $data['payment'] = getPaymentPayment($data['payment_id']);
+ $isValid = TRUE;
+ } // END - if
+
+ // Free memory...
+ sqlFreeResult($result);