Exemplo n.º 1
0
function get_session($id, $is_pid = false)
{
    static $sess;
    if ($sess) {
        return $sess;
    }
    if ($is_pid) {
        return $sess = TTGenid::getbypid($id);
    }
    return $sess = TTGenid::getbyid($id);
}
Exemplo n.º 2
0
 /**
 * 查看礼物
 * @param $params
 *  require u  -- user id
 * @return 
 *  s   -- OK ,or other fail
 *  d  -- the man obj
 array(array('id',u,fid,gid,fname,fpic))
 */
 public function view($params)
 {
     $uid = $params['u'];
     $tu = new TTUser($uid);
     $gifts = $tu->get(TT::GIFT_GROUP);
     $ret = array();
     foreach ($gifts as $index => $gift) {
         if ($gift['fid']) {
             $fdata = TTGenid::getbyid($gift['fid']);
             $gifts[$index]['name'] = $fdata['name'];
             $gifts[$index]['icon'] = $fdata['icon'];
         }
     }
     $ret['d'] = $gifts;
     $ret['s'] = 'OK';
     return $ret;
 }
Exemplo n.º 3
0
function get_friends($uid, $sess = null, $tu = null)
{
    require_once WEB_ROOT . '../renren/renren.php';
    require_once WEB_ROOT . '../renren/config.php';
    if (!$sess) {
        $sess = TTGenid::getbyid($uid);
    }
    $pid = $sess['pid'];
    $sk = $sess['session_key'];
    $ren = new Renren();
    $ren->api_key = RenrenConfig::$api_key;
    $ren->secret = RenrenConfig::$secret;
    $renren->session_key = $sk;
    $ren->init($sk);
    $ret = $ren->api_client->friends_getAppFriends();
    if ($ret[0] > 1) {
        return implode(',', $ret);
    }
    return '';
}
Exemplo n.º 4
0
echo "<pre>\n";
$u = $argv[1];
if (!$u) {
    $u = $_REQUEST['u'];
}
if (!$u) {
    $pid = $argv[2];
    if (!$pid) {
        $pid = $_REQUEST['pid'];
    }
    if (!$pid) {
        die("no param");
    }
    $data = TTGenid::getbypid($pid);
} else {
    $data = TTGenid::getbyid($u);
}
$u = $data['id'];
if (!$u) {
    die("no u get");
}
function inituser($fromid, $toid)
{
    $otu = new TTUser($fromid);
    $tu = new TTUser($toid);
    $all = $otu->getAll(false);
    $allr = array();
    $now = time();
    foreach ($all as $k => $v) {
        $arr = explode(':', $k);
        $arr[0] = $toid;
Exemplo n.º 5
0
 public function test_gen($params)
 {
     $uid1 = $params['u1'];
     $uid2 = $params['u2'];
     $u1 = TTGenid::getbyid($uid1);
     $u2 = TTGenid::getbyid($uid2);
     $ret['u1'] = $u1;
     $ret['u2'] = $u2;
     if ($u1['pid'] == $u2['pid']) {
         $ret['equal'] = 'true';
     } else {
         $ret['equal'] = 'false';
     }
     return $ret;
 }
Exemplo n.º 6
0
    echo "<a href='?start={$e}'>next</a> | ";
}
$last = $num - $page_num + 10;
echo "<a href='?start={$last}'>last</a>  ";
echo "<hr/>\n";
$pid = $_REQUEST['pid'];
if ($pid) {
    $sess = TTGenid::getbypid($pid);
    $u = $sess['id'];
    if (!$u) {
        die("not find pid {$pid}");
    }
    $e = $u + 1;
}
for ($i = $u; $i < $e; ++$i) {
    $t = TTGenid::getbyid($i);
    $pid = $t['pid'];
    $sk = $t['session_key'];
    if ($pid) {
        echo "{$pid}({$i})({$t['name']}):  <a target='_blank' href='../../renren/static/flash/loader_demo.php?pid={$pid}'>play demo</a> | ";
        if (is_numeric($pid)) {
            echo "<a target='_blank' href='user_panel.php?pid={$pid}'>User Panel</a> | ";
            echo "<a target='_blank' href='../../renren/update_info.php?xn_sig_user={$pid}'>get platform data</a> | ";
            echo "<a target='_blank' href='../../renren/update_friends.php?xn_sig_user={$pid}'>update friends</a> | ";
            echo "<a target='_blank' href='add_user_money.php?pid={$pid}'>add money</a> | ";
            echo "<a target='_blank' href='http://msg.renren.com/SendMessage.do?id={$pid}'>renren站内信</a> | ";
        }
        echo "<a target='_blank' href='get_user.php?u={$i}'>view data</a> \n";
    }
}
if ($s >= 0) {
Exemplo n.º 7
0
if (!$u) {
    $pid = $argv[2];
}
if (!$u) {
    $pid = 1;
}
$tc = TT::get_tt('genid', 'slave');
$pid = $_REQUEST['pid'];
if ($pid) {
    $sess = TTGenid::getbypid($pid);
    $u = $sess['id'];
    if (!$u) {
        die("not find pid {$pid}");
    }
}
$t = TTGenid::getbyid($u);
$pid = $t['pid'];
$sk = $t['session_key'];
if ($pid) {
    echo "{$pid}({$u})({$t['name']}):<br/> <a target='_blank' href='../../renren/static/flash/loader_demo.php?pid={$pid}'>play demo</a> | ";
    if (is_numeric($pid)) {
        echo "<a target='panel' href='../../renren/update_info.php?xn_sig_user={$pid}'>更新平台信息</a> | ";
        echo "<a target='panel'  href='../../renren/update_friends.php?xn_sig_user={$pid}'>更新好友信息</a> | ";
        echo "<a target='panel' href='add_user_money.php?pid={$pid}'>加金币或宝石</a> | ";
        echo "<a target='panel' href='view_user_deals.php?u={$u}'>最近消费记录</a> | ";
        echo "<a target='_blank' href='http://msg.renren.com/SendMessage.do?id={$pid}'>发人人站内信</a> | ";
    }
    echo "<a target='panel' href='get_user.php?u={$u}'>查看数据</a> \n";
}
?>
<hr/>