public static function SignUpRequestV1($post) { $url = Yii::app()->params['service']['url'] . '/json/reply/SignUpRequestV1'; $params = array('Phone' => AccessoryFunctions::clearTel($post['login']), 'Password' => $post['password'], 'Name' => $post['name'], 'Occupation' => 3, 'Company' => $post['company'], 'Email' => $post['email'], 'Skype' => $post['skype']); $result = file_get_contents($url, false, stream_context_create(array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($params))))); $date = json_decode($result); return $date->Status; }
public function authenticate() { $this->_id = 1; $this->errorCode = self::ERROR_NONE; return $this->errorCode == self::ERROR_NONE; $users = Users::model()->find("LOWER(login)=:username and password=:password", array(":username" => AccessoryFunctions::clearTel($this->username), ":password" => md5($this->password))); if ($users === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { $this->_id = $users->id; $users->last_in = new CDbExpression('NOW()'); $users->mobile_platform = 0; $users->mobile_version = 0; $users->save(); Yii::app()->user->setState("name", $users->name); Yii::app()->user->setState("occupation", $users->MobileUserRole->occupation); $this->errorCode = self::ERROR_NONE; } return $this->errorCode == self::ERROR_NONE; }