Server : Apache
System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/saimikebio.com/mobile/include/website/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/mobile/include/website/qq.php
<?php 



if (defined('WEBSITE') || defined('GETINFO'))

{

	global $_LANG;

	$_LANG['help']['APP_KEY'] = '在QQ互联中创建网站应用后可以查看 APP ID';
	$_LANG['help']['APP_SECRET'] = '在QQ互联中创建网站应用后可以查看 APP Key';
	
	$_LANG['APP_KEY'] = 'APP ID';
	$_LANG['APP_SECRET'] = 'APP Key';
	

	$i = isset($web) ? count($web) : 0;

	// 类名

	$web[$i]['name'] = 'QQ快捷登录';

	// 文件名,不包含后缀

	$web[$i]['type'] = 'qq';

	

	$web[$i]['className'] = 'qq';

	

	// 作者信息
	$web[$i]['author'] = 'ECSHOP教程网';
	
	// 网址
	$web[$i]['www'] = '<a href="http://www.ecshopjcw.com" target="_blank">www.ecshopjcw.com</a>';
	
	// 作者qq
	$web[$i]['qq'] = '2479454955';
	

	// 申请网址

	$web[$i]['website'] = 'http://connect.qq.com';

	

	// 版本号
	$web[$i]['version'] = '3.6';
	
	// 更新日期
	$web[$i]['date']  = '2018-03-12';
	

	// 配置信息

	$web[$i]['config'] = array(

		array('type'=>'text' , 'name'=>'APP_KEY', 'value'=>''),

		array('type'=>'text' , 'name' => 'APP_SECRET' , 'value' => ''),

	);

}





if (!defined('WEBSITE'))

{

	include_once(dirname(__FILE__).'/oath2.class.php');

	class website extends oath2

	{

		// 类赋值

		

		function website()

		{

			

			$this->app_key = APP_KEY;

			$this->app_secret = APP_SECRET;

			

			$this->scope = 'get_user_info';

			$this->authorizeURL = 'https://graph.qq.com/oauth2.0/authorize';

			$this->post_login = array();

			$this->meth = 'GET';

			$this->tokenURL = 'https://graph.qq.com/oauth2.0/token';

			$this->post_token = array();

			$this->graphURL = 'https://graph.qq.com/oauth2.0/me';

			

			$this->userURL = 'https://graph.qq.com/user/get_user_info';

			$this->post_msg = array(

				'client_id' => '',

				'client_secret'=>'',

				'oauth_consumer_key' => $this->app_key,

				'format'=>'json'

			);

		}

		

		function getGraph( $result )

		{

			if(!$this->is_error($result , false))

			{

				return false;

			}

			$params  = $token = array();

			parse_str($result, $params);

			$token = $params;

			

			$graph_url = $this->graphURL."?access_token=" . $params['access_token'];

			$user = $this->http($graph_url , 'GET');

			$user = $this->is_error($user);

			$token['openid'] = $user['openid'];

			unset($token['expires_in']);

			return $token;

		}

		

		function message($info)

		{

			if(!$info || !is_array($info))

			{

				return false;

			}

			

			$info['name'] = $info['nickname'];

			$info['sex'] = $info['gender'] == '男' ? '1' : '0';

			$info['user_id'] = $this->token['openid'];

			$info['img'] = $info['figureurl_2'];

			$info['rank_id'] = RANK_ID;

			return $info;

		}

		function is_error($response , $is_chuli = true)

		{

			if (strrpos($response, "callback") !== false)

			{

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

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

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

				$ret = json_decode($response , true);

				

				if($ret['ret'] || $ret['error'])

				{

					$this->add_error((isset($ret['ret']) ? $ret['ret'] : $ret['error']) , isset($ret['error_description']) ? $ret['error_description'] : '' , isset($ret['msg']) ? $ret['msg'] : '');

					return false;

				}

			}

			

			if($is_chuli)

			{

				$ret = json_decode($response , true);

				if($ret['ret'] || $ret['error'])

				{

					print_r($ret);

					$this->add_error((isset($ret['ret']) ? $ret['ret'] : $ret['error']) , isset($ret['error_description']) ? $ret['error_description'] : '' , isset($ret['msg']) ? $ret['msg'] : '');

					return false;

				}

				return $ret ? $ret : $response;

			}

			else

			{

				return true;

			}

		}

	}

}

?>