public function actionsaveUser() { //Метод сохранения пользователей $parse_str = array(); parse_str($_POST['post'], $parse_str); foreach ($parse_str as $k => $v) { $this->post[$k] = MYChtml::fromUTF8($v); // iconv("UTF-8","windows-1251",$v); } if (Users::checkDoubleLogin($this->post['login'])) { $this->ajaxMessages('dphone'); } if (strlen($this->post['email']) > 0) { if (Users::checkDoubleEmail($this->post['email'])) { $this->ajaxMessages('demail'); } if (!AccessoryFunctions::emailValidation($this->post['email'])) { $this->ajaxMessages('femail'); } } if ($this->post['password'] != $this->post['password_repeat']) { $this->ajaxMessages('dpassword'); } echo Users::saveUser($this->post); }
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; }
static function changeIdDevice($from, $to) { if (self::checkDeviceId($from) && !self::checkDeviceId($to)) { $from = Yii::app()->BNComplex->createCommand("SELECT DeviceID from [BNComplex].[dbo].[Devices] where DevNum='" . AccessoryFunctions::addZeroTodeviceId($from) . "'")->queryRow(); Yii::app()->BNComplex->createCommand("UPDATE [BNComplex].[dbo].[Devices] set DevNum='" . AccessoryFunctions::addZeroTodeviceId($to) . "' where DeviceID='" . $from["DeviceID"] . "'")->query(); } if (!self::checkDeviceId($to)) { $glonass = Glonass::model()->find("device_id=:device_id and deleted = 0", array(":device_id" => $to)); self::createObjectAndDevice($glonass); } }
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; }
public static function view_date($val) { return AccessoryFunctions::showDate($val); }