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/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/mobile/callback.php

<?php

header("Content-type:text/html;charset=utf-8");

define('IN_ECTOUCH', true);

require(dirname(AEDECBF) . '/include/init.php');

require(dirname(AEDECBF) . '/include/modules/integrates/saetv2.ex.class.php');

require_once(ROOT_PATH . 'lang/' . $_CFG['lang'] . '/user.php');

$o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);

if (isset($_REQUEST['code'])) {

    $keys                 = array();

    $keys['code']         = $_REQUEST['code'];

    $keys['redirect_uri'] = WB_CALLBACK_URL;

    try {

        $token = $o->getAccessToken('code', $keys);

    }

    catch (OAuthException $e) {

    }

}

if ($token) {

    $_SESSION['token'] = $token;

    setcookie('weibojs_' . $o->client_id, http_build_query($token));

    $c            = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);

    $ms           = $c->home_timeline();

    $uid_get      = $c->get_uid();

    $uid          = $uid_get['uid'];

    $user_message = $c->show_user_by_id($uid);

    if (check_thrid_user_exists($uid)) {

        $sql                   = "SELECT * FROM " . $GLOBALS['ecs']->table('users') . " WHERE sina_weibo_id = " . $uid;

        $user_info             = $GLOBALS['db']->getRow($sql);

        $_SESSION['user_id']   = $user_info['user_id'];

        $_SESSION['user_name'] = $user_info['user_name'];

        $_SESSION['email']     = $user_info['email'];

        ecs_header("Location: user.php");

        exit;

    } else {

        $smarty->assign('uid', $uid);

        $smarty->assign('user', $user_message);

        $smarty->display('call_back.dwt');

    }

} else {

    echo '授权失败';

}

function check_thrid_user_exists($uid)

{

    $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . " WHERE sina_weibo_id = " . $uid;

    return $GLOBALS['db']->getOne($sql);

}

?>