@WalkersRei

Ошибка: Number of args (0) doesn't match number of placeholders (1)?

VK недавно выпустили глобальное обновление API 5.0, отключив маржинальные 3.0 и 4.0. Теперь подстраивал авторизацию под новый стандарт и тут ошибка:
Ошибка: Number of args (0) doesn't match number of placeholders (1) in [INSERT INTO `users`(user_login, user_login_show, user_domain, user_avatar, user_vk, user_reg_ip, user_donate_page) VALUES ('vkid4921556', 'ввыа ававаыыва', 'vkid4921556', 'https://pp.userapi.com/c849032/v849032088/1bea72/DCKK3LTGlZM.jpg?ava=1', '4921556', '5.18.232.70', '{"min_sum":"1","rec_sum":"50","text":"","fuck_filter":"0","fuck_name_filter":"0","fuck_words":"","bg_color":"#e0e0e0","bg_type":"1","bg_size":"auto","bg_image":"","bg_image_name":"","bg_repeat":"no-repeat","bg_position":"center","bg_header_type":"1","bg_header_image":"","bg_header_size":"auto","bg_header_repeat":"no-repeat","bg_header_position":"center","bg_header_color":"#f2f2f2","text_header_color":"#000000","btn_color":"#ff5400","btn_text_color":"#ffffff"}')]

В интернете не нашел внятного объяснение.
Вот сам код:
private function LoginWithVk()
	{
		model("User");
		if (isset($this->request->get["code"])) {	
	    	$token = $this->VKGetAuthToken($this->request->get["code"]);
	    	if (isset($token['access_token'])) {
	    		$userInfo = $this->VKGetUserInfo($token);
				//dd($userInfo);
		        if (isset($userInfo['response'][0]['id'])) {
		            $userInfo = $userInfo['response'][0];
		            if(!($user = $this->UserModel->getUser($userInfo['id'], "user_vk")))
		            {
		            	$data = [
		            		"user_login" 	  =>		"vkid".$userInfo["id"],
                            "user_login_show" =>     $userInfo['first_name']. " " . $userInfo['last_name'],
                            "user_domain"   =>      "vkid".$userInfo["id"],
		            		"user_avatar"	=>		(!empty($userInfo["photo_big"])) ? $userInfo["photo_big"] : "/assets/images/no_avatar.png",
		            		"user_vk"		=>		$userInfo['id'],
		            		"user_reg_ip"	=>		$_SERVER["REMOTE_ADDR"],
                            "user_donate_page"          =>  "{\"min_sum\":\"1\",\"rec_sum\":\"50\",\"text\":\"\",\"fuck_filter\":\"0\",\"fuck_name_filter\":\"0\",\"fuck_words\":\"\",\"bg_color\":\"#e0e0e0\",\"bg_type\":\"1\",\"bg_size\":\"auto\",\"bg_image\":\"\",\"bg_image_name\":\"\",\"bg_repeat\":\"no-repeat\",\"bg_position\":\"center\",\"bg_header_type\":\"1\",\"bg_header_image\":\"\",\"bg_header_size\":\"auto\",\"bg_header_repeat\":\"no-repeat\",\"bg_header_position\":\"center\",\"bg_header_color\":\"#f2f2f2\",\"text_header_color\":\"#000000\",\"btn_color\":\"#ff5400\",\"btn_text_color\":\"#ffffff\"}"
		            	];
		            	$id = Builder::table('users')->insert($data);
		            	$this->UserModel->trackIP($id, 0);
                        $this->createDefaultWidgets($id);
		            	$this->ToOnline($id);
		            }else {
		            	$this->ToOnline($user['id']);
		            }
		            
		        }
	    	}  
		}
		else
		{
			$this->VKRedirectToLogin();
		}

	}

	/*VKAuth*/
	private function VKRedirectToLogin()
	{
		$url = 'http://oauth.vk.com/authorize';
		$params = array(
		    'client_id'     => config()->vk["client_id"],
		    'redirect_uri'  => config()->vk["redirect_uri"],
		   	'response_type' => 'code'
		);
		redirect($url.'?'.urldecode(http_build_query($params)));
	}

	private function VKGetAuthToken($code)
	{
		$params = [
		    'client_id'     => config()->vk["client_id"],
		    'client_secret' => config()->vk["client_secret"],
		    'code' => $code,
		    'redirect_uri'  => config()->vk["redirect_uri"],
		];
		return json_decode($this->get_curl('https://oauth.vk.com/access_token' . '?' . urldecode(http_build_query($params))), true);
	}

	private function VKGetUserInfo($token)
	{
		$params = [
            'uids'         => $token['user_id'],
            'fields'       => 'uid,first_name,last_name,screen_name,sex,bdate,photo_big',
            'access_token' => $token['access_token'],
			'v'            => '5.0'
        ];
    	return $userInfo = json_decode($this->get_curl('https://api.vk.com/method/users.get' . '?' . urldecode(http_build_query($params))), true);
	}

	/*EndVKAuth*/
  • Вопрос задан
  • 243 просмотра
Пригласить эксперта
Ответы на вопрос 1
mad_maximus
@mad_maximus
Ошибка не в авторизации. Покажите свой sql запрос.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы