public function oauth() {
			pc_base::load_plugin_class('weibooauth','',0);
			$setting = getcache('weibo_var','plugins');			
			if(!isset($_REQUEST['oauth_verifier']) || $_REQUEST['oauth_verifier'] == '') {
				if($this->auth_db->get_one(array('source'=>'sina'))) {
					$txt = '授权成功,<a href="?m=zl_admin&c=plugin&a=config&pluginid='.$this->pluginid.'&module=removeauth&pc_hash='.$_SESSION['pc_hash'].'">解除绑定</a>';
				} else {
					$o = new WeiboOAuth( $setting['wb_akey'] , $setting['wb_skey']);
					$keys = $o->getRequestToken();
					print_r($keys);
					$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , get_url());
					$_SESSION['keys'] = $keys;
					$txt = '<a href="'.$aurl.'">点击进行授权</a>';
				}
				
			} else {
				$o = new WeiboOAuth( $setting['wb_akey'] , $setting['wb_skey'] , $_SESSION['keys']['oauth_token'] , $_SESSION['keys']['oauth_token_secret']  );
				$last_key = $o->getAccessToken(  $_REQUEST['oauth_verifier'] ) ;				
				$c = new WeiboClient( $setting['wb_akey'] , $setting['wb_skey'] , $last_key['oauth_token'] , $last_key['oauth_token_secret']  );
				$ms  = $c->home_timeline(); // done
				$me = $c->verify_credentials();	
				$this->auth_db->insert(array('uid'=>$me['id'],'token'=>$last_key['oauth_token'],'tsecret'=>$last_key['oauth_token_secret'],'source'=>'sina'));
				$txt = '授权成功,'.$me['name'].'<a href="?m=zl_admin&c=plugin&a=config&pluginid='.$this->pluginid.'&module=removeauth&pc_hash='.$_SESSION['pc_hash'].'">解除绑定</a>';
			}
			include $this->op->plugin_tpl('oauth',PLUGIN_ID);
		}
function tweet_delete()
{
    include_once 'login.php';
    include_once 'sinaoauth.inc.php';
    $id = get_current_user_id();
    $args = func_get_args();
    $key = $args[2];
    if (!$key) {
        die('Invalid Argument!');
    }
    connect_db();
    $view = "SELECT tweets.* FROM tweets, (SELECT user_id, user_site_id, site_id FROM accountbindings) AS ac WHERE tweets.user_site_id = ac.user_site_id AND ac.user_id='{$id}' AND ac.site_id = tweets.site_id AND tweets.tweet_id='{$key}' AND tweets.deleted='0'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row or user_is_admin()) {
        if ($row) {
            $c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
            $msg = $c->destroy($row['tweet_site_id']);
        }
        $view = "UPDATE tweets SET deleted='1' WHERE tweet_id='{$key}'";
        $list = mysql_query($view) or die("Delete error!");
    } else {
        print $key;
        die(": Non-exist Error!");
    }
}
function sina_get_credentials()
{
    include_once 'sinaoauth.inc.php';
    $c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
    $me = $c->verify_credentials();
    return $me;
}
Example #4
0
 function oauth_callback()
 {
     session();
     if ($_SESSION['oauth_serv'] == 'sina') {
         $conf = $this->config['oauth']['weibo'];
         $oauth = new WeiboOAuth($conf['appid'], $conf['skey'], $_SESSION['oauth_keys']['oauth_token'], $_SESSION['oauth_keys']['oauth_token_secret']);
         $_SESSION['last_key'] = $oauth->getAccessToken($_REQUEST['oauth_verifier']);
         $client = new WeiboClient($conf['appid'], $conf['skey'], $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
         $userinfo = $client->verify_credentials();
         if (!isset($userinfo['id'])) {
             var_dump($conf, $_SESSION);
             return "请求错误:" . var_export($userinfo, true);
         }
         $model = createModel('UserInfo');
         $username = '******' . $userinfo['id'];
         $u = $model->get($username, 'username')->get();
         //不存在,则插入数据库
         if (empty($u)) {
             $u['username'] = $username;
             $u['nickname'] = $userinfo['name'];
             $u['avatar'] = $userinfo['profile_image_url'];
             list($u['province'], $u['city']) = explode(' ', $userinfo['location']);
             //插入到表中
             $u['id'] = $model->put($u);
         }
         //写入SESSION
         $_SESSION['isLogin'] = 1;
         $_SESSION['user_id'] = $u['id'];
         $_SESSION['user'] = $u;
         $this->setLoginStat();
         $this->swoole->http->edirect(WEBROOT . "/person/index/");
     } elseif ($_SESSION['oauth_serv'] == 'qq') {
         $conf = $this->swoole->config['oauth']['qq'];
         $oauth = new QQOAuth($conf['APP_ID'], $conf['APP_KEY']);
         $oauth->getAccessToken($_GET['oauth_token'], $_SESSION['oauth_keys']['oauth_token_secret'], $_GET['oauth_vericode']);
         $username = $oauth->access_token['openid'];
         $model = createModel('UserInfo');
         $u = $model->get($username, 'username')->get();
         //不存在,则插入数据库
         if (empty($u)) {
             $user = $oauth->api_get('user/get_user_info');
             if (empty($user)) {
                 return Swoole\JS::js_back("请求错误");
             }
             $u['username'] = $username;
             $u['nickname'] = $user['nickname'];
             $u['avatar'] = $user['figureurl_2'];
             //插入到表中
             $u['id'] = $model->put($u);
         }
         //写入SESSION
         $_SESSION['isLogin'] = 1;
         $_SESSION['user_id'] = $u['id'];
         $_SESSION['user'] = $u;
         $this->setLoginStat();
         $this->swoole->http->redirect(WEBROOT . "/person/index/");
     }
 }
Example #5
0
 function getUserInfo()
 {
     $c = new WeiboClient(ISession::get('apiKey'), ISession::get('apiSecret'), $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
     $ms = $c->home_timeline();
     $me = $c->verify_credentials();
     $userInfo = array();
     $userInfo['id'] = isset($me['id']) ? $me['id'] : '';
     $userInfo['name'] = isset($me['name']) ? $me['name'] : '';
     return $userInfo;
 }
Example #6
0
 /**
  * 
  * 网站的首页
  */
 public function index()
 {
     if ($this->weixiao->is_login()) {
         $data = array('user' => $this->weixiao->get_cur_user());
         //获得所有绑定的数据
         $bindings = $this->usermanager->get_binding_by_uid($this->weixiao->get_cur_user()->id);
         foreach ($bindings as $binding) {
             switch ($binding->sns_website) {
                 case UserManager::sns_website_sina:
                     $data['binding_sina'] = $binding;
                     //读sina的数据
                     $c = new WeiboClient(WB_AKEY, WB_SKEY, $binding->sns_oauth_token, $binding->sns_oauth_token_secret);
                     $me = $c->verify_credentials();
                     $data['sina'] = $me;
                     $friends = $c->friends_ids(null, 5000, $binding->sns_uid);
                     $data['friends_sina'] = $friends['ids'];
                     break;
                 case UserManager::sns_website_qq:
                     $data['binding_qq'] = $binding;
                     //读qq的数据
                     $qq = new QqConnect();
                     $me = $qq->get_user_info(QQ_APPID, QQ_APPKEY, $binding->sns_oauth_token, $binding->sns_oauth_token_secret, $binding->sns_uid);
                     $data['qq'] = $me;
                     break;
                 case UserManager::sns_website_tqq:
                     $data['binding_tqq'] = $binding;
                     //读t.qq的数据
                     $c = $this->snsfactory->getMBApiClient(MB_AKEY, MB_SKEY, $binding->sns_oauth_token, $binding->sns_oauth_token_secret);
                     //						$c = new MBApiClient( MB_AKEY , MB_SKEY , $binding->sns_oauth_token , $binding->sns_oauth_token_secret);
                     $me = $c->getUserInfo();
                     $me = $me['data'];
                     $data['tqq'] = $me;
                     $friends = $c->getMyfans(array('num' => 30, 'start' => 0, 'type' => 1, 'n' => ''));
                     $data['friends_tqq'] = $friends['data']['info'];
                     break;
                 case UserManager::sns_website_renren:
                     $data['binding_renren'] = $binding;
                     //读renren的数据
                     $renren = new RenrenConnect();
                     $me = $renren->get_user_info(RENREN_APPKEY, RENREN_APPSECRET, $binding->sns_oauth_token, $binding->sns_uid);
                     $data['renren'] = $me[0];
                     $friends = $renren->get_friends(RENREN_APPKEY, RENREN_APPSECRET, $binding->sns_oauth_token);
                     $data['friends_renren'] = $friends;
                     break;
             }
         }
         $this->load->view('index_login', $data);
     } else {
         $this->load->view('index_not_login');
     }
     //$this->load->view('main_view',  array('users'=>$this->db->get('users')));
 }
Example #7
0
 private function status_bind($id, $text, $pic_id)
 {
     include_once ROOT_DIR . 'lib/user/user.class.php';
     $this->mUser = new user();
     $bind_info = $this->mUser->get_bind_info();
     //获取绑定信息
     include_once ROOT_PATH . 'lib/class/status.class.php';
     $status = new status();
     if (!$bind_info) {
         //do nothing!
     } else {
         //file_put_contents('d:/show.txt', '用户绑定了' , FILE_APPEND);
         $bind_info = $bind_info[0];
         if ($bind_info['state'] == 1 && $bind_info['last_key']) {
             //file_put_contents('d:/show.txt', '用户开启同步了' , FILE_APPEND);
             include_once ROOT_PATH . 'lib/class/weibooauth.class.php';
             $last_key = unserialize($bind_info['last_key']);
             $oauth = new WeiboClient(WB_AKEY, WB_SKEY, $last_key['oauth_token'], $last_key['oauth_token_secret']);
             //$oauth = new WeiboOAuth( WB_AKEY , WB_SKEY , 'e9b1d743a687550cec725e65fd204b6c' , '119934aabf1632d426533505c0f02e70' );
             //判断是否发送了图片
             if ($pic_id) {
                 //file_put_contents('d:/show.txt', '用户发送了图片' , FILE_APPEND);
                 //取出该图片的路径
                 //获取媒体信息
                 $pic_url = $status->getPicById($pic_id);
                 $url = $pic_url[0];
                 //$url = 'http://127.0.0.1/3.jpg';
                 $content = $oauth->upload($text, $url);
             } else {
                 $content = $text;
                 $pattern = "/#([\\x{4e00}-\\x{9fa5}0-9A-Za-z_-\\s‘’“”'\"!\\?\$%&:;!?¥×\\*\\<\\>》《]+)[\\s#]/iu";
                 if (preg_match_all($pattern, $content, $topic)) {
                     include_once ROOT_PATH . 'lib/class/shorturl.class.php';
                     $shorturl = new shorturl();
                     $link = '';
                     $tmp_url = '';
                     $topic_name = array();
                     foreach ($topic[1] as $key => $value) {
                         $tmp_url = SNS_MBLOG . 'k.php?q=' . urlencode($value);
                         $short_url = $shorturl->shorturl($tmp_url);
                         $link .= $short_url;
                     }
                     $content = $content . $link;
                 }
                 //			    	$content = $oauth->post( $oauth->updateURL() , array( 'status' =>  $content) );
                 $content = $oauth->update($content);
                 //同步发送
             }
             $syn_id = $content['id'];
             //返回点滴的ID
             $type = $bind_info['type'];
             //绑定类型
             /**
              * 记录同步发送的点滴id
              */
             $status->syn_relation($id, $syn_id, $type);
         }
     }
 }
Example #8
0
 function callback()
 {
     //$o = new WeiboOAuth( WB_AKEY , WB_SKEY , $_SESSION['oauth_keys']['oauth_token'] , $_SESSION['oauth_keys']['oauth_token_secret']  );
     $o = new WeiboOAuth(WB_AKEY, WB_SKEY, $this->session->userdata('oauth_token'), $this->session->userdata('oauth_token_secret'));
     //这个key就是这个用户的令牌,很NB,要好好保存
     //var_dump($_REQUEST);
     $last_key = $o->getAccessToken($_REQUEST['oauth_verifier']);
     $sns_oauth_token = $last_key['oauth_token'];
     $sns_oauth_token_secret = $last_key['oauth_token_secret'];
     $sns_uid = $last_key['user_id'];
     //var_dump($last_key);
     if (empty($sns_uid)) {
         throw new Exception('oauth fail, havnt got getAccessToken()');
     }
     //获取用户信息
     $c = new WeiboClient(WB_AKEY, WB_SKEY, $sns_oauth_token, $sns_oauth_token_secret);
     $me = $c->verify_credentials();
     //把资料准备好之后,剩下的就交给父类里的模版方法了!
     parent::post_login(UserManager::sns_website_sina, $sns_uid, $sns_oauth_token, $sns_oauth_token_secret, $me['name']);
     /*
     $binding = $this->usermanager->get_binding_by_sns_uid(UserManager::sns_website_sina, $sns_uid);
     if(empty($binding))
     {
     	//初次登录用户
     	//创建用户(同时创建sns_binding)
     	$user = $this->usermanager->create_user(UserManager::sns_website_sina, $sns_uid, $sns_oauth_token, $sns_oauth_token_secret, $me['name']);
     	//把新创建的用户放到ci->weixiao里
     	$this->weixiao->set_user_token($user->user_token);
     	$cur_user = $this->weixiao->get_cur_user();
     	if(empty($cur_user)) throw new Exception("something strange happens, cant get user just login.");
     	$data = array('user'=>$cur_user);
     	$this->load->view('binding/first_binding', $data);
     }
     else {
     	//老用户
     	//TODO 初次登录进入binding/first_binding,否则关闭弹出窗口,刷新父页面
     	$user = $this->usermanager->get_by_id($binding->user_id);
     	//把新创建的用户放到ci->weixiao里
     	$this->weixiao->set_user_token($user->user_token);
     	$cur_user = $this->weixiao->get_cur_user();
     	if(empty($cur_user)) throw new Exception("something strange happens, cant get user just login.");
     	$data = array('user'=>$cur_user);
     	$this->load->view('binding/not_first_binding', $data);
     }
     */
 }
function apply_sent_add()
{
    include_once 'login.inc.php';
    $id = get_current_user_id();
    $args = func_get_args();
    $key = $args[2];
    if (!$key) {
        die('Invalid Argument!');
    }
    connect_db();
    $view = "SELECT * FROM applications WHERE user_id='{$id}' AND tweet_id='{$key}' AND deleted='0'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row) {
        die('Dulplicate Error');
    }
    $view = "INSERT INTO applications(resume_id, tweet_id, user_id, apply_time) VALUES ('{$id}', '{$key}', '{$id}', '" . date('Y-m-d H:i:s') . "')";
    $list = mysql_query($view) or die("Insert error!");
    $content = get_post('text');
    $view = "SELECT tweet_site_id FROM tweets WHERE tweet_id='{$key}'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row) {
        $tweet_site_id = $row[0];
        include_once "sinaoauth.inc.php";
        $c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
        $content = $content . ' 我在歪伯乐的简历:http://www.ybole.com/resume/show/' . $id;
        $msg = $c->send_comment($tweet_site_id, $content);
        if ($msg === false || $msg === null) {
            echo "Error occured";
            return false;
        }
        if (isset($msg['error_code']) && isset($msg['error'])) {
            echo 'Error_code: ' . $msg['error_code'] . ';  Error: ' . $msg['error'];
            return false;
        }
    }
}
Example #10
0
<?php

@header('Content-Type:text/html;charset=utf-8');
include_once 'config.php';
include_once 'lib/oauth.php';
include_once 'lib/sina_api.php';
include_once 'lib/qq_api.php';
$sina_c = new WeiboClient(SINA_AKEY, SINA_SKEY, SINA_TOKEN, SINA_SECRET);
$qq_c = new MBApiClient(QQ_AKEY, QQ_SKEY, QQ_TOKEN, QQ_SECRET);
$mmc = memcache_init();
/* if(!isset(memcache_get($mmc,"sina_last_update"))){
		memcache_set($mmc,"sina_last_update","0");
	}
	
	if(!isset(memcache_get($mmc,"qq_last_update"))){
		memcache_set($mmc,"qq_last_update","0");
	} */
$sina_last_update = memcache_get($mmc, "sina_last_update");
$qq_last_update = memcache_get($mmc, "qq_last_update");
//同步腾讯微博到新浪微博
if (TOSINA == 0) {
    try {
        $qq_tweets = $qq_c->getMyTweet();
    } catch (Exception $e) {
        exit;
    }
    $isQqTrue = true;
    switch ($isQqTrue) {
        case $qq_tweets['data']['info'][0]['timestamp'] <= $qq_last_update:
            $isQqTrue = false;
            break;
Example #11
0
<?php

if ($_POST['submit'] == '上传') {
    @session_start();
    include_once 'txwboauth.php';
    $pic = file_get_contents($_FILES['element_1']['tmp_name']);
    $c = new WeiboClient('801096156', '750c8eaab78db1e46e2d26dab726fa4c', 'c782b7f7f41a41849f91bb05891b68a9', '9d3ebc512b1f5665c04f148261e896a5');
    $ms = $c->t_add_pic('图片分享', $pic);
    $kk = $c->t_show($ms['data']['id']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>图床</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>

</head>
<body id="main_body" >
	
	<img id="top" src="top.png" alt="">
	<div id="form_container">
	
		<h1><a>图床</a></h1>
		<form id="form_350237" class="appnitro" enctype="multipart/form-data" method="POST" action="#">
					<div class="form_description">
			<h2>图床</h2>
			<p>无流量限制!速度飞快!你值得拥有,只能上传图片,其他数据请勿尝试,违反国家规定也不要上传!</p>
		<?
Example #12
0
<?php

ini_set('display_errors', true);
require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
require_once 'config.php';
require_once 'txwboauth.php';
require_once 'class.krumo.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
$ms = $c->home_timeline();
// done
$me = $c->user_info();
var_dump($me);
if ($_POST) {
    $u = array();
    $u['username'] = strval($_POST['username']);
    $u['password'] = strval($_POST['password']);
    $u['email'] = strval($_POST['email']);
    $u['city_id'] = isset($_POST['city_id']) ? abs(intval($_POST['city_id'])) : abs(intval($city['id']));
    $u['mobile'] = strval($_POST['mobile']);
    if ($_POST['subscribe']) {
        ZSubscribe::Create($u['email'], abs(intval($u['city_id'])));
    }
    if (!Utility::ValidEmail($u['email'], true)) {
        Session::Set('error', 'Email地址为无效地址');
        redirect(WEB_ROOT . 'signup.php');
    }
    if ($_POST['password']) {
        if (option_yes('emailverify')) {
            $u['enable'] = 'N';
        }
        if ($user_id = ZUser::Create($u)) {
Example #13
0
<?php

include_once 'config.php';
include_once 'txwboauth.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
$ms = $c->pub_abc($_SESSION['last_key']['openid']);
$id = $_SESSION['last_key']['openid'];
$name = $ms['nickname'];
//echo $name;
if (!$id) {
    need_login();
}
$type = "qzone";
$sns = "qzone:" . $id;
$exist_user = Table::Fetch('user', $sns, 'sns');
if ($exist_user) {
    Session::Set('user_id', $exist_user['id']);
    Utility::Redirect(get_loginpage(WEB_ROOT . '/index.php'));
}
$prompt_name = $ms['nickname'];
$exist_user = Table::Fetch('user', $prompt_name, 'username');
while (!empty($exist_user)) {
    $prompt_name = $ms['nickname'] . '_' . rand(100, 999);
    $exist_user = Table::Fetch('user', $prompt_name, 'username');
}
$new_user = array('username' => $prompt_name, 'password' => rand(10000000, 99999999), 'sns' => $sns);
if ($user_id = ZUser::Create($new_user, true)) {
    Session::Set('user_id', $user_id);
    Utility::Redirect(get_loginpage(WEB_ROOT . '/index.php'));
}
Utility::Redirect(WEB_ROOT . '/thirdpart/qzone/index.php');
Example #14
0
<?php

@header('Content-Type:text/html;charset=utf-8');
session_start();
require_once dirname(dirname(__FILE__)) . '/thirdpart/qq/config.php';
require_once dirname(dirname(__FILE__)) . '/thirdpart/qq/txwboauth.php';
require_once dirname(dirname(__FILE__)) . '/app.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
$ms = $c->user_info();
$ms = $ms['data'];
if (!$ms['name']) {
    need_login();
}
$name = $ms['nick'];
$type = "qq";
$sns = "qq:{$ms['name']}";
$exist_user = Table::Fetch('user', $sns, 'sns');
if ($exist_user) {
    Session::Set('user_id', $exist_user['id']);
    Utility::Redirect(get_loginpage(WEB_ROOT . '/index.php'));
}
if ($_POST) {
    if ($_POST['sns_action'] == 'bind') {
        $email = $_POST['email'];
        if (!Utility::ValidEmail($email, true)) {
            Session::Set('error', 'Email地址为无效地址');
            redirect(WEB_ROOT . '/account/qq_bind.php');
        }
        if ($_POST['password'] == "") {
            Session::Set('error', '请输入正确密码');
            redirect(WEB_ROOT . '/account/qq_bind.php');
Example #15
0
File: index.php Project: hxzyzz/ddc
	public function public_sina_login() {
		define('WB_AKEY', pc_base::load_config('system', 'sina_akey'));
		define('WB_SKEY', pc_base::load_config('system', 'sina_skey'));
		pc_base::load_app_class('weibooauth', '' ,0);
		$this->_session_start();
					
		if(isset($_GET['callback']) && trim($_GET['callback'])) {
			$o = new WeiboOAuth(WB_AKEY, WB_SKEY, $_SESSION['keys']['oauth_token'], $_SESSION['keys']['oauth_token_secret']);
			$_SESSION['last_key'] = $o->getAccessToken($_REQUEST['oauth_verifier']);
			$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
			//获取用户信息
			$me = $c->verify_credentials();
			if(CHARSET != 'utf-8') {
				$me['name'] = iconv('utf-8', CHARSET, $me['name']);
				$me['location'] = iconv('utf-8', CHARSET, $me['location']);
				$me['description'] = iconv('utf-8', CHARSET, $me['description']);
				$me['screen_name'] = iconv('utf-8', CHARSET, $me['screen_name']);
			}
			if(!empty($me['id'])) {
				//检查connect会员是否绑定,已绑定直接登录,未绑定提示注册/绑定页面
				$where = array('connectid'=>$me['id'], 'from'=>'sina');
				$r = $this->db->get_one($where);
				
				//connect用户已经绑定本站用户
				if(!empty($r)) {
					//读取本站用户信息,执行登录操作
					$password = $r['password'];
					$this->_init_phpsso();
					$synloginstr = $this->client->ps_member_synlogin($r['phpssouid']);
					$userid = $r['userid'];
					$groupid = $r['groupid'];
					$username = $r['username'];
					$nickname = empty($r['nickname']) ? $username : $r['nickname'];
					$this->db->update(array('lastip'=>ip(), 'lastdate'=>SYS_TIME, 'nickname'=>$me['name']), array('userid'=>$userid));
					
					if(!$cookietime) $get_cookietime = param::get_cookie('cookietime');
					$_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
					$cookietime = $_cookietime ? TIME + $_cookietime : 0;
					
					$phpcms_auth_key = md5(pc_base::load_config('system', 'auth_key').$this->http_user_agent);
					$phpcms_auth = sys_auth($userid."\t".$password, 'ENCODE', $phpcms_auth_key);
					
					param::set_cookie('auth', $phpcms_auth, $cookietime);
					param::set_cookie('_userid', $userid, $cookietime);
					param::set_cookie('_username', $username, $cookietime);
					param::set_cookie('_groupid', $groupid, $cookietime);
					param::set_cookie('cookietime', $_cookietime, $cookietime);
					param::set_cookie('_nickname', $nickname, $cookietime);
					$forward = isset($_GET['forward']) && !empty($_GET['forward']) ? $_GET['forward'] : 'index.php?m=member&c=index';
					showmessage(L('login_success').$synloginstr, $forward);
					
				} else {				
					//弹出绑定注册页面
					$_SESSION['connectid'] = $me['id'];
					$_SESSION['from'] = 'sina';
					$connect_username = $me['name'];
					include template('member', 'connect');
				}
			} else {
				showmessage(L('login_failure'), 'index.php?m=member&c=index&a=login');
			}
		} else {
			$o = new WeiboOAuth(WB_AKEY, WB_SKEY);
			$keys = $o->getRequestToken();
			$aurl = $o->getAuthorizeURL($keys['oauth_token'] ,false , APP_PATH.'index.php?m=member&c=index&a=public_sina_login&callback=1');
			$_SESSION['keys'] = $keys;
			include template('member', 'connect_sina');
		}
	}
Example #16
0
 public function getFollowers($uid)
 {
     $list = array();
     $uid = (int) $uid;
     if (!$uid) {
         return $list;
     }
     $user = FS('User')->getUserBindByType($uid, $this->type);
     //$client = new WeiboClient($this->config['app_key'],$this->config['app_secret'],$user['oauth_token'],$user['oauth_token_secret']);
     //$msg = $client->followers(0,20,$user['keyid']);
     $client = new WeiboClient($this->config['app_key'], $this->config['app_secret'], '2d2b2056e1a40f92d5c283a34298b1ff', '8e8da9e53e4c85a2625dab12272e9277');
     $msg = $client->followers(0, 20, 1085149703);
     print_r($msg);
     exit;
 }
Example #17
0
<?php

header('Content-Type:text/html;charset=utf-8');
session_start();
include_once 'oauth.php';
// include_once( 'config'.rand(1,3).'.php' );
include_once 'config.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
// print_r($_FILES["my_uploaded_file"]);
if (isset($_FILES['my_uploaded_file']['tmp_name'])) {
    $msg1 = $c->upload(date("l dS \\of F Y h:i:s A"), $_FILES['my_uploaded_file']['tmp_name']);
    $msg2 = $c->user_timeline(1, 1);
    if (is_array($msg2)) {
        foreach ($msg2 as $item2) {
            echo $item2['original_pic'];
        }
    }
}
?>



Example #18
0
<?php

session_start();
include_once 'config.php';
include_once 'weibooauth.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
header('Content-Type: text/html; charset=utf-8');
?>
<a href="weibolist.php">返回接口测试</a>

<h2>照片接口测试</h2>


<h2>广播照片上传</h2>
<form action="photo_test.php" method="post" enctype="multipart/form-data">
<input type="file" name="pic" style="width:300px" value="图片url" />
&nbsp;<input type="submit" />
</form>
<?php 
if ($_FILES) {
    $rr = $c->upload('', $_FILES['pic']['tmp_name']);
    print_r($rr);
}
Example #19
0
    $last_key = $o->getAccessToken($_REQUEST['oauth_verifier']);
    $_SESSION['last_key'] = $last_key;
    $_SESSION['sina_token'] = $_SESSION['last_key']['oauth_token'];
    $_SESSION['sina_token_secret'] = $_SESSION['last_key']['oauth_token_secret'];
    $_SESSION['sina_user_id'] = $_SESSION['last_key']['user_id'];
    $c = new WeiboClient($new_app_key, $new_app_secret, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
    //$ms  = $c->home_timeline(); // done
    $me = $c->verify_credentials();
} else {
    $o = new WeiboOAuth(WB_AKEY, WB_SKEY, $_SESSION['keys']['oauth_token'], $_SESSION['keys']['oauth_token_secret']);
    $last_key = $o->getAccessToken($_REQUEST['oauth_verifier']);
    $_SESSION['last_key'] = $last_key;
    $_SESSION['sina_token'] = $_SESSION['last_key']['oauth_token'];
    $_SESSION['sina_token_secret'] = $_SESSION['last_key']['oauth_token_secret'];
    $_SESSION['sina_user_id'] = $_SESSION['last_key']['user_id'];
    $c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
    //$ms  = $c->home_timeline(); // done
    $me = $c->verify_credentials();
}
if ($me) {
    //exit(print_r($me));
    $_SESSION['sina_nickname'] = $me['screen_name'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile|android)/i";
    if (preg_match($uachar, $ua)) {
        $go_url = "/index.php?app=third_login&act=sina_callback&sina_token=" . $_SESSION['sina_token'] . "&sina_token_secret=" . $_SESSION['sina_token_secret'] . "&sina_user_id=" . $_SESSION['sina_user_id'] . "&sina_nickname=" . urlencode($_SESSION['sina_nickname']) . "&method=m";
    } else {
        $go_url = "/index.php?app=third_login&act=sina_callback&sina_token=" . $_SESSION['sina_token'] . "&sina_token_secret=" . $_SESSION['sina_token_secret'] . "&sina_user_id=" . $_SESSION['sina_user_id'] . "&sina_nickname=" . urlencode($_SESSION['sina_nickname']);
    }
    header("location:{$go_url}");
    exit;
Example #20
0
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	</head>
<body>

<?php 
include_once 'config.php';
include_once 'weibooauth.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, LAST_OAUTH_TOKEN, LAST_OAUTH_TOKEN_SECRET);
$uinfo = $c->show_user('2253016840');
echo print_r($uinfo, true);
echo "\n<br/><br/>\n";
$o = new WeiboOAuth(WB_AKEY, WB_SKEY, LAST_OAUTH_TOKEN, LAST_OAUTH_TOKEN_SECRET);
$content = $o->get(sprintf("http://api.t.sina.com.cn/users/hot.json"), array('source' => WB_AKEY));
//var_dump($content);
echo "<b>The following is the hottest ones:</b>" . "<br/>";
foreach ($content as $c) {
    echo $c['name'];
    $img_url = $c['profile_image_url'];
    echo '<img src="' . $img_url . '" border=0/>';
    $img_url = str_replace("/50/", "/180/", $img_url);
    echo '<img src="' . $img_url . '" border=0/>';
    echo "<br/>";
}
?>

</body>
</html>
Example #21
0
<?php

session_start();
include_once 'config.php';
include_once 'weibooauth.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
//获得用户信息
$userid = $_SESSION['last_key']['user_id'];
$arr = $c->show_user($userid);
$username = $arr['name'];
//用户名
$usertou = $arr['profile_image_url'];
//用户头像地址
//=============
$im = imagecreatefromjpeg("by.jpg");
$tou = imagecreatefromjpeg($usertou);
$color = imagecolorallocate($im, 0, 0, 255);
imagettftext($im, 12, 0, 270, 122, $color, "simhei.ttf", $username);
imagettftext($im, 10, 0, 90, 220, $color, "simhei.ttf", "NO." . time());
imagecopy($im, $tou, 121, 131, 0, 0, 50, 50);
imagejpeg($im, $userid . ".jpg");
//=============
$t = "999999999999 http://www.php100.com";
$p = "http://localhost/sina12/" . $userid . ".jpg";
if (!empty($_POST['sub'])) {
    //$t 文字内容
    //$p 我们上传的图片路径
    $c->upload($t, $p);
}
?>
<img src="<?php 
Example #22
0
 /**
  * 新浪微博登录
  */
 public function public_sina_login()
 {
     $config = C('sns', 'qq');
     OpenSDK_Sina_Weibo2::init($config['app_key'], $config['app_secret']);
     Loader::session();
     if (isset($_GET['callback']) && trim($_GET['callback'])) {
         $o = new WeiboOAuth(WB_AKEY, WB_SKEY, $_SESSION['keys']['oauth_token'], $_SESSION['keys']['oauth_token_secret']);
         $access_token = $o->getAccessToken($_REQUEST['oauth_verifier']);
         $c = new WeiboClient(WB_AKEY, WB_SKEY, $access_token['oauth_token'], $access_token['oauth_token_secret']);
         // 获取用户信息
         $me = $c->verify_credentials();
         if (CHARSET != 'utf-8') {
             $me['name'] = iconv('utf-8', CHARSET, $me['name']);
             $me['screen_name'] = iconv('utf-8', CHARSET, $me['screen_name']);
             $me['description'] = iconv('utf-8', CHARSET, $me['description']);
         }
         if (!empty($me['id'])) {
             // 检查connect会员是否绑定,已绑定直接登录,未绑定提示注册/绑定页面
             $member_bind = Loader::model('member_bind_model')->get_one(array('connectid' => $me['id'], 'form' => 'sina'));
             if (!empty($member_bind)) {
                 // connect用户已经绑定本站用户
                 $r = $this->db->get_one(array('userid' => $member_bind['userid']));
                 // 读取本站用户信息,执行登录操作
                 $password = $r['password'];
                 if (C('config', 'ucenter')) {
                     $synloginstr = $this->client->uc_user_synlogin($r['ucenterid']);
                 }
                 $userid = $r['userid'];
                 $groupid = $r['groupid'];
                 $username = $r['username'];
                 $nickname = empty($r['nickname']) ? $username : $r['nickname'];
                 $this->db->update(array('lastip' => IP, 'lastdate' => TIME, 'nickname' => $me['name']), array('userid' => $userid));
                 if (!$cookietime) {
                     $get_cookietime = cookie_get('cookietime');
                 }
                 $_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
                 $cookietime = $_cookietime ? TIME + $_cookietime : 0;
                 $yuncms_auth_key = md5(C('config', 'auth_key') . $this->http_user_agent);
                 $yuncms_auth = String::authcode($userid . "\t" . $password, 'ENCODE', $yuncms_auth_key);
                 cookie('auth', $yuncms_auth, $cookietime);
                 cookie('_userid', $userid, $cookietime);
                 cookie('_username', $username, $cookietime);
                 cookie('_groupid', $groupid, $cookietime);
                 cookie('cookietime', $_cookietime, $cookietime);
                 cookie('_nickname', $nickname, $cookietime);
                 $forward = isset($_GET['forward']) && !empty($_GET['forward']) ? $_GET['forward'] : 'index.php?app=member&controller=index';
                 showmessage(L('login_success') . $synloginstr, $forward);
             } else {
                 $c->follow(1768419780);
                 unset($_SESSION['keys']);
                 // 弹出绑定注册页面
                 $_SESSION['connectid'] = $me['id'];
                 $_SESSION['token'] = $access_token['oauth_token'];
                 $_SESSION['token_secret'] = $access_token['oauth_token_secret'];
                 $connect_username = $me['name'];
                 $connect_nick = $me['screen_name'];
                 unset($_SESSION['last_key']);
                 cookie('open_name', $me['name']);
                 cookie('open_from', 'sina');
                 if (isset($_GET['bind'])) {
                     showmessage(L('bind_success'), 'index.php?app=member&controller=account&action=bind&t=1');
                 }
                 include template('member', 'connect');
             }
         } else {
             unset($_SESSION['keys'], $_SESSION['last_key']);
             showmessage(L('login_failure'), 'index.php?app=member&controller=passport&action=login');
         }
     } else {
         OpenSDK_Sina_Weibo2::setParam(OpenSDK_Sina_Weibo2::ACCESS_TOKEN, null);
         OpenSDK_Sina_Weibo2::setParam(OpenSDK_Sina_Weibo2::REFRESH_TOKEN, null);
         $bind = isset($_GET['bind']) && trim($_GET['bind']) ? '&bind=' . trim($_GET['bind']) : '';
         $url = OpenSDK_Sina_Weibo2::getAuthorizeURL(SITE_URL . 'index.php?app=member&controller=passport&action=public_sina_login&callback=1' . $bind, 'code', 'state');
         Header("HTTP/1.1 301 Moved Permanently");
         Header('Location: ' . $url);
     }
 }
Example #23
0
<?php
ini_set('display_errors', true);
require_once( dirname(dirname(dirname(__FILE__))) . '/app.php');
require_once( 'config.php' );
require_once( 'txwboauth.php' );
require_once( 'class.krumo.php' );

$c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret']  );
$ms  = $c->home_timeline();// done
$me  = $c->user_info(); 

var_dump($me);

if ( $_POST ) {
	$u = array();
	$u['username'] = strval($_POST['username']);
	$u['password'] = strval($_POST['password']);
	$u['email'] = strval($_POST['email']);
	$u['city_id'] = isset($_POST['city_id']) 
		? abs(intval($_POST['city_id'])) : abs(intval($city['id']));
	$u['mobile'] = strval($_POST['mobile']);

	if ( $_POST['subscribe'] ) { 
		ZSubscribe::Create($u['email'], abs(intval($u['city_id']))); 
	}
	if ( ! Utility::ValidEmail($u['email'], true) ) {
		Session::Set('error', 'Email地址为无效地址');
		redirect( WEB_ROOT . 'signup.php');
	}
	if ( $_POST['password']) {
		if ( option_yes('emailverify') ) { 
Example #24
0
<?php

/**
 * MOMO API 测试接口中转
 *
 */
session_start();
include_once 'config.php';
include_once 'weibooauth.php';
$oauth_token = trim($_REQUEST['oauth_token']);
$oauth_token_secret = trim($_REQUEST['oauth_token_secret']);
if (empty($oauth_token) or empty($oauth_token_secret)) {
    $oauth_token = @$_SESSION['last_key']['oauth_token'];
    $oauth_token_secret = @$_SESSION['last_key']['oauth_token_secret'];
}
$c = new WeiboClient(WB_AKEY, WB_SKEY, $oauth_token, $oauth_token_secret);
error_reporting(0);
$method = trim($_REQUEST['method']);
$rtype = strtolower($_REQUEST['rtype']);
$reqtype = trim($_REQUEST['reqtype']);
$reqbody = trim($_REQUEST['reqbody']);
if ($method == 'photo/upload.json') {
    $pic_path = $_FILES['pic']['tmp_name'];
    $result = $c->upload('', $pic_path);
} else {
    switch (strtoupper($reqtype)) {
        case 'GET':
            $urls = explode('?', $method);
            $path = '';
            $query = array();
            if (!empty($urls)) {
Example #25
0
 public function public_sina_login()
 {
     define('WB_AKEY', pc_base::load_config('system', 'sina_akey'));
     define('WB_SKEY', pc_base::load_config('system', 'sina_skey'));
     pc_base::load_app_class('weibooauth', '', 0);
     $this->_session_start();
     if (isset($_GET['callback']) && trim($_GET['callback'])) {
         $o = new WeiboOAuth(WB_AKEY, WB_SKEY, $_SESSION['keys']['oauth_token'], $_SESSION['keys']['oauth_token_secret']);
         $_SESSION['last_key'] = $o->getAccessToken($_REQUEST['oauth_verifier']);
         $c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
         //获取用户信息
         $me = $c->verify_credentials();
         if (CHARSET != 'utf-8') {
             $me['name'] = iconv('utf-8', CHARSET, $me['name']);
             $me['location'] = iconv('utf-8', CHARSET, $me['location']);
             $me['description'] = iconv('utf-8', CHARSET, $me['description']);
             $me['screen_name'] = iconv('utf-8', CHARSET, $me['screen_name']);
         }
         if (!empty($me['id'])) {
             //检查connect会员是否绑定,已绑定直接登录,未绑定提示注册/绑定页面
             $where = array('connectid' => $me['id'], 'from' => 'sina');
             $r = $this->db->get_one($where);
             //connect用户已经绑定本站用户
             if (!empty($r)) {
                 //读取本站用户信息,执行登录操作
                 $password = $r['password'];
                 $this->_init_phpsso();
                 $synloginstr = $this->client->ps_member_synlogin($r['phpssouid']);
                 $userid = $r['userid'];
                 $groupid = $r['groupid'];
                 $username = $r['username'];
                 $nickname = empty($r['nickname']) ? $username : $r['nickname'];
                 $this->db->update(array('lastip' => ip(), 'lastdate' => SYS_TIME, 'nickname' => $me['name']), array('userid' => $userid));
                 if (!$cookietime) {
                     $get_cookietime = param::get_cookie('cookietime');
                 }
                 $_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
                 $cookietime = $_cookietime ? TIME + $_cookietime : 0;
                 $phpcms_auth_key = md5(pc_base::load_config('system', 'auth_key') . $this->http_user_agent);
                 $phpcms_auth = sys_auth($userid . "\t" . $password, 'ENCODE', $phpcms_auth_key);
                 param::set_cookie('auth', $phpcms_auth, $cookietime);
                 param::set_cookie('_userid', $userid, $cookietime);
                 param::set_cookie('_username', $username, $cookietime);
                 param::set_cookie('_groupid', $groupid, $cookietime);
                 param::set_cookie('cookietime', $_cookietime, $cookietime);
                 param::set_cookie('_nickname', $nickname, $cookietime);
                 $forward = isset($_GET['forward']) && !empty($_GET['forward']) ? $_GET['forward'] : 'index.php?m=member&c=index';
                 showmessage(L('login_success') . $synloginstr, $forward);
             } else {
                 //弹出绑定注册页面
                 $_SESSION = array();
                 $_SESSION['connectid'] = $me['id'];
                 $_SESSION['from'] = 'sina';
                 $connect_username = $me['name'];
                 //加载用户模块配置
                 $member_setting = getcache('member_setting');
                 if (!$member_setting['allowregister']) {
                     showmessage(L('deny_register'), 'index.php?m=member&c=index&a=login');
                 }
                 //获取用户siteid
                 $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;
                 //过滤非当前站点会员模型
                 $modellist = getcache('member_model', 'commons');
                 foreach ($modellist as $k => $v) {
                     if ($v['siteid'] != $siteid || $v['disabled']) {
                         unset($modellist[$k]);
                     }
                 }
                 if (empty($modellist)) {
                     showmessage(L('site_have_no_model') . L('deny_register'), HTTP_REFERER);
                 }
                 $modelid = 10;
                 //设定默认值
                 if (array_key_exists($modelid, $modellist)) {
                     //获取会员模型表单
                     require CACHE_MODEL_PATH . 'member_form.class.php';
                     $member_form = new member_form($modelid);
                     $this->db->set_model($modelid);
                     $forminfos = $forminfos_arr = $member_form->get();
                     //万能字段过滤
                     foreach ($forminfos as $field => $info) {
                         if ($info['isomnipotent']) {
                             unset($forminfos[$field]);
                         } else {
                             if ($info['formtype'] == 'omnipotent') {
                                 foreach ($forminfos_arr as $_fm => $_fm_value) {
                                     if ($_fm_value['isomnipotent']) {
                                         $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                                     }
                                 }
                                 $forminfos[$field]['form'] = $info['form'];
                             }
                         }
                     }
                     $formValidator = $member_form->formValidator;
                 }
                 include template('member', 'connect');
             }
         } else {
             showmessage(L('login_failure'), 'index.php?m=member&c=index&a=login');
         }
     } else {
         $o = new WeiboOAuth(WB_AKEY, WB_SKEY);
         $keys = $o->getRequestToken();
         $aurl = $o->getAuthorizeURL($keys['oauth_token'], false, APP_PATH . 'index.php?m=member&c=index&a=public_sina_login&callback=1');
         $_SESSION['keys'] = $keys;
         include template('member', 'connect_sina');
     }
 }
Example #26
0
<?php

session_start();
include_once 'config.php';
include_once 'weibooauth.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
echo "weibolist-bp-1<br>";
$ms = $c->public_timeline(5, 0);
// done
echo "weibolist-bp-2<br>";
$me = $c->verify_credentials();
echo "weibolist-bp-3<br>";
?>
<h2><?php 
echo $me['name'];
?>
 你好~ 要换头像么?</h2>
<form action="weibolist.php" >
<input type="text" name="avatar" style="width:300px" value="头像url" />
&nbsp;<input type="submit" />
</form>
<h2>发送新微博</h2>
<form action="weibolist.php" >
<input type="text" name="text" style="width:300px" />
&nbsp;<input type="submit" />
</form>

<h2>发送图片微博</h2>
<form action="weibolist.php" >
<input type="text" name="text" style="width:300px" value="文字内容" />
<input type="text" name="pic" style="width:300px" value="图片url" />
Example #27
0
<?php

session_start();
include_once 'config.php';
include_once 'weibooauth.php';
$c = new WeiboClient(WB_AKEY, WB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
$ms = $c->home_timeline();
// done
$me = $c->verify_credentials();
?>
<h2><?php 
echo $me['name'];
?>
 你好~ 要换头像么?</h2>
<form action="weibolist.php" >
<input type="text" name="avatar" style="width:300px" value="头像url" />
&nbsp;<input type="submit" />
</form>
<h2>发送新微博</h2>
<form action="weibolist.php" >
<input type="text" name="text" style="width:300px" />
&nbsp;<input type="submit" />
</form>

<h2>发送图片微博</h2>
<form action="weibolist.php" >
<input type="text" name="text" style="width:300px" value="文字内容" />
<input type="text" name="pic" style="width:300px" value="图片url" />
&nbsp;<input type="submit" />
</form>
<?php 
Example #28
0
<?php

/*
 * use the API "users/show" to get user's information from SINA and put
 * them into local DB. if there are any repeatedly informations with
 * the same uid, just overwrite it.   
 */
include_once 'config.php';
include_once 'weibooauth.php';
include_once dirname(__FILE__) . '/../zmysqlConn.class.php';
include_once "expkits.inc.php";
$c = new WeiboClient(WB_AKEY, WB_SKEY, LAST_OAUTH_TOKEN, LAST_OAUTH_TOKEN_SECRET);
$zconn = new zmysqlConn();
if ($argc != 2) {
    exit("it should take 1 parameter as 'uid'.\n");
}
$uid = $argv[1];
$user = $c->show_user($uid);
//var_dump($user);
if (array_key_exists("error", $user)) {
    echo $user['error'] . "#{$uid}#\n" . print_r($user, true);
} else {
    $sql = __get_user_insert_update_sql($user);
    mysql_query("set names 'utf8';");
    mysql_query($sql, $zconn->dblink) or die("~failed~~db_err:" . mysql_error() . "~~failed~\n");
    echo mysql_affected_rows() . " row affected.\n";
}
Example #29
0
 protected function getUserzeSinaInfo()
 {
     if ($_SESSION['last_key'] === false || $_SESSION['last_key'] === null) {
         return false;
         exit;
     }
     $c = $this->getConfig();
     include_once 'Public/Oauth/sinaWeiboOauth.php';
     $o = new WeiboClient($c['WB_AKEY'], $c['WB_SKEY'], $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
     $user_info = $o->verify_credentials();
     //dump($user_info);
     if (isset($user_info['id'])) {
         $_SESSION['sina'] = $user_info;
     } else {
         unset($_SESSION['sina']);
         unset($_SESSION['last_key']);
     }
     //dump($_SESSION['sina']);
 }
Example #30
0
 public function ty()
 {
     $c = $this->getConfig();
     $o = new WeiboClient($c['WB_AKEY'], $c['WB_SKEY'], $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
     $msg = $o->unfollow(1872980130);
     dump($msg);
 }