function getByPhoneNum() { if (!($phone = $_REQUEST['From'])) { Error::sms("The SMS sender's phone number was not detected."); } if (!($body = $_REQUEST['Body'])) { Error::sms("Missing email address."); } $sql = "SELECT user_id, email, wallet FROM users WHERE phone=?"; $row = DBquery::get($sql, array($phone)); if ($row) { if ($body != $row[0]['email']) { Error::sms("The email address does not match the one set for phone #{$phone}."); } else { $this->user_id = $row[0]['user_id']; Requester::$consumer_id = $row[0]['wallet']; return $this->setToken(); } } else { require_once "models/UserCollection.php"; $Users = new UserCollection(json_decode('{ "email": "' . $body . '", "name": "' . $body . '", "password": "******", "phone": "' . $phone . '", "login_provider": "phone", "wallet": 2 }')); $arr = $Users->add(); $this->user_id = $arr[0]->user_id; return $this->setToken(); } }
/** * Enter description here... * * @param array $RecordSet * @return UserCollection */ private function doLoad($RecordSet) { $UserCollection = new UserCollection(); foreach ($RecordSet as $Row) { $UserCollection->add(new User($Row['i_Id'], $Row['s_Name'], $Row['s_Pass'], $Row['s_Email'], $Row['i_Login'], $Row['i_Refresh'], $Row['b_Looked'], $Row['d_RegisterDate'], $Row['b_Premium'], $Row['i_SpaceMax'], $Row['s_Folder'])); } return $UserCollection; }
function sendRegistrationCode($row) { if ($this->verType == 'register' and $row and $row['password']) { Error::http(403, "There is already a user with the email='{$this->email}'. If you typed your email correctly, recover your password instead of registering."); } $this->setAndMailVerCode(); require_once "models/UserCollection.php"; $Users = new UserCollection(json_decode('{ "email": "' . $this->email . '", "password": "******", "login_provider": "email", "ver_code": "' . $this->verCode . '", "ver_expires": "' . $this->verExpires . '" }')); $user = $Users->add()[0]; return array($user); }
function getByOauthID($info) { $tw_id = "" . $info['user_id']; $sql = "SELECT user_id FROM users WHERE tw_id=?"; $row = DBquery::get($sql, array($tw_id)); if ($row) { return $row[0]['user_id']; } require_once "models/UserCollection.php"; $Users = new UserCollection(json_decode('{ "name": "' . $info['screen_name'] . '", "password": "******", "tw_id": "' . $tw_id . '", "login_provider": "tw" }')); $arr = $Users->add(); return $arr[0]->user_id; }
function getByOauthID($user) { $fb_id = "" . $user->id; $sql = "SELECT user_id FROM users WHERE fb_id=?"; $row = DBquery::get($sql, array($fb_id)); if ($row) { return $row[0]['user_id']; } require_once "models/UserCollection.php"; $Users = new UserCollection(json_decode('{ "email": "' . $user->email . '", "name": "' . $user->first_name . " " . $user->last_name . '", "password": "******", "fb_id": "' . $fb_id . '", "login_provider": "fb" }')); $arr = $Users->add(); return $arr[0]->user_id; }
public function handle(RegisterUser $command) { $user = User::registerWithData($command->userName(), Email::fromString($command->email())); $this->userCollection->add($user); }