pos機(jī)網(wǎng)站源碼

 新聞資訊3  |   2023-08-30 10:05  |  投稿人:pos機(jī)之家

網(wǎng)上有很多關(guān)于pos機(jī)網(wǎng)站源碼,6個(gè)PHP國(guó)內(nèi)各大網(wǎng)站登錄類庫(kù)的知識(shí),也有很多人為大家解答關(guān)于pos機(jī)網(wǎng)站源碼的問(wèn)題,今天pos機(jī)之家(m.www690aa.com)為大家整理了關(guān)于這方面的知識(shí),讓我們一起來(lái)看下吧!

本文目錄一覽:

1、pos機(jī)網(wǎng)站源碼

pos機(jī)網(wǎng)站源碼

各位朋友大家好!

今天給大家?guī)?lái)的是 6個(gè)PHP國(guó)內(nèi)各大網(wǎng)站登錄類庫(kù)!

國(guó)內(nèi)網(wǎng)站: 163登錄 奇虎360登錄 豆瓣登錄 QQ登錄 人人登錄 新浪微博登錄

國(guó)外網(wǎng)站: bitbucket dropbox facebook flickr google linkedin microsoft/MSN tumblr twitter yahoo

由于源碼過(guò)長(zhǎng),想要文件版源碼的可以私聊小編!

上源碼!

<?php if (!defined(\'BASEPATH\')) exit(\'No direct script access allowed\');

/**

* 用于使用第三方賬號(hào)登錄,并創(chuàng)建本地賬號(hào)。

* 添加部分代碼可以調(diào)用第三方網(wǎng)站接口。

* @author baiyuxiong

*

*/

class Oauth_lib

{

var $ci;

var $sitesConfig;

var $oauth_client;

function __construct()

{

$this->ci =& get_instance();

$this->ci->load->helper(\'bcore\');

$this->ci->load->config(\'oauth\');

$this->sitesConfig = $this->ci->config->item(\'sites_enabled\');

ll(\'oauth_client\');

$this->oauth_client = $this->ci->oauth_client;

}

function loadLoginIcons()

{

$data[\'sitesConfig\'] = $this->sitesConfig;

if(!empty($data[\'sitesConfig\']))

{

lv(\'lib/oauth/loginicon\',$data);

}

}

function login($site)

{

if($site && array_key_exists ($site, $this->sitesConfig))

{

$siteConfig = $this->sitesConfig[$site];

if(strlen($siteConfig[\'client_id\']) == 0 || strlen($siteConfig[\'client_secret\']) == 0)

{

lv(\'lib/oauth/configError\');

return;

}

$this->oauth_client->server = $site;

$this->oauth_client->redirect_uri = site_url(\'oauth/login/\'.$site);

$this->oauth_client->client_id = $siteConfig[\'client_id\'];

$this->oauth_client->client_secret = $siteConfig[\'client_secret\'];

$this->oauth_client->scope = $siteConfig[\'scope\'];

if(($success = $this->oauth_client->Initialize()))

{

if(($success = $this->oauth_client->Process()))

{

if(strlen($this->oauth_client->authorization_error))

{

$oauth_client->error = $this->oauth_client->authorization_error;

$success = false;

}

elseif(strlen($this->oauth_client->access_token))

{

$success = true;

}

}

$success = $this->oauth_client->Finalize($success);

}

if($success)

{

$this->snsUserInfo($site);

}

else

{

echo HtmlSpecialChars($this->ci->oauth_client->error);

}

}

}

/*

* 登錄成功后記錄賬號(hào)信息,

*/

function snsUserInfo($site)

{

//獲取第三方網(wǎng)站上的賬號(hào)信息用于創(chuàng)建本地賬號(hào),目前只支持國(guó)內(nèi)網(wǎng)站

switch ($site)

{

case \'163\':

$this->oauth_client->CallAPI(

\'https://api.t.163.com/users/show.json\',

\'GET\', array(), array(\'FailOnAccessError\'=>true), $user);

$data[\'oid\'] = $user->id;

$data[\'ousername\'] = $user->name;

$data[\'ogender\'] = $user->gender;

$data[\'orealName\'] = $user->realName;

$data[\'oemail\'] = $user->email;

$data[\'location\'] = $user->location;

break;

case \'360\':

$this->oauth_client->CallAPI(

\'https://openapi.360.cn/user/me.json\',

\'GET\', array(), array(\'FailOnAccessError\'=>true), $user);

$data[\'oid\'] = $user->id;

$data[\'ousername\'] = $user->name;

$data[\'ogender\'] = $user->sex;

$data[\'location\'] = $user->area;

$data[\'avatar\'] = $user->avatar;

break;

case \'douban\':

$this->oauth_client->CallAPI(

\'https://api.douban.com/v2/user/~me\',

\'GET\', array(), array(\'FailOnAccessError\'=>true), $user);

$data[\'oid\'] = $user->uid;

$data[\'ousername\'] = $user->name;

$data[\'avatar\'] = $user->avatar;

break;

case \'qq\':

$this->oauth_client->CallAPI(

\'https://graph.qq.com/oauth2.0/me\',

\'GET\', array(), array(\'FailOnAccessError\'=>true), $resStr);

// $temp = \'callback( {"client_id":"11111","openid":"A771DD90CF82FFDDD79D9D46DDF6B3F3"} );\';

if (strpos($resStr, "callback") !== false)

{

$lpos = strpos($resStr, "(");

$rpos = strrpos($resStr, ")");

$str = substr($resStr, $lpos + 1, $rpos - $lpos -1);

$tempObj = json_decode($str);

$this->oauth_client->GetAccessToken($accessToken);

$params = array(

\'format\' => \'json\',

\'oauth_consumer_key\' => $this->oauth_client->client_secret,

\'access_token\' => $accessToken[\'value\'],

\'openid\' => $tempObj->openid,

\'clientip\' => $this->input->ip_address(),

\'oauth_version\' => \'2.a\',

\'scope\' => \'all\'

);

$this->oauth_client->CallAPI(

\'http://open.t.qq.com/api/user/info\',

\'GET\', $params, array(\'FailOnAccessError\'=>true), $user);

$userData = $user->data;

//openid與用戶對(duì)應(yīng),唯一確定這個(gè)用戶

$data[\'oid\'] = $userData->openid;

$data[\'ousername\'] = $userData->name;

$data[\'ogender\'] = $userData->sex;

$data[\'orealName\'] = $userData->nick;

$data[\'oemail\'] = $userData->email;

$data[\'location\'] = $userData->location;

}

break;

case \'renren\':

$params = array(

"v" => "1.0",

\'method\'=>\'users.getInfo\',

"access_token"=>$client->access_token,

\'format\' => \'json\'

);

ksort($params);

reset($params);

foreach($params AS $k=>$v){

$arr[$k]=$v;

$str .= $k.\'=\'.$v;

}

$sig = md5($str.$client->client_secret);

unset($params[\'access_token\']);

$params[\'sig\'] = $sig;

$this->oauth_client->CallAPI(

\'http://api.renren.com/restserver.do\',

\'POST\', $params, array(\'FailOnAccessError\'=>true), $user);

$user = json_decode($user);

$userObj = $user[0];

$data[\'oid\'] = $userObj->uid;

$data[\'ousername\'] = $userObj->name;

$data[\'avatar\'] = $userObj->headurl;

$data[\'ogender\'] = $userObj->sex;

$data[\'orealName\'] = $userObj->name;

break;

case \'weibo\':

$this->oauth_client->CallAPI(

\'https://api.weibo.com/oauth2/get_token_info\',

\'POST\', array(), array(\'FailOnAccessError\'=>true), $user);

$this->oauth_client->CallAPI(

\'https://api.weibo.com/2/users/show.json\',

\'GET\', array(\'uid\' => $user->uid), array(\'FailOnAccessError\'=>true), $userDetail);

$data[\'oid\'] = $userDetail->id;

$data[\'ousername\'] = $userDetail->screen_name;

$data[\'avatar\'] = $userDetail->profile_image_url;

$data[\'ogender\'] = $userDetail->gender;

$data[\'location\'] = $userDetail->location;

$data[\'orealName\'] = $userDetail->name;

break;

case \'fetion\':

break;

default:break;

}

$data = array(

\'access_token\' => $this->oauth_client->access_token,

\'expires_in\' => $this->oauth_client->access_token_expiry,

\'refresh_token\' => $this->oauth_client->access_token,

\'scope\' => $this->oauth_client->scope

);

$data[\'site\'] = $site;

print_r($user);

echo HtmlSpecialChars($this->oauth_client->error);

//$this->load->model(\'oauth_model\');

//$this->ci->oauth_model->createUser($data);

}

}

?>

以上就是關(guān)于pos機(jī)網(wǎng)站源碼,6個(gè)PHP國(guó)內(nèi)各大網(wǎng)站登錄類庫(kù)的知識(shí),后面我們會(huì)繼續(xù)為大家整理關(guān)于pos機(jī)網(wǎng)站源碼的知識(shí),希望能夠幫助到大家!

轉(zhuǎn)發(fā)請(qǐng)帶上網(wǎng)址:http://m.www690aa.com/newstwo/105978.html

你可能會(huì)喜歡:

版權(quán)聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻(xiàn),該文觀點(diǎn)僅代表作者本人。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如發(fā)現(xiàn)本站有涉嫌抄襲侵權(quán)/違法違規(guī)的內(nèi)容, 請(qǐng)發(fā)送郵件至 babsan@163.com 舉報(bào),一經(jīng)查實(shí),本站將立刻刪除。