+ INNER JOIN accounts AS a ON (m.uid = a.uid)
+ INNER JOIN account_profiles AS ap ON (a.uid = ap.id AND FIND_IN_SET('owner', ap.perms))
+ INNER JOIN profiles AS p ON (p.pid = ap.id)
+ INNER JOIN profile_display AS pd ON (p.pid = pd.pid)
+ INNER JOIN profile_name AS pnl ON (p.pid = pnl.pid AND pnl.typeid = {?})
+ INNER JOIN profile_name AS pnf ON (p.pid = pnf.pid AND pnf.typeid = {?})
+ WHERE m.hash = {?}",
+ $nameTypes['name_ini'], $nameTypes['firstname_ini'], $hash);
+
+ if (list($uid, $promo, $lastname, $firstname, $xorgid, $birthdate, $watch) = $res->fetchOneRow()) {
+ $sub_state['uid'] = $uid;
+ $sub_state['hash'] = $hash;
+ $sub_state['yearpromo'] = substr($promo, 1, 4);
+ $sub_state['promo'] = $promo;
+ $sub_state['lastname'] = $lastname;
+ $sub_state['firstname'] = $firstname;
+ $sub_state['xorgid'] = $xorgid;
+ $sub_state['birthdate_ref'] = $birthdate;
+ $sub_state['watch'] = $watch;
+
+ XDB::execute('REPLACE INTO register_mstats (uid,sender,success)
+ SELECT m.uid, m.sender, 0
+ FROM register_marketing AS m
+ WHERE m.hash',
+ $sub_state['hash']);