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/includes/website/ |
<?php if (defined('WEBSITE')) { global $_LANG; $_LANG['help']['APP_KEY'] = '微信开放平台中创建网站应用审核通过后获取的AppID'; $_LANG['help']['APP_SECRET'] = '微信开放平台中创建网站应用审核通过后获取的AppSecret'; $_LANG['APP_KEY'] = 'AppID'; $_LANG['APP_SECRET'] = 'AppSecret'; $i = isset($web) ? count($web) : 0; // 类名 $web[$i]['name'] = '微信扫码登录'; // 文件名,不包含后缀 $web[$i]['type'] = 'weixin'; $web[$i]['className'] = 'weixin'; // 作者信息 $web[$i]['author'] = 'ECSHOP教程网'; // 网址 $web[$i]['www'] = 'www.ecshopjcw.com'; // 作者qq $web[$i]['qq'] = '2479454955'; // 申请网址 $web[$i]['website'] = 'http://open.weixin.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 'oath2.class.php'; class website extends oath2 { var $token; var $error_msg; var $parameter = array(); function __construct(){ $this->website(); } function website() { $state = md5(time()+rand(0,9999)); $_SESSION['weixin_state'] = $state; $this->authorizeURL = 'https://open.weixin.qq.com/connect/qrconnect'; $this->app_key = APP_KEY; $this->app_secret = APP_SECRET; $this->parameter = array( 'response_type' => 'code', 'scope' => 'snsapi_login', 'state' => $state, ); } function login($redirect_uri='') { $url = $this->authorizeURL.'?'; $url .= 'appid='.$this->app_key; if(!empty($redirect_uri)) { $this->parameter['redirect_uri'] = $redirect_uri; } $url .= '&'.http_build_query($this->parameter); return $url; } function getAccessToken() { $code = empty($_REQUEST['code'])?'':$_REQUEST['code']; $url = sprintf('https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code',$this->app_key,$this->app_secret,$code); $result = $this->http($url); $result_arr = json_decode($result,true); $token = $result_arr['access_token']; $refresh = $result_arr['refresh_token']; $openid = $result_arr['openid']; $_SESSION['openid'] = $openid; return $token; } function setAccessToken($token) { $this->token = $token; return true; } function getMessage() { $url = sprintf('https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s',$this->token,$_SESSION['openid']); $result = $this->http($url); $result_arr = json_decode($result,true); $ret = array(); $ret['name'] = $result_arr['nickname']; $ret['sex'] = $result_arr['sex']; $ret['user_id'] = $result_arr['openid']; $ret['img'] = $result_arr['headimgurl']; return $ret; } function get_error() { return '未知错误'; } } }