function checkUser()
{
if ($_REQUEST['code']) {
$redirect_uri = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'taobao', 'do' => "bind"));
$url = 'https://oauth.taobao.com/token';
$field = 'grant_type=authorization_code&client_id=' . TAOBAO_KEY . '&code=' . $_REQUEST['code'] . '&client_secret=' . TAOBAO_SECRET . '&redirect_uri=' . urlencode($redirect_uri);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $field);
$result = curl_exec($ch);
$res = json_decode($result, TRUE);
if ($res['taobao_user_id']) {
$_SESSION['taobao']['access_token']['oauth_token'] = $res['access_token'];
$_SESSION['taobao']['access_token']['oauth_token_secret'] = $res['refresh_token'];
$_SESSION['taobao']['isSync'] = 1;
$_SESSION['taobao']['uid'] = $res['taobao_user_id'];
$_SESSION['taobao']['uname'] = $res['taobao_user_nick'];
$_SESSION['taobao']['userface'] = '';
$_SESSION['open_platform_type'] = 'taobao';
return $res;
} else {
return false;
}
} else {
return false;
}
}