安全问题: '.$r_dbu['question'].' 答案: 新密码: 确认: ';
39 | }else{
40 | header('Location:./?m=lostpw&e=3');
41 | exit();
42 | }
43 | }else{
44 | header('Location:./?m=lostpw&e=4');
45 | exit();
46 | }
47 | mysql_free_result($q_dbu);
48 | }else{
49 | header('Location:./');
50 | exit();
51 | }
52 | }else{
53 | $content.='1步';
60 | }else{
61 | header('Location:./');
62 | exit();
63 | }
64 |
--------------------------------------------------------------------------------
/lib/twitterOAuth.php:
--------------------------------------------------------------------------------
1 | http_status; }
12 | function lastAPICall(){ return $this->last_api_call; }
13 |
14 | function __construct($consumer_key, $consumer_secret, $oauth_token=NULL, $oauth_token_secret=NULL){
15 | $this->sha1_method=new OAuthSignatureMethod_HMAC_SHA1();
16 | $this->consumer=new OAuthConsumer($consumer_key, $consumer_secret);
17 | if(!empty($oauth_token) && !empty($oauth_token_secret)){
18 | $this->token=new OAuthConsumer($oauth_token, $oauth_token_secret);
19 | }else{
20 | $this->token=NULL;
21 | }
22 | }
23 |
24 | function getRequestToken(){
25 | $r=$this->oAuthRequest($this->requestTokenURL());
26 | $token=$this->oAuthParseResponse($r);
27 | $this->token=new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
28 | return $token;
29 | }
30 |
31 | function oAuthParseResponse($responseString){
32 | $r=array();
33 | foreach(explode('&', $responseString) as $param){
34 | $pair=explode('=', $param, 2);
35 | if(count($pair)!=2)continue;
36 | $r[urldecode($pair[0])]=urldecode($pair[1]);
37 | }
38 | return $r;
39 | }
40 |
41 | function getAuthorizeURL($token){
42 | if(is_array($token)) $token=$token['oauth_token'];
43 | return $this->authorizeURL().'?oauth_token='.$token;
44 | }
45 |
46 | function getAccessToken($token=NULL){
47 | $r=$this->oAuthRequest($this->accessTokenURL());
48 | $token=$this->oAuthParseResponse($r);
49 | $this->token=new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
50 | return $token;
51 | }
52 |
53 | function oAuthRequest($url, $args=array(), $method=NULL){
54 | if(empty($method)) $method=empty($args)?"GET":"POST";
55 | $req=OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $args);
56 | $req->sign_request($this->sha1_method, $this->consumer, $this->token);
57 | switch($method){
58 | case 'GET': return $this->http($req->to_url());
59 | case 'POST': return $this->http($req->get_normalized_http_url(), $req->to_postdata());
60 | }
61 | }
62 |
63 | function http($url, $post_data=null){
64 | $ch=curl_init();
65 | if(defined("CURL_CA_BUNDLE_PATH"))curl_setopt($ch, CURLOPT_CAINFO, CURL_CA_BUNDLE_PATH);
66 | curl_setopt($ch, CURLOPT_URL, $url);
67 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
68 | curl_setopt($ch, CURLOPT_TIMEOUT, 30);
69 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
70 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
71 | if(isset($post_data)){
72 | curl_setopt($ch, CURLOPT_POST, 1);
73 | curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
74 | }
75 | $response=curl_exec($ch);
76 | $this->http_status=curl_getinfo($ch, CURLINFO_HTTP_CODE);
77 | $this->last_api_call=$url;
78 | curl_close($ch);
79 | return $response;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/baidu.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
13 | $this->client_secret=$client_secret;
14 | $this->access_token=$access_token;
15 | }
16 |
17 | //生成授权网址
18 | public function login_url($callback_url, $scope=''){
19 | $params=array(
20 | 'response_type'=>'code',
21 | 'client_id'=>$this->client_id,
22 | 'redirect_uri'=>$callback_url,
23 | 'scope'=>$scope,
24 | 'state'=>md5(time()),
25 | 'display'=>'page'
26 | );
27 | return 'https://openapi.baidu.com/oauth/2.0/authorize?'.http_build_query($params);
28 | }
29 |
30 | //获取access token
31 | public function access_token($callback_url, $code){
32 | $params=array(
33 | 'grant_type'=>'authorization_code',
34 | 'code'=>$code,
35 | 'client_id'=>$this->client_id,
36 | 'client_secret'=>$this->client_secret,
37 | 'redirect_uri'=>$callback_url
38 | );
39 | $url='https://openapi.baidu.com/oauth/2.0/token';
40 | return $this->http($url, http_build_query($params), 'POST');
41 | }
42 |
43 | //使用refresh token获取新的access token
44 | public function access_token_refresh($refresh_token){
45 | $params=array(
46 | 'grant_type'=>'refresh_token',
47 | 'refresh_token'=>$refresh_token,
48 | 'client_id'=>$this->client_id,
49 | 'client_secret'=>$this->client_secret
50 | );
51 | $url='https://openapi.baidu.com/oauth/2.0/token';
52 | return $this->http($url, http_build_query($params), 'POST');
53 | }
54 |
55 | //获取登录用户信息
56 | public function me(){
57 | $params=array();
58 | return $this->api('passport/users/getLoggedInUser', $params);
59 | }
60 |
61 | //调用接口
62 | /**
63 | //示例:获取登录用户信息
64 | $result=$facebook->api('passport/users/getLoggedInUser', array(), 'GET');
65 | **/
66 | public function api($url, $params=array(), $method='GET'){
67 | $url=$this->api_url.$url;
68 | $params['access_token']=$this->access_token;
69 | if($method=='GET'){
70 | $result=$this->http($url.'?'.http_build_query($params));
71 | }else{
72 | $result=$this->http($url, http_build_query($params), 'POST');
73 | }
74 | return $result;
75 | }
76 |
77 | //提交请求
78 | private function http($url, $postfields='', $method='GET', $headers=array()){
79 | $ci=curl_init();
80 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
81 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
82 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
83 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
84 | if($method=='POST'){
85 | curl_setopt($ci, CURLOPT_POST, TRUE);
86 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
87 | }
88 | $headers[]='User-Agent: Baidu.PHP(piscdong.com)';
89 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
90 | curl_setopt($ci, CURLOPT_URL, $url);
91 | $response=curl_exec($ci);
92 | curl_close($ci);
93 | $json_r=array();
94 | if($response!='')$json_r=json_decode($response, true);
95 | return $json_r;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/s_skin.php:
--------------------------------------------------------------------------------
1 | $v){
24 | if($k>0){
25 | $simg='skin/'.$v[1]['path'].'/skin_b.jpg';
26 | $lp[$v[1]['path']]=' '.($v[1]['title']!=''?$v[1]['title']:'样式#'.$v[1]['id']).' ';
27 | if(isset($_GET['did']) && $_GET['did']==$k){
28 | $d_db=sprintf('delete from %s where id=%s', $dbprefix.'skin', $r_dbk['id']);
29 | $result=mysql_query($d_db) or die('');
30 | if($config['skin']==$r_dbk['id']){
31 | $u_db=sprintf('update %s set skin=0', $dbprefix.'main');
32 | $result=mysql_query($u_db) or die('');
33 | }
34 | header('Location:./?m=setting&t=skin');
35 | exit();
36 | }
37 | }else{
38 | $lp[0]=' 青青校园 ';
39 | }
40 | }
41 | if($_SERVER['REQUEST_METHOD']=='POST'){
42 | if(isset($_POST['path']) && file_exists('skin/'.$_POST['path'].'/info.php') && !isset($lp[$_POST['path']])){
43 | $path=$_POST['path'];
44 | require_once('skin/'.$_POST['path'].'/info.php');
45 | $stitle=isset($s_title)?htmlspecialchars($s_title,ENT_QUOTES):'';
46 | $sfile=isset($s_file)?htmlspecialchars($s_file,ENT_QUOTES):'styles.css';
47 | $i_db=sprintf('insert into %s (path, title, sfile) values (%s, %s, %s)', $dbprefix.'skin',
48 | SQLString($path, 'text'),
49 | SQLString($stitle, 'text'),
50 | SQLString($sfile, 'text'));
51 | $result=mysql_query($i_db) or die('');
52 | $e=2;
53 | }else{
54 | $e=1;
55 | }
56 | header('Location:./?m=setting&t=skin'.(isset($e)?'&e='.$e:''));
57 | exit();
58 | }else{
59 | $a_msg=array(1=>'文件不存在或者样式已经安装过!', '新样式已添加。');
60 | $content.=''.$a_msg[$_GET['e']]:' style="display: none;">').'
'.(isset($lp)?'样式管理
':'').'添加样式
';
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/lib/facebook.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
13 | $this->client_secret=$client_secret;
14 | $this->access_token=$access_token;
15 | }
16 |
17 | //生成授权网址
18 | public function login_url($callback_url, $scope=''){
19 | $params=array(
20 | 'response_type'=>'code',
21 | 'client_id'=>$this->client_id,
22 | 'redirect_uri'=>$callback_url,
23 | 'scope'=>$scope
24 | );
25 | return 'https://graph.facebook.com/oauth/authorize?'.http_build_query($params);
26 | }
27 |
28 | //获取access token
29 | public function access_token($callback_url, $code){
30 | $params=array(
31 | 'grant_type'=>'authorization_code',
32 | 'code'=>$code,
33 | 'client_id'=>$this->client_id,
34 | 'client_secret'=>$this->client_secret,
35 | 'redirect_uri'=>$callback_url
36 | );
37 | $url='https://graph.facebook.com/oauth/access_token';
38 | return $this->http($url, http_build_query($params), 'POST');
39 | }
40 |
41 | /**
42 | //使用refresh token获取新的access token,Facebook暂时不支持
43 | public function access_token_refresh($refresh_token){
44 | }
45 | **/
46 |
47 | //获取登录用户信息
48 | public function me(){
49 | $params=array();
50 | return $this->api('me', $params);
51 | }
52 |
53 | //获取登录用户feed
54 | public function my_feed($count=10, $page=1){
55 | $params=array(
56 | 'page'=>$page,
57 | 'count'=>$count
58 | );
59 | return $this->api('me/feed', $params);
60 | }
61 |
62 | //发布feed
63 | public function update($content){
64 | $params=array(
65 | 'message'=>$content
66 | );
67 | return $this->api('me/feed', $params, 'POST');
68 | }
69 |
70 | //调用接口
71 | /**
72 | //示例:获取登录用户信息
73 | $result=$facebook->api('me', array(), 'GET');
74 | **/
75 | public function api($url, $params=array(), $method='GET'){
76 | $url=$this->api_url.$url;
77 | $params['access_token']=$this->access_token;
78 | if($method=='GET'){
79 | $result=$this->http($url.'?'.http_build_query($params));
80 | }else{
81 | $result=$this->http($url, http_build_query($params), 'POST');
82 | }
83 | return $result;
84 | }
85 |
86 | //提交请求
87 | private function http($url, $postfields='', $method='GET', $headers=array()){
88 | $ci=curl_init();
89 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
90 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
91 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
92 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
93 | if($method=='POST'){
94 | curl_setopt($ci, CURLOPT_POST, TRUE);
95 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
96 | }
97 | $headers[]='User-Agent: Facebook.PHP(piscdong.com)';
98 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
99 | curl_setopt($ci, CURLOPT_URL, $url);
100 | $response=curl_exec($ci);
101 | curl_close($ci);
102 | $json_r=array();
103 | if($response!='')$json_r=json_decode($response, true);
104 | return $json_r;
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/j_chat.php:
--------------------------------------------------------------------------------
1 | 0)?intval($_GET['m']):0;
16 | $i=(isset($_GET['i']) && intval($_GET['i'])>0)?intval($_GET['i']):1;
17 | switch($m){
18 | case 2:
19 | if(isset($_POST['c']) && trim($_POST['c'])!='' && $i!=$_SESSION[$config['u_hash']]){
20 | $c=htmlspecialchars(trim($_POST['c']),ENT_QUOTES);
21 | $vdb=$config['veri']>0?'':' and status=0';
22 | $s_dbu=sprintf('select id from %s where id=%s%s limit 1', $dbprefix.'member', $i, $vdb);
23 | $q_dbu=mysql_query($s_dbu) or die('');
24 | $r_dbu=mysql_fetch_assoc($q_dbu);
25 | if(mysql_num_rows($q_dbu)>0){
26 | $i_db=sprintf('insert into %s (content, aid, tid, datetime, readed) values (%s, %s, %s, %s, 1)', $dbprefix.'message',
27 | SQLString($c, 'text'),
28 | $_SESSION[$config['u_hash']],
29 | $r_dbu['id'],
30 | time());
31 | $result=mysql_query($i_db) or die('');
32 | }
33 | mysql_free_result($q_dbu);
34 | echo ''.gbookencode($c).'
'.date('H:i', getftime()).'
';
35 | }
36 | break;
37 | case 1:
38 | $lid=(isset($_GET['l']) && intval($_GET['l'])>0)?intval($_GET['l']):0;
39 | $tid=(isset($_GET['t']) && intval($_GET['t'])>0)?$_GET['t']:time();
40 | $ldb=$lid>0?'id>'.$lid:'datetime>'.$tid;
41 | $s_dbg=sprintf('select id, content, datetime from %s where tid=%s and aid=%s and (readed=1 or %s) order by datetime', $dbprefix.'message', $_SESSION[$config['u_hash']], $i, $ldb);
42 | $q_dbg=mysql_query($s_dbg) or die('');
43 | $r_dbg=mysql_fetch_assoc($q_dbg);
44 | if(mysql_num_rows($q_dbg)>0){
45 | do{
46 | $tn=getftime($r_dbg['datetime']);
47 | $tc=getftime();
48 | echo ''.gbookencode($r_dbg['content']).'
'.(date('Ymd', $tn)!=date('Ymd', $tc)?date('Y-n-j', $tn).' ':'').date('H:i', $tn).'
';
49 | $u_db=sprintf('update %s set readed=0 where id=%s', $dbprefix.'message', $r_dbg['id']);
50 | $result=mysql_query($u_db) or die('');
51 | }while($r_dbg=mysql_fetch_assoc($q_dbg));
52 | }
53 | mysql_free_result($q_dbg);
54 | break;
55 | default:
56 | $s_dbg=sprintf('select a.aid, b.name from %s as a, %s as b where a.tid=%s and a.aid=b.id and a.readed=1 order by a.datetime desc', $dbprefix.'message', $dbprefix.'member', $_SESSION[$config['u_hash']]);
57 | $q_dbg=mysql_query($s_dbg) or die('');
58 | $r_dbg=mysql_fetch_assoc($q_dbg);
59 | if(mysql_num_rows($q_dbg)>0){
60 | do{
61 | $a_mid[$r_dbg['aid']]=$r_dbg['aid'];
62 | $a_name[$r_dbg['aid']]=$r_dbg['name'];
63 | }while($r_dbg=mysql_fetch_assoc($q_dbg));
64 | }
65 | mysql_free_result($q_dbg);
66 | echo ' ';
67 | if(isset($a_name)){
68 | foreach($a_name as $k=>$v)echo ' ';
69 | }
70 | break;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/google.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
13 | $this->client_secret=$client_secret;
14 | $this->access_token=$access_token;
15 | }
16 |
17 | //生成授权网址
18 | public function login_url($callback_url, $scope=''){
19 | $params=array(
20 | 'response_type'=>'code',
21 | 'client_id'=>$this->client_id,
22 | 'redirect_uri'=>$callback_url,
23 | 'scope'=>$scope,
24 | 'state'=>'profile',
25 | 'access_type'=>'offline'
26 | );
27 | return 'https://accounts.google.com/o/oauth2/auth?'.http_build_query($params);
28 | }
29 |
30 | //获取access token
31 | public function access_token($callback_url, $code){
32 | $params=array(
33 | 'grant_type'=>'authorization_code',
34 | 'code'=>$code,
35 | 'client_id'=>$this->client_id,
36 | 'client_secret'=>$this->client_secret,
37 | 'redirect_uri'=>$callback_url
38 | );
39 | $url='https://accounts.google.com/o/oauth2/token';
40 | $result=$this->http($url, http_build_query($params), 'POST');
41 | return $result;
42 | }
43 |
44 | //使用refresh token获取新的access token
45 | public function access_token_refresh($refresh_token){
46 | $params=array(
47 | 'grant_type'=>'refresh_token',
48 | 'refresh_token'=>$refresh_token,
49 | 'client_id'=>$this->client_id,
50 | 'client_secret'=>$this->client_secret
51 | );
52 | $url='https://accounts.google.com/o/oauth2/token';
53 | $result=$this->http($url, http_build_query($params), 'POST');
54 | return $result;
55 | }
56 |
57 | //获取登录用户信息
58 | public function me(){
59 | $params=array();
60 | return $this->api('userinfo', $params);
61 | }
62 |
63 | //调用接口
64 | /**
65 | //示例:获取登录用户信息
66 | $result=$google->api('userinfo', array(), 'GET');
67 | **/
68 | public function api($url, $params=array(), $method='GET'){
69 | $url=$this->api_url.$url;
70 | $headers[]='Authorization: Bearer '.$this->access_token;
71 | if($method=='GET'){
72 | $result=$this->http($url.'?'.http_build_query($params), '', 'GET', $headers);
73 | }else{
74 | $result=$this->http($url, http_build_query($params), 'POST', $headers);
75 | }
76 | return $result;
77 | }
78 |
79 | //提交请求
80 | private function http($url, $postfields='', $method='GET', $headers=array()){
81 | $ci=curl_init();
82 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
83 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
84 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
85 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
86 | if($method=='POST'){
87 | curl_setopt($ci, CURLOPT_POST, TRUE);
88 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
89 | }
90 | $headers[]='User-Agent: Google.PHP(piscdong.com)';
91 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
92 | curl_setopt($ci, CURLOPT_URL, $url);
93 | $response=curl_exec($ci);
94 | curl_close($ci);
95 | $json_r=array();
96 | if($response!='')$json_r=json_decode($response, true);
97 | return $json_r;
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/xls.php:
--------------------------------------------------------------------------------
1 | 0?'':' where status=0';
15 | $s_dbu=sprintf('select name, gender, bir_m, bir_d, bir_y, url, email, phone, work, tel, qq, msn, gtalk, address, location from %s%s', $dbprefix.'member', $vdb);
16 | $q_dbu=mysql_query($s_dbu) or die('');
17 | $r_dbu=mysql_fetch_assoc($q_dbu);
18 | if(mysql_num_rows($q_dbu)>0){
19 | header('Content-Disposition:application/vnd.ms-excel; filename=user.xls');
20 | header('Content-Type:application/vnd.ms-excel;charset=UTF-8');
21 | echo ''.$config['title'].':通讯录 |
姓名 | 性别 | 生日 | 主页 | 电子邮件 | 手机 | 工作单位 | 联系电话 | QQ | MSN | Google Talk | 住址 | 籍贯 |
';
24 | do{
25 | echo ''.$r_dbu['name'].' | '.($r_dbu['gender']>0?($r_dbu['gender']==1?'男':'女'):' ').' | '.(($r_dbu['bir_m']>0 && $r_dbu['bir_d']>0)?($r_dbu['bir_y']>0?$r_dbu['bir_y'].'-':'').$r_dbu['bir_m'].'-'.$r_dbu['bir_d']:' ').' | '.($r_dbu['url']!=''?$r_dbu['url']:' ').' | '.($r_dbu['email']!=''?$r_dbu['email']:' ').' | '.($r_dbu['phone']!=''?$r_dbu['phone']:' ').' | '.($r_dbu['work']!=''?$r_dbu['work']:' ').' | '.($r_dbu['tel']!=''?$r_dbu['tel']:' ').' | '.($r_dbu['qq']!=''?$r_dbu['qq']:' ').' | '.($r_dbu['msn']!=''?$r_dbu['msn']:' ').' | '.($r_dbu['gtalk']!=''?$r_dbu['gtalk']:' ').' | '.($r_dbu['address']!=''?$r_dbu['address']:' ').' | '.($r_dbu['location']!=''?$r_dbu['location']:' ').' |
';
26 | }while($r_dbu=mysql_fetch_assoc($q_dbu));
27 | echo '
';
28 | }
29 | mysql_free_result($q_dbu);
30 | }
31 |
--------------------------------------------------------------------------------
/lib/t163.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
14 | $this->client_secret=$client_secret;
15 | $this->access_token=$access_token;
16 | }
17 |
18 | //生成授权网址
19 | public function login_url($callback_url){
20 | $params=array(
21 | 'response_type'=>'code',
22 | 'client_id'=>$this->client_id,
23 | 'redirect_uri'=>$callback_url
24 | );
25 | return 'https://api.t.163.com/oauth2/authorize?'.http_build_query($params);
26 | }
27 |
28 | //获取access token
29 | public function access_token($callback_url, $code){
30 | $params=array(
31 | 'grant_type'=>'authorization_code',
32 | 'code'=>$code,
33 | 'client_id'=>$this->client_id,
34 | 'client_secret'=>$this->client_secret,
35 | 'redirect_uri'=>$callback_url
36 | );
37 | $url='https://api.t.163.com/oauth2/access_token';
38 | return $this->http($url, http_build_query($params), 'POST');
39 | }
40 |
41 | //使用refresh token获取新的access token
42 | public function access_token_refresh($refresh_token){
43 | $params=array(
44 | 'grant_type'=>'refresh_token',
45 | 'refresh_token'=>$refresh_token,
46 | 'client_id'=>$this->client_id,
47 | 'client_secret'=>$this->client_secret
48 | );
49 | $url='https://api.t.163.com/oauth2/access_token';
50 | return $this->http($url, http_build_query($params), 'POST');
51 | }
52 |
53 | //获取登录用户信息
54 | public function me(){
55 | $params=array();
56 | return $this->api('users/show', $params);
57 | }
58 |
59 | //获取用户微博列表
60 | public function user_timeline($id, $count=10){
61 | $params=array(
62 | 'user_id'=>$id,
63 | 'count'=>$count
64 | );
65 | return $this->api('statuses/user_timeline', $params);
66 | }
67 |
68 | //发布微博
69 | public function update($status){
70 | $params=array(
71 | 'status'=>$status
72 | );
73 | return $this->api('statuses/update', $params, 'POST');
74 | }
75 |
76 | //调用接口
77 | /**
78 | //示例:获取登录用户信息
79 | $result=$t163->api('users/show', array(), 'GET');
80 | **/
81 | public function api($url, $params=array(), $method='GET'){
82 | $url=$this->api_url.$url.'.'.$this->format;
83 | $params['access_token']=$this->access_token;
84 | if($method=='GET'){
85 | $result=$this->http($url.'?'.http_build_query($params));
86 | }else{
87 | $result=$this->http($url, http_build_query($params), 'POST');
88 | }
89 | return $result;
90 | }
91 |
92 | //提交请求
93 | private function http($url, $postfields='', $method='GET', $headers=array()){
94 | $ci=curl_init();
95 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
96 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
97 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
98 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
99 | if($method=='POST'){
100 | curl_setopt($ci, CURLOPT_POST, TRUE);
101 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
102 | }
103 | $headers[]='User-Agent: t163.PHP(piscdong.com)';
104 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
105 | curl_setopt($ci, CURLOPT_URL, $url);
106 | $response=curl_exec($ci);
107 | curl_close($ci);
108 | $json_r=array();
109 | if($response!='')$json_r=json_decode($response, true);
110 | return $json_r;
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/lib/douban.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
13 | $this->client_secret=$client_secret;
14 | $this->access_token=$access_token;
15 | }
16 |
17 | //生成授权网址
18 | public function login_url($callback_url, $scope=''){
19 | $params=array(
20 | 'response_type'=>'code',
21 | 'client_id'=>$this->client_id,
22 | 'redirect_uri'=>$callback_url,
23 | 'scope'=>$scope,
24 | 'state'=>md5(time())
25 | );
26 | return 'https://www.douban.com/service/auth2/auth?'.http_build_query($params);
27 | }
28 |
29 | //获取access token
30 | public function access_token($callback_url, $code){
31 | $params=array(
32 | 'grant_type'=>'authorization_code',
33 | 'code'=>$code,
34 | 'client_id'=>$this->client_id,
35 | 'client_secret'=>$this->client_secret,
36 | 'redirect_uri'=>$callback_url
37 | );
38 | $url='https://www.douban.com/service/auth2/token';
39 | return $this->http($url, http_build_query($params), 'POST');
40 | }
41 |
42 | //使用refresh token获取新的access token
43 | public function access_token_refresh($callback_url, $refresh_token){
44 | $params=array(
45 | 'grant_type'=>'refresh_token',
46 | 'refresh_token'=>$refresh_token,
47 | 'client_id'=>$this->client_id,
48 | 'client_secret'=>$this->client_secret,
49 | 'redirect_uri'=>$callback_url
50 | );
51 | $url='https://www.douban.com/service/auth2/token';
52 | return $this->http($url, http_build_query($params), 'POST');
53 | }
54 |
55 | //获取登录用户信息
56 | public function me(){
57 | $params=array();
58 | return $this->api('v2/user/~me', $params);
59 | }
60 |
61 | //发布分享
62 | public function share($text, $title, $url, $description='', $pic=''){
63 | $params=array(
64 | 'text'=>$text,
65 | 'rec_title'=>$title,
66 | 'rec_url'=>$url,
67 | 'rec_desc'=>$description,
68 | 'rec_image'=>$pic
69 | );
70 | return $this->api('shuo/v2/statuses', $params, 'POST');
71 | }
72 |
73 | //调用接口
74 | /**
75 | //示例:获取登录用户信息
76 | $result=$douban->api('v2/user/~me', array(), 'GET');
77 | **/
78 | public function api($url, $params=array(), $method='GET'){
79 | $url=$this->api_url.$url;
80 | $headers[]='Authorization: Bearer '.$this->access_token;
81 | if($method=='GET'){
82 | $result=$this->http($url.'?'.http_build_query($params), '', 'GET', $headers);
83 | }else{
84 | $result=$this->http($url, http_build_query($params), 'POST', $headers);
85 | }
86 | return $result;
87 | }
88 |
89 | //提交请求
90 | private function http($url, $postfields='', $method='GET', $headers=array()){
91 | $ci=curl_init();
92 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
93 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
94 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
95 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
96 | if($method=='POST'){
97 | curl_setopt($ci, CURLOPT_POST, TRUE);
98 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
99 | }
100 | $headers[]='User-Agent: Douban.PHP(piscdong.com)';
101 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
102 | curl_setopt($ci, CURLOPT_URL, $url);
103 | $response=curl_exec($ci);
104 | curl_close($ci);
105 | $json_r=array();
106 | if($response!='')$json_r=json_decode($response, true);
107 | return $json_r;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/lib/kaixin.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
14 | $this->client_secret=$client_secret;
15 | $this->access_token=$access_token;
16 | }
17 |
18 | //生成授权网址
19 | public function login_url($callback_url, $scope=''){
20 | $params=array(
21 | 'response_type'=>'code',
22 | 'client_id'=>$this->client_id,
23 | 'redirect_uri'=>$callback_url,
24 | 'scope'=>$scope
25 | );
26 | return 'http://api.kaixin001.com/oauth2/authorize?'.http_build_query($params);
27 | }
28 |
29 | //获取access token
30 | public function access_token($callback_url, $code){
31 | $params=array(
32 | 'grant_type'=>'authorization_code',
33 | 'code'=>$code,
34 | 'client_id'=>$this->client_id,
35 | 'client_secret'=>$this->client_secret,
36 | 'redirect_uri'=>$callback_url
37 | );
38 | $url='https://api.kaixin001.com/oauth2/access_token';
39 | return $this->http($url, http_build_query($params), 'POST');
40 | }
41 |
42 | //使用refresh token获取新的access token
43 | public function access_token_refresh($refresh_token){
44 | $params=array(
45 | 'grant_type'=>'refresh_token',
46 | 'refresh_token'=>$refresh_token,
47 | 'client_id'=>$this->client_id,
48 | 'client_secret'=>$this->client_secret
49 | );
50 | $url='https://api.kaixin001.com/oauth2/access_token';
51 | return $this->http($url, http_build_query($params), 'POST');
52 | }
53 |
54 | //获取登录用户信息
55 | public function me(){
56 | $params=array();
57 | return $this->api('users/me', $params);
58 | }
59 |
60 | //发表记录
61 | public function records_add($content, $picurl=''){
62 | $params=array(
63 | 'content'=>$content
64 | );
65 | if($picurl!='')$params['picurl']=$picurl;
66 | return $this->api('records/add', $params, 'POST');
67 | }
68 |
69 | //获取登录用户的记录
70 | public function records_me($num=10, $start=0){
71 | $params=array(
72 | 'start'=>$start,
73 | 'num'=>$num
74 | );
75 | return $this->api('records/me', $params);
76 | }
77 |
78 | //调用接口
79 | /**
80 | //示例:获取登录用户信息
81 | $result=$kaixin->api('users/me', array(), 'GET');
82 | **/
83 | public function api($url, $params=array(), $method='GET'){
84 | $url=$this->api_url.$url.'.'.$this->format;
85 | $params['access_token']=$this->access_token;
86 | if($method=='GET'){
87 | $result=$this->http($url.'?'.http_build_query($params));
88 | }else{
89 | $result=$this->http($url, http_build_query($params), 'POST');
90 | }
91 | return $result;
92 | }
93 |
94 | //提交请求
95 | private function http($url, $postfields='', $method='GET', $headers=array()){
96 | $ci=curl_init();
97 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
98 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
99 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
100 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
101 | if($method=='POST'){
102 | curl_setopt($ci, CURLOPT_POST, TRUE);
103 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
104 | }
105 | $headers[]='User-Agent: Kaixin001.PHP(piscdong.com)';
106 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
107 | curl_setopt($ci, CURLOPT_URL, $url);
108 | $response=curl_exec($ci);
109 | curl_close($ci);
110 | $json_r=array();
111 | if($response!='')$json_r=json_decode($response, true);
112 | return $json_r;
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/j_topic.php:
--------------------------------------------------------------------------------
1 | 0)?intval($_GET['i']):1;
20 | $ddb=($c_log && $pa==9)?'':' and a.disp=0';
21 | $dpage=(isset($_GET['e']) && intval($_GET['e'])>0)?intval($_GET['e']):1;
22 | $page=(isset($_GET['p']) && intval($_GET['p'])>0)?intval($_GET['p']):1;
23 | $reply_s=5;
24 | $s_a_dbt=sprintf('select a.id, a.aid, a.content, a.disp, b.name, b.power from %s as a, %s as b where a.rid=%s and a.aid=b.id%s order by a.datetime desc', $dbprefix.'topic', $dbprefix.'member', $r, $ddb);
25 | $q_a_dbt=mysql_query($s_a_dbt) or die('');
26 | $c_dbt=mysql_num_rows($q_a_dbt);
27 | if($c_dbt>0){
28 | $p_dbt=ceil($c_dbt/$reply_s);
29 | if($page>$p_dbt)$page=$p_dbt;
30 | $s_dbt=sprintf('%s limit %d, %d', $s_a_dbt, ($page-1)*$reply_s, $reply_s);
31 | $q_dbt=mysql_query($s_dbt) or die('');
32 | $r_dbt=mysql_fetch_assoc($q_dbt);
33 | do{
34 | $ei=($c_log && ($pa>$r_dbt['power'] || $_SESSION[$config['u_hash']]==$r_dbt['aid']))?' ':'';
35 | echo ''.getalink($r_dbt['aid'], $r_dbt['name'], 1).':'.getaco($r_dbt['content'], $r_dbt['id'], 1).'
'.($ei!=''?'
':'');
36 | if($c_log && $pa>0 && $pa<9)echo '
';
37 | echo '
- '.getldate($r_dbt['datetime']).$ei;
38 | if($c_log){
39 | if($pa>0)echo '
';
40 | if($pa==9 && $r_dbt['disp']>0)echo '
已删除 ';
41 | }
42 | echo '
';
43 | }while($r_dbt=mysql_fetch_assoc($q_dbt));
44 | mysql_free_result($q_dbt);
45 | if($p_dbt>1){
46 | for($i=1;$i<=$p_dbt;$i++)echo ($i!=$page?''.$i.' ':$i).' ';
47 | }
48 | }
49 | mysql_free_result($q_a_dbt);
50 | }
51 |
--------------------------------------------------------------------------------
/lib/renren.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
13 | $this->client_secret=$client_secret;
14 | $this->access_token=$access_token;
15 | }
16 |
17 | //生成授权网址
18 | public function login_url($callback_url, $scope=''){
19 | $params=array(
20 | 'response_type'=>'code',
21 | 'client_id'=>$this->client_id,
22 | 'redirect_uri'=>$callback_url,
23 | 'scope'=>$scope
24 | );
25 | return 'https://graph.renren.com/oauth/authorize?'.http_build_query($params);
26 | }
27 |
28 | //获取access token
29 | public function access_token($callback_url, $code){
30 | $params=array(
31 | 'grant_type'=>'authorization_code',
32 | 'code'=>$code,
33 | 'client_id'=>$this->client_id,
34 | 'client_secret'=>$this->client_secret,
35 | 'redirect_uri'=>$callback_url
36 | );
37 | $url='https://graph.renren.com/oauth/token';
38 | return $this->http($url, http_build_query($params), 'POST');
39 | }
40 |
41 | //使用refresh token获取新的access token
42 | public function access_token_refresh($refresh_token){
43 | $params=array(
44 | 'grant_type'=>'refresh_token',
45 | 'refresh_token'=>$refresh_token,
46 | 'client_id'=>$this->client_id,
47 | 'client_secret'=>$this->client_secret
48 | );
49 | $url='https://graph.renren.com/oauth/token';
50 | return $this->http($url, http_build_query($params), 'POST');
51 | }
52 |
53 | //获取登录用户信息
54 | public function me(){
55 | $params=array();
56 | return $this->api('users.getInfo', $params, 'POST');
57 | }
58 |
59 | //更新状态
60 | public function setStatus($status){
61 | $params=array(
62 | 'status'=>$status
63 | );
64 | return $this->api('status.set', $params, 'POST');
65 | }
66 |
67 | //获取用户的状态列表
68 | public function getStatus($uid, $count=10, $page=1){
69 | $params=array(
70 | 'uid'=>$uid,
71 | 'page'=>$page,
72 | 'count'=>$count
73 | );
74 | return $this->api('status.gets', $params, 'POST');
75 | }
76 |
77 | //调用接口
78 | /**
79 | //示例:获取登录用户信息
80 | $result=$renren->api('users.getInfo', array(), 'POST');
81 | **/
82 | public function api($url, $params=array(), $method='GET'){
83 | $url=$this->api_url;
84 | $params['method']=$url;
85 | $params['v']='1.0';
86 | $params['access_token']=$this->access_token;
87 | $params['format']='json';
88 | ksort($params);
89 | $sig_str='';
90 | foreach($params as $k=>$v)$sig_str.=$k.'='.$v;
91 | $sig_str.=$this->client_secret;
92 | $sig=md5($sig_str);
93 | $params['sig']=$sig;
94 | if($method=='GET'){
95 | $result=$this->http($url.'?'.http_build_query($params));
96 | }else{
97 | $result=$this->http($url, http_build_query($params), 'POST');
98 | }
99 | return $result;
100 | }
101 |
102 | //提交请求
103 | private function http($url, $postfields='', $method='GET', $headers=array()){
104 | $ci=curl_init();
105 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
106 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
107 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
108 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
109 | if($method=='POST'){
110 | curl_setopt($ci, CURLOPT_POST, TRUE);
111 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
112 | }
113 | $headers[]='User-Agent: Renren.PHP(piscdong.com)';
114 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
115 | curl_setopt($ci, CURLOPT_URL, $url);
116 | $response=curl_exec($ci);
117 | curl_close($ci);
118 | $json_r=array();
119 | if($response!='')$json_r=json_decode($response, true);
120 | return $json_r;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/s_link.php:
--------------------------------------------------------------------------------
1 | 0){
17 | $js_c.='
18 | $("img[name=\'mu_img\']").click(function(){
19 | $("#linklist").load(\'j_link.php?i=\'+$(this).data(\'id\'));
20 | });
21 | $("img[name=\'md_img\']").click(function(){
22 | $("#linklist").load(\'j_link.php?e=1&i=\'+$(this).data(\'id\'));
23 | });
24 | $("img[name=\'del_img\']").click(function(){
25 | if(confirm(\'确认要删除?\'))location.href=\'?m=setting&t=link&did=\'+$(this).data(\'id\');
26 | });';
27 | $i=0;
28 | do{
29 | $lp[]=''.substrs($r_dbl['title'], 25).' '.substrs($r_dbl['url'], 20).' '.($i>0?' ':'').($i<($c_dbl-1)?' ':'').' ';
30 | if(isset($_GET['eid']) && $_GET['eid']==$r_dbl['id'])$edb=$r_dbl;
31 | if(isset($_GET['did']) && $_GET['did']==$r_dbl['id']){
32 | $d_db=sprintf('delete from %s where id=%s', $dbprefix.'link', $r_dbl['id']);
33 | $result=mysql_query($d_db) or die('');
34 | header('Location:./?m=setting&t=link');
35 | exit();
36 | }
37 | $tid=$r_dbl['thread'];
38 | $i++;
39 | }while($r_dbl=mysql_fetch_assoc($q_dbl));
40 | }
41 | mysql_free_result($q_dbl);
42 | if($_SERVER['REQUEST_METHOD']=='POST'){
43 | if(isset($_POST['title']) && trim($_POST['title'])!='' && isset($_POST['url']) && trim($_POST['url'])!=''){
44 | $title=htmlspecialchars(trim($_POST['title']),ENT_QUOTES);
45 | $url=getfurl(htmlspecialchars(trim($_POST['url']),ENT_QUOTES));
46 | if(isset($edb)){
47 | $u_db=sprintf('update %s set title=%s, url=%s where id=%s', $dbprefix.'link',
48 | SQLString($title, 'text'),
49 | SQLString($url, 'text'),
50 | $edb['id']);
51 | $result=mysql_query($u_db) or die('');
52 | $e=1;
53 | }else{
54 | $thread=isset($tid)?($tid+1):0;
55 | $i_db=sprintf('insert into %s (title, url, thread) values (%s, %s, %s)', $dbprefix.'link',
56 | SQLString($title, 'text'),
57 | SQLString($url, 'text'),
58 | $thread);
59 | $result=mysql_query($i_db) or die('');
60 | $e=2;
61 | }
62 | }
63 | header('Location:./?m=setting&t=link'.(isset($e)?'&e='.$e:''));
64 | exit();
65 | }else{
66 | $a_msg=array(1=>'链接已修改。', '新链接已添加。');
67 | if(isset($edb))$js_c.='
68 | $("#link_cbt").click(function(){
69 | location.href=\'?m=setting&t=link\';
70 | });';
71 | $content.=((isset($_GET['e']) && isset($a_msg[$_GET['e']]))?''.$a_msg[$_GET['e']].'
':'').(isset($lp)?'链接管理
':'').''.(isset($edb)?'编辑':'添加').'链接
';
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/lib/qq.php:
--------------------------------------------------------------------------------
1 | appid=$appid;
13 | $this->appkey=$appkey;
14 | $this->access_token=$access_token;
15 | }
16 |
17 | //生成授权网址
18 | public function login_url($callback_url, $scope=''){
19 | $params=array(
20 | 'client_id'=>$this->appid,
21 | 'redirect_uri'=>$callback_url,
22 | 'response_type'=>'code',
23 | 'scope'=>$scope
24 | );
25 | return 'https://graph.qq.com/oauth2.0/authorize?'.http_build_query($params);
26 | }
27 |
28 | //获取access token
29 | public function access_token($callback_url, $code){
30 | $params=array(
31 | 'grant_type'=>'authorization_code',
32 | 'client_id'=>$this->appid,
33 | 'client_secret'=>$this->appkey,
34 | 'code'=>$code,
35 | 'state'=>'',
36 | 'redirect_uri'=>$callback_url
37 | );
38 | $url='https://graph.qq.com/oauth2.0/token?'.http_build_query($params);
39 | $result_str=$this->http($url);
40 | $json_r=array();
41 | if($result_str!='')parse_str($result_str, $json_r);
42 | return $json_r;
43 | }
44 |
45 | /**
46 | //使用refresh token获取新的access token,QQ暂时不支持
47 | public function access_token_refresh($refresh_token){
48 | }
49 | **/
50 |
51 | //获取登录用户的openid
52 | public function get_openid(){
53 | $params=array(
54 | 'access_token'=>$this->access_token
55 | );
56 | $url='https://graph.qq.com/oauth2.0/me?'.http_build_query($params);
57 | $result_str=$this->http($url);
58 | $json_r=array();
59 | if($result_str!=''){
60 | preg_match('/callback\(\s+(.*?)\s+\)/i', $result_str, $result_a);
61 | $json_r=json_decode($result_a[1], true);
62 | }
63 | return $json_r;
64 | }
65 |
66 | //根据openid获取用户信息
67 | public function get_user_info($openid){
68 | $params=array(
69 | 'openid'=>$openid
70 | );
71 | return $this->api('user/get_user_info', $params);
72 | }
73 |
74 | //发布分享
75 | public function add_share($openid, $title, $url, $site, $fromurl, $images='', $summary=''){
76 | $params=array(
77 | 'openid'=>$openid,
78 | 'title'=>$title,
79 | 'url'=>$url,
80 | 'site'=>$site,
81 | 'fromurl'=>$fromurl,
82 | 'images'=>$images,
83 | 'summary'=>$summary
84 | );
85 | return $this->api('share/add_share', $params, 'POST');
86 | }
87 |
88 | //调用接口
89 | /**
90 | //示例:根据openid获取用户信息
91 | $result=$qq->api('user/get_user_info', array('openid'=>$openid), 'GET');
92 | **/
93 | public function api($url, $params=array(), $method='GET'){
94 | $url=$this->api_url.$url;
95 | $params['access_token']=$this->access_token;
96 | $params['oauth_consumer_key']=$this->appid;
97 | $params['format']='json';
98 | if($method=='GET'){
99 | $result_str=$this->http($url.'?'.http_build_query($params));
100 | }else{
101 | $result_str=$this->http($url, http_build_query($params), 'POST');
102 | }
103 | $result=array();
104 | if($result_str!='')$result=json_decode($result_str, true);
105 | return $result;
106 | }
107 |
108 | //提交请求
109 | private function http($url, $postfields='', $method='GET', $headers=array()){
110 | $ci=curl_init();
111 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
112 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
113 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
114 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
115 | if($method=='POST'){
116 | curl_setopt($ci, CURLOPT_POST, TRUE);
117 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
118 | }
119 | $headers[]='User-Agent: QQ.PHP(piscdong.com)';
120 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
121 | curl_setopt($ci, CURLOPT_URL, $url);
122 | $response=curl_exec($ci);
123 | curl_close($ci);
124 | return $response;
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/s_special.php:
--------------------------------------------------------------------------------
1 | 0){
25 | foreach($a_mgc as $v){
26 | if(trim($v)!='')$at_mgc[trim($v)]=trim($v);
27 | }
28 | }
29 | $nmgc=$g_name=htmlspecialchars(trim($_POST['mgc']),ENT_QUOTES);
30 | $at_mgc[trim($nmgc)]=trim($nmgc);
31 | $mgc_c="'设置已修改。', '敏感词已保存。', '敏感词过滤功能已关闭。');
46 | $is_disa=$config['open']>0?'':' disabled="disabled"';
47 | $content.=((isset($_GET['e']) && isset($a_msg[$_GET['e']]))?''.$a_msg[$_GET['e']].'
':'').'访客账号
基于某些特殊原因,部分主管部门或者相关机构可能会要求审查内容,在没有开放访问的情况下可以通过开启访客账号来提供给相关部门进行审查。
此功能只有在不开放访问时生效。
'.($config['open']>0?'
':'').'';
48 | if($config['open']>0)$content.=' ';
49 | if($config['g_vdate']>0)$content.='
最后使用:'.date('Y-n-j H:i', $config['g_vdate']);
50 | if($config['g_vc']>0)$content.='
使用次数:'.$config['g_vc'];
51 | if($config['g_ip_i']>0){
52 | $ip=long2ip($config['g_ip_i']);
53 | $content.='
最后IP:'.($config['ip']!=''?str_replace('[ip]', $ip, $config['ip']):$ip);
54 | }
55 | $content.='
敏感词过滤
基于某些特殊原因,部分服务器开启了敏感词过滤功能。遗憾的是部分过滤功能并不完善,在过滤的时候并不是过滤敏感词本身,而是把整个网页都屏蔽掉,导致无法再进行删、改等操作。在遇到这种情况的时候可以使用这一功能,将敏感词输入下面的表单增加到敏感词列表,这样程序将会在敏感词显示之前就先替换掉。
为了保证这个设置页面的显示,敏感词列表中的内容并不会显示,而是保存在程序安装目录下的
'.$mgc_file.' 中,可以通过ftp下载此文件进行修改。
建议管理员将此设置页面添加到收藏夹,当首页因出现敏感词被屏蔽后可以方便的访问这个页面进行设置,或者直接通过ftp下载
'.$mgc_file.' 进行修改。
';
56 | if(!isset($a_mgc) || count($a_mgc)==0){
57 | $content.='当前此功能并未开启,如需开启请直接通过下表增加敏感词。
';
58 | }else{
59 | $content.='当前此功能已开启,如需关闭请点击“关闭敏感词过滤”或者直接通过ftp删除
'.$mgc_file.' 。
增加敏感词';
60 | }
61 | $content.='
';
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/default.css:
--------------------------------------------------------------------------------
1 | .extr {
2 | clear: both;
3 | }
4 | .formline {
5 | padding: 2px;
6 | padding-left: 10px;
7 | }
8 | .f_link {
9 | cursor: pointer;
10 | }
11 | .al_list {
12 | float: left;
13 | }
14 | .cp_t {
15 | background: url(images/cpbg.gif) no-repeat top left;
16 | padding: 3px 5px 5px 3px;
17 | }
18 | .photo_list {
19 | width: 100px;
20 | height: 80px;
21 | float: left;
22 | }
23 | .pr_img {
24 | filter: alpha(opacity=50);
25 | opacity: .5;
26 | }
27 | #al_ajaxdiv img {
28 | padding-right: 2px;
29 | }
30 | #chat_div {
31 | position: absolute;
32 | z-index: 100;
33 | padding: 0;
34 | }
35 | .chat_div {
36 | width: 320px;
37 | background: #671;
38 | border: 1px solid #671;
39 | float: right;
40 | text-align: left;
41 | margin-left: 5px;
42 | margin-bottom: 5px;
43 | font: 12px Verdana, arial, Helvetica, sans-serif;
44 | }
45 | .chat_div_t {
46 | padding: 2px;
47 | padding-left: 15px;
48 | background: #671 url(images/chat.gif) no-repeat left center;
49 | color: #fff;
50 | }
51 | .chat_div_t img {
52 | float: right;
53 | margin-top: 1px;
54 | }
55 | .chat_div_i {
56 | background: #fff;
57 | height: 200px;
58 | padding: 5px;
59 | overflow: auto;
60 | color: #333;
61 | }
62 | .chat_div_in {
63 | padding: 3px;
64 | text-align: center;
65 | }
66 | .chat_in {
67 | width: 290px;
68 | background: #fff url(images/keyb.gif) no-repeat left center;
69 | padding-left: 22px;
70 | border: 0;
71 | }
72 | .chat_list {
73 | margin-bottom: 3px;
74 | padding: 3px;
75 | }
76 | .chat_list div {
77 | padding-top: 3px;
78 | padding-bottom: 5px;
79 | font-size: 10px;
80 | }
81 | .chat_t_0 {
82 | background: #f0f8cf url(images/chat_bg_2.gif) no-repeat right bottom;
83 | margin-left: 80px;
84 | }
85 | .chat_t_0 div {
86 | color: #671;
87 | text-align: right;
88 | }
89 | .chat_t_1 {
90 | background: #d9ecff url(images/chat_bg_1.gif) no-repeat left bottom;
91 | margin-right: 80px;
92 | }
93 | .chat_t_1 div {
94 | color: #036;
95 | }
96 | .msg_t_0, .msg_t_1 {
97 | margin-top: 10px;
98 | border-bottom: 5px solid #eee;
99 | padding: 10px;
100 | color: #000;
101 | border-radius: 15px;
102 | }
103 | .msg_t_0 a, .msg_t_1 a {
104 | color: #000;
105 | }
106 | .msg_t_0 {
107 | background: #f0f8cf;
108 | margin-left: 200px;
109 | }
110 | .msg_t_1 {
111 | background: #d9ecff;
112 | margin-right: 200px;
113 | }
114 | .msg_b_0, .msg_b_1 {
115 | margin-top: -5px;
116 | margin-bottom: 10px;
117 | height: 25px;
118 | line-height: 25px;
119 | overflow: hidden;
120 | }
121 | .msg_b_0 {
122 | background: url(images/msg_bg_0.gif) no-repeat right top;
123 | }
124 | .msg_b_1 {
125 | background: url(images/msg_bg_1.gif) no-repeat top left;
126 | }
127 | .msg_d {
128 | text-align: right;
129 | color: #666;
130 | }
131 | .ulist {
132 | list-style-type: none;
133 | margin: 0;
134 | padding: 0;
135 | }
136 | .ulist li {
137 | display: block;
138 | float: left;
139 | width: 205px;
140 | height: 180px;
141 | padding: 5px;
142 | margin: 7px;
143 | overflow: auto;
144 | }
145 | .msg_nlist {
146 | float: left;
147 | width: 150px;
148 | }
149 | .sync_list {
150 | padding: 3px;
151 | padding-left: 18px;
152 | background-position: top left;
153 | background-repeat: no-repeat;
154 | }
155 | .file_list {
156 | padding: 3px;
157 | padding-left: 18px;
158 | background-position: left center;
159 | background-repeat: no-repeat;
160 | }
161 | .pr_ld_img {
162 | width: 70px;
163 | height: 70px;
164 | float: left;
165 | margin-left: 2px;
166 | background-position: center;
167 | background-repeat: no-repeat;
168 | }
169 | #lightbox_bg, #lightbox_img, #lightbox_c {
170 | position: absolute;
171 | top: 0;
172 | left: 0;
173 | display: none;
174 | }
175 | #lightbox_bg {
176 | background: #000;
177 | z-index: 100;
178 | filter:alpha(opacity=50);
179 | -moz-opacity:0.5;
180 | -khtml-opacity: 0.5;
181 | opacity: 0.5;
182 | }
183 | #lightbox_img {
184 | background: #fff;
185 | z-index: 200;
186 | padding: 5px;
187 | }
188 | #lightbox_c {
189 | color: #fff;
190 | z-index: 200;
191 | }
192 | .login_td {
193 | background-repeat: no-repeat;
194 | background-position: center center;
195 | padding-top: 30px;
196 | padding-bottom: 30px;
197 | }
198 | .loading_va {
199 | width: 100px;
200 | height: 4px;
201 | border: 1px solid #999;
202 | background: url(images/loading_w.gif);
203 | }
--------------------------------------------------------------------------------
/lib/lunar.php:
--------------------------------------------------------------------------------
1 | _LStart || $month<=0 || $day<=0 || $year>=2051)return false;
55 | $date1=strtotime($year.'-01-01');
56 | $date2=strtotime($year.'-'.$month.'-'.$day);
57 | $days=round(($date2-$date1)/86400);
58 | $days+=1;
59 | $Larray=$this->_LMDay[$year-$this->_LStart];
60 | if($days<=$Larray[0]){
61 | $Lyear=$year-1;
62 | $days=$Larray[0]-$days;
63 | $Larray=$this->_LMDay[$Lyear-$this->_LStart];
64 | if($days<$Larray[12]){
65 | $Lmonth=12;
66 | $Lday=$Larray[12]-$days;
67 | }else{
68 | $Lmonth=11;
69 | $days=$days-$Larray[12];
70 | $Lday=$Larray[11]-$days;
71 | }
72 | }else{
73 | $Lyear=$year;
74 | $days=$days-$Larray[0];
75 | for($i=1;$i<=12;$i++){
76 | if($days>$Larray[$i]){
77 | $days=$days-$Larray[$i];
78 | }else{
79 | if($days>30){
80 | $days=$days-$Larray[13];
81 | $Ltype=1;
82 | }
83 | $Lmonth=$i;
84 | $Lday=$days;
85 | break;
86 | }
87 | }
88 | }
89 | return array($Lmonth, $Lday);
90 | }
91 |
92 | public function LYearName($year){
93 | $Name=array('零','一','二','三','四','五','六','七','八','九');
94 | $j=strlen($year);
95 | $tmp='';
96 | for($i=0;$i<$j;$i++){
97 | for($k=0;$k<10;$k++){
98 | if($year[$i]==$k)$tmp.=$Name[$k];
99 | }
100 | }
101 | return $tmp;
102 | }
103 |
104 | public function LMonName($month){
105 | if($month>=1 && $month<=12){
106 | $Name=array(1=>'正','二','三','四','五','六','七','八','九','十','十一','十二');
107 | return $Name[$month];
108 | }
109 | return $month;
110 | }
111 |
112 | public function LDayName($day){
113 | if($day>=1 && $day<=30){
114 | $Name=array(1=>'初一','初二','初三','初四','初五','初六','初七','初八','初九','初十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','廿一','廿二','廿三','廿四','廿五','廿六','廿七','廿八','廿九','三十');
115 | return $Name[$day];
116 | }
117 | return $day;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/m/message.php:
--------------------------------------------------------------------------------
1 | 0)?intval($_GET['page']):1;
13 | if(isset($_GET['id']) && intval($_GET['id'])>0 && intval($_GET['id'])!=$_SESSION[$config['u_hash']] && getainfo(intval($_GET['id']), 'id')){
14 | $tid=intval($_GET['id']);
15 | $tn=getainfo($tid, 'name');
16 | $title.=' - '.$tn['name'];
17 | if($_SERVER['REQUEST_METHOD']=='POST'){
18 | $cont=htmlspecialchars(trim($_POST['rinfo']),ENT_QUOTES);
19 | if($cont!=''){
20 | $i_db=sprintf('insert into %s (content, aid, tid, datetime, readed) values (%s, %s, %s, %s, 1)', $dbprefix.'message',
21 | SQLString($cont, 'text'),
22 | $_SESSION[$config['u_hash']],
23 | $tid,
24 | time());
25 | $result=mysql_query($i_db) or die('');
26 | }
27 | header('Location:./?m=message&id='.$tid);
28 | exit();
29 | }else{
30 | $content.='发消息 - 收件人:'.$tn['name'].'
';
31 | $s_a_dbg=sprintf('select * from %s where (aid=%s and tid=%s) or (tid=%s and aid=%s) order by datetime desc', $dbprefix.'message', $tid, $_SESSION[$config['u_hash']], $tid, $_SESSION[$config['u_hash']]);
32 | $q_a_dbg=mysql_query($s_a_dbg) or die('');
33 | $c_dbg=mysql_num_rows($q_a_dbg);
34 | if($c_dbg>0){
35 | $content.='聊天记录
';
36 | $p_dbg=ceil($c_dbg/$config['pagesize']);
37 | if($page>$p_dbg)$page=$p_dbg;
38 | $s_dbg=sprintf('%s limit %d, %d', $s_a_dbg, ($page-1)*$config['pagesize'], $config['pagesize']);
39 | $q_dbg=mysql_query($s_dbg) or die('');
40 | $r_dbg=mysql_fetch_assoc($q_dbg);
41 | do{
42 | $content.=''.($r_dbg['aid']==$_SESSION[$config['u_hash']]?'我':'
'.$tn['name'].' ').':'.mbookencode($r_dbg['content']).($r_dbg['readed']>0?'
':'').'
'.getldate($r_dbg['datetime']).'
';
43 | if($r_dbg['readed']>0 && $r_dbg['tid']==$_SESSION[$config['u_hash']]){
44 | $u_db=sprintf('update %s set readed=0 where id=%s', $dbprefix.'message', $r_dbg['id']);
45 | $result=mysql_query($u_db) or die('');
46 | }
47 | }while($r_dbg=mysql_fetch_assoc($q_dbg));
48 | mysql_free_result($q_dbg);
49 | $content.='';
50 | if($p_dbg>1)$content.=getpage($page, $p_dbg);
51 | }
52 | mysql_free_result($q_a_dbg);
53 | }
54 | }else{
55 | $title.=' - 收件箱';
56 | $s_a_dbg=sprintf('select a.*, b.name from %s as a, %s as b where a.tid=%s and a.aid=b.id order by a.datetime desc', $dbprefix.'message', $dbprefix.'member', $_SESSION[$config['u_hash']]);
57 | $q_a_dbg=mysql_query($s_a_dbg) or die('');
58 | $c_dbg=mysql_num_rows($q_a_dbg);
59 | if($c_dbg>0){
60 | $p_dbg=ceil($c_dbg/$config['pagesize']);
61 | if($page>$p_dbg)$page=$p_dbg;
62 | $s_dbg=sprintf('%s limit %d, %d', $s_a_dbg, ($page-1)*$config['pagesize'], $config['pagesize']);
63 | $q_dbg=mysql_query($s_dbg) or die('');
64 | $r_dbg=mysql_fetch_assoc($q_dbg);
65 | $content.='收件箱
';
66 | do{
67 | $content.=''.$r_dbg['name'].' 致 我'.($r_dbg['readed']>0?'
':'').' '.getldate($r_dbg['datetime']).'
'.mbookencode($r_dbg['content']).'
';
68 | if($r_dbg['readed']>0){
69 | $u_db=sprintf('update %s set readed=0 where id=%s', $dbprefix.'message', $r_dbg['id']);
70 | $result=mysql_query($u_db) or die('');
71 | }
72 | }while($r_dbg=mysql_fetch_assoc($q_dbg));
73 | mysql_free_result($q_dbg);
74 | if($p_dbg>1)$content.=getpage($page, $p_dbg);
75 | }else{
76 | $content.='短消息
没有短消息
';
77 | }
78 | mysql_free_result($q_a_dbg);
79 | }
80 | }else{
81 | header('Location:./');
82 | exit();
83 | }
84 |
--------------------------------------------------------------------------------
/lib/sina.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
14 | $this->client_secret=$client_secret;
15 | $this->access_token=$access_token;
16 | }
17 |
18 | //生成授权网址
19 | public function login_url($callback_url){
20 | $params=array(
21 | 'response_type'=>'code',
22 | 'client_id'=>$this->client_id,
23 | 'redirect_uri'=>$callback_url
24 | );
25 | return 'https://api.weibo.com/oauth2/authorize?'.http_build_query($params);
26 | }
27 |
28 | //获取access token
29 | public function access_token($callback_url, $code){
30 | $params=array(
31 | 'grant_type'=>'authorization_code',
32 | 'code'=>$code,
33 | 'client_id'=>$this->client_id,
34 | 'client_secret'=>$this->client_secret,
35 | 'redirect_uri'=>$callback_url
36 | );
37 | $url='https://api.weibo.com/oauth2/access_token';
38 | return $this->http($url, http_build_query($params), 'POST');
39 | }
40 |
41 | /**
42 | //使用refresh token获取新的access token,新浪微博暂时不支持
43 | public function access_token_refresh($refresh_token){
44 | }
45 | **/
46 |
47 | //获取登录用户的uid
48 | public function get_uid(){
49 | $params=array();
50 | return $this->api('account/get_uid', $params);
51 | }
52 |
53 | //根据uid获取用户信息
54 | public function show_user_by_id($uid){
55 | $params=array(
56 | 'uid'=>$uid
57 | );
58 | return $this->api('users/show', $params);
59 | }
60 |
61 | //发布微博
62 | public function update($img_c, $pic=''){
63 | $params=array(
64 | 'status'=>$img_c
65 | );
66 | if($pic!='' && is_array($pic)){
67 | $url='statuses/upload';
68 | $params['pic']=$pic;
69 | }else{
70 | $url='statuses/update';
71 | }
72 | return $this->api($url, $params, 'POST');
73 | }
74 |
75 | //根据uid获取用户微博列表
76 | public function user_timeline($uid, $count=10, $page=1){
77 | $params=array(
78 | 'uid'=>$uid,
79 | 'page'=>$page,
80 | 'count'=>$count
81 | );
82 | return $this->api('statuses/user_timeline', $params);
83 | }
84 |
85 | //调用接口
86 | /**
87 | //示例:根据uid获取用户信息
88 | $result=$sina->api('users/show', array('uid'=>$uid), 'GET');
89 | **/
90 | public function api($url, $params=array(), $method='GET'){
91 | $url=$this->api_url.$url.'.'.$this->format;
92 | $params['access_token']=$this->access_token;
93 | if($method=='GET'){
94 | $result=$this->http($url.'?'.http_build_query($params));
95 | }else{
96 | if(isset($params['pic'])){
97 | uksort($params, 'strcmp');
98 | $str_b=uniqid('------------------');
99 | $str_m='--'.$str_b;
100 | $str_e=$str_m. '--';
101 | $body='';
102 | foreach($params as $k=>$v){
103 | if($k=='pic'){
104 | if(is_array($v)){
105 | $img_c=$v[2];
106 | $img_n=$v[1];
107 | }elseif($v{0}=='@'){
108 | $url=ltrim($v, '@');
109 | $img_c=file_get_contents($url);
110 | $url_a=explode('?', basename($url));
111 | $img_n=$url_a[0];
112 | }
113 | $body.=$str_m."\r\n";
114 | $body.='Content-Disposition: form-data; name="'.$k.'"; filename="'.$img_n.'"'."\r\n";
115 | $body.="Content-Type: image/unknown\r\n\r\n";
116 | $body.=$img_c."\r\n";
117 | }else{
118 | $body.=$str_m."\r\n";
119 | $body.='Content-Disposition: form-data; name="'.$k.'"'."\r\n\r\n";
120 | $body.=$v."\r\n";
121 | }
122 | }
123 | $body.=$str_e;
124 | $headers[]='Content-Type: multipart/form-data; boundary='.$str_b;
125 | $result=$this->http($url, $body, 'POST', $headers);
126 | }else{
127 | $result=$this->http($url, http_build_query($params), 'POST');
128 | }
129 | }
130 | return $result;
131 | }
132 |
133 | //提交请求
134 | private function http($url, $postfields='', $method='GET', $headers=array()){
135 | $ci=curl_init();
136 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
137 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
138 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
139 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
140 | if($method=='POST'){
141 | curl_setopt($ci, CURLOPT_POST, TRUE);
142 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
143 | }
144 | $headers[]='User-Agent: weibo.PHP(piscdong.com)';
145 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
146 | curl_setopt($ci, CURLOPT_URL, $url);
147 | $response=curl_exec($ci);
148 | curl_close($ci);
149 | $json_r=array();
150 | if($response!='')$json_r=json_decode($response, true);
151 | return $json_r;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/skin/blue/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 10px;
3 | background: #fff url(bbg.jpg) repeat-x left top;
4 | }
5 | body, td, input, textarea, select {
6 | font: 13px Verdana, arial, Helvetica, sans-serif;
7 | color: #333;
8 | }
9 | img {
10 | border: 0;
11 | }
12 | a {
13 | color: #369;
14 | }
15 | a:hover {
16 | text-decoration: none;
17 | color: #333;
18 | }
19 | form {
20 | margin: 0;
21 | }
22 | textarea {
23 | width: 550px;
24 | background: #fff url(ebg.jpg) no-repeat right bottom;
25 | border: 1px solid #ccc;
26 | padding: 2px;
27 | }
28 | #top {
29 | padding: 10px;
30 | }
31 | #logo {
32 | padding-left: 20px;
33 | font-size: 4em;
34 | font-weight: bold;
35 | color: #036;
36 | }
37 | #logo a {
38 | color: #036;
39 | text-decoration: none;
40 | }
41 | #menu {
42 | padding: 3px;
43 | color: #69c;
44 | text-align: right;
45 | }
46 | #menu a {
47 | text-decoration: none;
48 | color: #69c;
49 | }
50 | #menu a:hover, #menu #mn {
51 | color: #036;
52 | }
53 | .button {
54 | background: #369;
55 | color: #fff;
56 | border: 0;
57 | padding: 3px;
58 | font-weight: bold;
59 | }
60 | #foot {
61 | border-top: 1px solid #eee;
62 | color: #aaa;
63 | padding: 15px;
64 | font-size: 11px;
65 | margin-top: 20px;
66 | }
67 | #foot a {
68 | color: #aaa;
69 | }
70 | #main {
71 | padding: 5px;
72 | }
73 | .lmenu {
74 | padding: 5px;
75 | }
76 | .lmenu ul, .clist, .lcontent ul, .kcontent ul, .scontent ul {
77 | list-style-type: none;
78 | margin: 0;
79 | padding: 0;
80 | }
81 | .lmenu ul li {
82 | font-weight: bold;
83 | padding: 2px;
84 | padding-top: 10px;
85 | clear: left;
86 | }
87 | .lmenu ol {
88 | list-style-type: none;
89 | margin: 0;
90 | padding-left: 10px;
91 | }
92 | .lmenu ol li {
93 | font-size: 13px;
94 | padding: 1px;
95 | font-weight: normal;
96 | clear: left;
97 | }
98 | .ulist li {
99 | background: #fff url(ubg.jpg) no-repeat left top;
100 | }
101 | .utitle {
102 | font-size: 1.2em;
103 | font-weight: bold;
104 | }
105 | .rcontent {
106 | width: 100%;
107 | float: right;
108 | margin-left: -160px;
109 | }
110 | .content {
111 | padding: 10px;
112 | padding-left: 15px;
113 | margin-left: 165px;
114 | }
115 | .navdiv {
116 | padding: 5px;
117 | text-align: center;
118 | }
119 | .clist li {
120 | margin-bottom: 20px;
121 | }
122 | .title {
123 | font-weight: bold;
124 | background: #fff url(tbg.jpg) no-repeat left top;
125 | color: #036;
126 | padding: 4px;
127 | font-size: 14px;
128 | }
129 | .title a {
130 | color: #036;
131 | }
132 | .tcontent {
133 | padding-left: 20px;
134 | padding-right: 20px;
135 | }
136 | .gcontent, .lcontent, .kcontent, .scontent {
137 | background: #fff;
138 | }
139 | .gcontent {
140 | padding: 5px;
141 | }
142 | .lcontent, .kcontent, .scontent {
143 | padding: 10px;
144 | }
145 | .lcontent ul li {
146 | margin: 0;
147 | padding: 5px;
148 | font-size: 1.2em;
149 | font-weight: bold;
150 | }
151 | .kcontent li {
152 | clear: both;
153 | }
154 | .mcontent {
155 | padding: 5px;
156 | font-size: 1.2em;
157 | font-weight: bold;
158 | text-align: center;
159 | border: 1px solid #9cf;
160 | background: #fff;
161 | }
162 | .gdate, .gmod, .reply_i {
163 | font-weight: normal;
164 | font-size: 11px;
165 | color: #369;
166 | }
167 | .gmod {
168 | display: block;
169 | float: right;
170 | padding-right: 8px;
171 | }
172 | .mlink {
173 | border-bottom: 1px solid #369;
174 | color: #369;
175 | }
176 | .al_t, .del_al_t {
177 | padding: 2px;
178 | margin: 5px;
179 | background: #fff;
180 | }
181 | .photo, .al_t {
182 | border: 1px solid #9cf;
183 | }
184 | .del_al_t {
185 | border: 1px solid #900;
186 | }
187 | .al_list {
188 | margin: 5px;
189 | }
190 | .message_n, .del_n {
191 | font-weight: bold;
192 | color: #900;
193 | }
194 | .msg_v {
195 | margin: 20px;
196 | margin-top: 0;
197 | padding: 10px;
198 | border: 1px solid #9cf;
199 | font-weight: bold;
200 | color: #900;
201 | background: #fff;
202 | }
203 | .reply_d {
204 | margin-left: 5px;
205 | margin-top: 10px;
206 | border-top: 1px solid #cce5ff;
207 | }
208 | .reply_v {
209 | border-bottom: 1px solid #cce5ff;
210 | padding: 10px;
211 | }
212 | .reply_i {
213 | text-align: right;
214 | }
215 | .skin_sdiv {
216 | padding-left: 10px;
217 | }
218 | .skin_sdiv img {
219 | border: 1px solid #cce5ff;
220 | padding: 1px;
221 | margin: 3px;
222 | }
223 | #skinlist li {
224 | float: left;
225 | width: 135px;
226 | height: 120px;
227 | text-align: center;
228 | }
229 | .skin_img {
230 | margin: 3px;
231 | padding: 2px;
232 | border: 1px solid #cce5ff;
233 | }
234 | .l_list {
235 | background: #fff url(lbg.jpg) no-repeat left top;
236 | padding: 5px;
237 | }
238 | .photo {
239 | float: left;
240 | padding: 1px;
241 | background: #fff;
242 | }
243 | .list_r {
244 | margin-left: 60px;
245 | padding: 2px;
246 | }
247 | .list_title {
248 | font-weight: bold;
249 | padding: 4px;
250 | padding-top: 0;
251 | padding-bottom: 10px;
252 | color: #036;
253 | font-size: 14px;
254 | }
255 | .list_title a{
256 | color: #036;
257 | }
258 | .list_c {
259 | padding: 6px;
260 | }
--------------------------------------------------------------------------------
/m/user.php:
--------------------------------------------------------------------------------
1 | 0){
11 | $odb=$config['veri']>0?'':' and status=0';
12 | $s_dbu=sprintf('select id, name, photo, rela, gender, bir_y, bir_m, bir_d, url, email, phone, work, tel, qq, msn, gtalk, address, location, gid, regdate, jaid, visitdate, visit from %s where id=%s%s limit 1', $dbprefix.'member', intval($_GET['id']), $odb);
13 | $q_dbu=mysql_query($s_dbu) or die('');
14 | $r_dbu=mysql_fetch_assoc($q_dbu);
15 | if(mysql_num_rows($q_dbu)>0){
16 | $title.=$r_dbu['name'];
17 | $content.=''.$r_dbu['name'].'
';
18 | $s_dbo=sprintf('select aid from %s where aid=%s and online=1 limit 1', $dbprefix.'online', $r_dbu['id']);
19 | $q_dbo=mysql_query($s_dbo) or die('');
20 | if(mysql_num_rows($q_dbo)>0)$content.='当前在线
';
21 | mysql_free_result($q_dbo);
22 | if($c_log){
23 | if(trim($r_dbu['photo'])!=''){
24 | $content.='
';
25 | $a_pho=explode('|', trim($r_dbu['photo']));
26 | $m_pho=$config['avator']>0?$config['avator']:1;
27 | foreach($a_pho as $k=>$v){
28 | if($k<$m_pho)$content.=' ';
29 | }
30 | $content.=' ';
31 | }
32 | if($_SESSION[$config['u_hash']]!=$r_dbu['id'])$content.='
发短信 ';
33 | if($r_dbu['rela']!='')$content.=$r_dbu['rela'].'
';
34 | if($r_dbu['gender']>0)$content.='性别:'.($r_dbu['gender']==1?'帅哥':'美女').'
';
35 | if($r_dbu['bir_m']>0 && $r_dbu['bir_d']>0)$content.='生日:'.($r_dbu['bir_y']>0?$r_dbu['bir_y'].'-':'').$r_dbu['bir_m'].'-'.$r_dbu['bir_d'].'
';
36 | if($r_dbu['url']!='')$content.='主页:
'.$r_dbu['url'].' ';
37 | if($r_dbu['email']!='')$content.='邮箱:
'.$r_dbu['email'].' ';
38 | if($r_dbu['phone']!='')$content.='手机:'.$r_dbu['phone'].'
';
39 | if($r_dbu['work']!='')$content.='工作单位:'.$r_dbu['work'].'
';
40 | if($r_dbu['tel']!='')$content.='联系电话:'.$r_dbu['tel'].'
';
41 | if($r_dbu['qq']!='')$content.='QQ:'.$r_dbu['qq'].'
';
42 | if($r_dbu['msn']!='')$content.='MSN:'.$r_dbu['msn'].'
';
43 | if($r_dbu['gtalk']!='')$content.='GTalk:'.$r_dbu['gtalk'].'
';
44 | if($r_dbu['address']!='')$content.='住址:'.$r_dbu['address'].'
';
45 | if($r_dbu['location']!='')$content.='籍贯:'.$r_dbu['location'].'
';
46 | if(isset($g_a[$r_dbu['gid']]))$content.='身份:'.$g_a[$r_dbu['gid']].'
';
47 | $content.='注册日期:'.date('Y-n-j H:i', getftime($r_dbu['regdate'])).'
';
48 | if($r_dbu['jaid']>0){
49 | $jadb=getainfo($r_dbu['jaid'], 'name');
50 | $content.='邀请人:
'.$jadb['name'].' ';
51 | }
52 | }
53 | $content.='最后访问:'.($r_dbu['visitdate']>0?date('Y-n-j H:i', $r_dbu['visitdate']):'从未').($r_dbu['visit']>0?'
访问次数:'.$r_dbu['visit']:'').'
';
54 | }else{
55 | header('Location:./?m=user');
56 | exit();
57 | }
58 | mysql_free_result($q_dbu);
59 | }else{
60 | $title.='班级成员';
61 | $odb=$config['veri']>0?'':' where status=0';
62 | $s_dbu=sprintf('select id, name, rela, gender, phone, gid, regdate, jaid, visitdate, visit from %s%s order by visitdate desc', $dbprefix.'member', $odb);
63 | $q_dbu=mysql_query($s_dbu) or die('');
64 | $r_dbu=mysql_fetch_assoc($q_dbu);
65 | if(mysql_num_rows($q_dbu)>0){
66 | do{
67 | $jadb[$r_dbu['id']]=$r_dbu;
68 | $content.=''.$r_dbu['name'].' ';
69 | $s_dbo=sprintf('select aid from %s where aid=%s and online=1 limit 1', $dbprefix.'online', $r_dbu['id']);
70 | $q_dbo=mysql_query($s_dbo) or die('');
71 | if(mysql_num_rows($q_dbo)>0)$content.=' 当前在线';
72 | mysql_free_result($q_dbo);
73 | $content.='
';
74 | if($c_log){
75 | if($_SESSION[$config['u_hash']]!=$r_dbu['id'])$content.='
发短信 ';
76 | if($r_dbu['rela']!='')$content.=$r_dbu['rela'].'
';
77 | if($r_dbu['gender']>0)$content.='性别:'.($r_dbu['gender']==1?'帅哥':'美女').'
';
78 | if($r_dbu['phone']!='')$content.='手机:'.$r_dbu['phone'].'
';
79 | if(isset($g_a[$r_dbu['gid']]))$content.='身份:'.$g_a[$r_dbu['gid']].'
';
80 | $content.='注册日期:'.date('Y-n-j H:i', getftime($r_dbu['regdate'])).'
';
81 | if($r_dbu['jaid']>0){
82 | if(!isset($jadb[$r_dbu['jaid']]))$jadb[$r_dbu['jaid']]=getainfo($r_dbu['jaid'], 'name');
83 | $content.='邀请人:
'.$jadb[$r_dbu['jaid']]['name'].' ';
84 | }
85 | }
86 | $content.='最后访问:'.($r_dbu['visitdate']>0?date('Y-n-j H:i', getftime($r_dbu['visitdate'])):'从未').($r_dbu['visit']>0?'
访问次数:'.$r_dbu['visit']:'').(($c_log && $_SESSION[$config['u_hash']]!=$r_dbu['id'])?'
发短信 ':'').'
';
87 | }while($r_dbu=mysql_fetch_assoc($q_dbu));
88 | }else{
89 | header('Location:./');
90 | exit();
91 | }
92 | mysql_free_result($q_dbu);
93 | }
94 |
--------------------------------------------------------------------------------
/m/album.php:
--------------------------------------------------------------------------------
1 | 0)?intval($_GET['page']):1;
11 | $pagesize=50;
12 | if(isset($_GET['id']) && intval($_GET['id'])>0){
13 | $s_dbp=sprintf('select a.*, b.power, b.name from %s as a, %s as b where a.id=%s and a.aid=b.id and a.disp=0 limit 1', $dbprefix.'photo', $dbprefix.'member', intval($_GET['id']));
14 | $q_dbp=mysql_query($s_dbp) or die('');
15 | $r_dbp=mysql_fetch_assoc($q_dbp);
16 | if(mysql_num_rows($q_dbp)>0){
17 | if($_SERVER['REQUEST_METHOD']=='POST' && $c_log){
18 | $cont=htmlspecialchars(trim($_POST['rinfo']),ENT_QUOTES);
19 | if($cont!=''){
20 | $i_db=sprintf('insert into %s (content, aid, pid, datetime) values (%s, %s, %s, %s)', $dbprefix.'pcomment',
21 | SQLString($cont, 'text'),
22 | $_SESSION[$config['u_hash']],
23 | $r_dbp['id'],
24 | time());
25 | $result=mysql_query($i_db) or die('');
26 | $nid=mysql_insert_id();
27 | setsinfo($pn.' 发表评论', $r_dbp['aid'], $r_dbp['id'], 2);
28 | }
29 | header('Location:./?m=album&id='.$r_dbp['id'].(isset($nid)?'#topic-'.$nid:''));
30 | exit();
31 | }else{
32 | $t=$r_dbp['title']!=''?$r_dbp['title']:($r_dbp['vid']>0?'视频':'照片').' #'.$r_dbp['id'];
33 | $title.=$t;
34 | $u=$r_dbp['url'];
35 | if($r_dbp['upload']==0){
36 | $tb_i='';
37 | if(strstr($u, '[/]')){
38 | $a_u=explode('[/]', $u);
39 | $l_u=count($a_u)-1;
40 | $t_u=$a_u[$l_u];
41 | if(trim($t_u)!='' && strstr(trim($t_u), '://')){
42 | $tb_i=trim($t_u);
43 | unset($a_u[$l_u]);
44 | }
45 | $u=join('[/]', $a_u);
46 | }
47 | }
48 | $content.=''.$t.'
'.$r_dbp['name'].' '.getldate($r_dbp['datetime']).'
'.($r_dbp['vid']>0?$u:'
');
49 | if($r_dbp['cid']>0){
50 | $s_dbc=sprintf('select id, title from %s where id=%s and disp=0 limit 1', $dbprefix.'camp', $r_dbp['cid']);
51 | $q_dbc=mysql_query($s_dbc) or die('');
52 | $r_dbc=mysql_fetch_assoc($q_dbc);
53 | if(mysql_num_rows($q_dbc)>0)$content.='
相关活动:
'.$r_dbc['title'].' ';
54 | mysql_free_result($q_dbc);
55 | }
56 | $content.='
';
57 | $s_a_dbr=sprintf('select a.id, a.aid, a.content, a.datetime, b.name from %s as a, %s as b where a.pid=%s and a.aid=b.id and a.disp=0 order by a.datetime desc', $dbprefix.'pcomment', $dbprefix.'member', $r_dbp['id']);
58 | $q_a_dbr=mysql_query($s_a_dbr) or die('');
59 | $c_dbr=mysql_num_rows($q_a_dbr);
60 | if($c_dbr>0){
61 | $p_dbr=ceil($c_dbr/$config['pagesize']);
62 | if($page>$p_dbr)$page=$p_dbr;
63 | $s_dbr=sprintf('%s limit %d, %d', $s_a_dbr, ($page-1)*$config['pagesize'], $config['pagesize']);
64 | $q_dbr=mysql_query($s_dbr) or die('');
65 | $r_dbr=mysql_fetch_assoc($q_dbr);
66 | do{
67 | $content.='';
68 | }while($r_dbr=mysql_fetch_assoc($q_dbr));
69 | mysql_free_result($q_dbr);
70 | }
71 | mysql_free_result($q_a_dbr);
72 | if(isset($p_dbr) && $p_dbr>1)$content.=getpage($page, $p_dbt);
73 | if($c_log)$content.='发表评论
';
74 | }
75 | }else{
76 | header('Location:./');
77 | exit();
78 | }
79 | mysql_free_result($q_dbp);
80 | }else{
81 | $title.='照片视频';
82 | $s_a_dbp=sprintf('select a.id, a.upload, a.vid, a.url, a.title, b.name from %s as a, %s as b where a.aid=b.id and a.disp=0 order by a.datetime desc', $dbprefix.'photo', $dbprefix.'member');
83 | $q_a_dbp=mysql_query($s_a_dbp) or die('');
84 | $c_dbp=mysql_num_rows($q_a_dbp);
85 | if($c_dbp>0){
86 | $p_dbp=ceil($c_dbp/$pagesize);
87 | if($page>$p_dbp)$page=$p_dbp;
88 | $s_dbp=sprintf('%s limit %d, %d', $s_a_dbp, ($page-1)*$pagesize, $pagesize);
89 | $q_dbp=mysql_query($s_dbp) or die('');
90 | $r_dbp=mysql_fetch_assoc($q_dbp);
91 | $content.='';
92 | do{
93 | $content.=' ';
94 | }while($r_dbp=mysql_fetch_assoc($q_dbp));
95 | $content.=' ';
96 | mysql_free_result($q_dbp);
97 | if($p_dbp>1)$content.=getpage($page, $p_dbp);
98 | }else{
99 | $content.='照片视频
没有照片/视频
';
100 | }
101 | mysql_free_result($q_a_dbp);
102 | }
103 |
--------------------------------------------------------------------------------
/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 10px;
3 | background: #9c0;
4 | text-align: center;
5 | }
6 | body, td, input, textarea, select {
7 | font: 13px Verdana, arial, Helvetica, sans-serif;
8 | color: #333;
9 | }
10 | img {
11 | border: 0;
12 | }
13 | a {
14 | color: #666;
15 | }
16 | a:hover {
17 | text-decoration: none;
18 | color: #670;
19 | }
20 | form {
21 | margin: 0;
22 | }
23 | textarea {
24 | width: 450px;
25 | }
26 | #body {
27 | margin-left: auto;
28 | margin-right: auto;
29 | width: 790px;
30 | background: #fff url(images/kbg.gif) repeat-y left top;
31 | text-align: left;
32 | }
33 | #top {
34 | background: url(images/tbg.gif) no-repeat left top;
35 | padding: 10px;
36 | }
37 | #logo {
38 | padding-left: 80px;
39 | font-size: 3em;
40 | font-weight: bold;
41 | color: #670;
42 | background: url(images/logo.gif) no-repeat 20px center;
43 | }
44 | #logo a {
45 | color: #670;
46 | text-decoration: none;
47 | }
48 | #menu {
49 | padding: 3px;
50 | text-align: right;
51 | }
52 | #menu a {
53 | text-decoration: none;
54 | padding: 3px;
55 | }
56 | #menu a:hover, #mn {
57 | border-bottom: 1px solid #f90;
58 | color: #f90;
59 | }
60 | .button {
61 | border: 1px solid #f93;
62 | background: #fff;
63 | color: #f93;
64 | }
65 | #foot {
66 | color: #aaa;
67 | padding: 15px;
68 | padding-left: 25px;
69 | background: url(images/bbg.gif) no-repeat left bottom;
70 | font-size: 11px;
71 | margin-top: 20px;
72 | }
73 | #foot a {
74 | color: #aaa;
75 | }
76 | #main {
77 | padding: 5px;
78 | padding-left: 20px;
79 | padding-right: 15px;
80 | }
81 | .lmenu {
82 | padding: 5px;
83 | }
84 | .lmenu ul, .clist, .lcontent ul, .kcontent ul, .scontent ul {
85 | list-style-type: none;
86 | margin: 0;
87 | padding: 0;
88 | }
89 | .lmenu ul li {
90 | font-weight: bold;
91 | padding: 2px;
92 | padding-top: 10px;
93 | clear: left;
94 | }
95 | .lmenu ol {
96 | list-style-type: none;
97 | margin: 0;
98 | padding-left: 10px;
99 | }
100 | .lmenu ol li {
101 | font-size: 13px;
102 | padding: 1px;
103 | font-weight: normal;
104 | clear: left;
105 | }
106 | .ulist li {
107 | border: 1px solid #dff7f7;
108 | }
109 | .utitle {
110 | font-size: 1.2em;
111 | font-weight: bold;
112 | }
113 | .rcontent {
114 | width: 100%;
115 | float: right;
116 | margin-left: -160px;
117 | }
118 | .content {
119 | padding: 10px;
120 | padding-left: 15px;
121 | margin-left: 165px;
122 | border-left: 1px solid #eee;
123 | }
124 | .navdiv {
125 | padding: 5px;
126 | text-align: center;
127 | }
128 | .clist li {
129 | margin-bottom: 20px;
130 | }
131 | .title {
132 | border-top: 1px solid #f60;
133 | border-bottom: 1px solid #ccc;
134 | background: #feb;
135 | font-weight: bold;
136 | padding: 3px;
137 | padding-left: 10px;
138 | color: #f90;
139 | font-size: 14px;
140 | }
141 | .title a {
142 | color: #f90;
143 | }
144 | .tcontent {
145 | padding-left: 20px;
146 | padding-right: 20px;
147 | }
148 | .gcontent, .lcontent, .kcontent, .scontent {
149 | border-bottom: 1px solid #dff7f7;
150 | background: #fefefe;
151 | }
152 | .gcontent {
153 | padding: 3px;
154 | overflow: auto;
155 | width: 709px;
156 | }
157 | .lcontent, .kcontent, .scontent {
158 | padding: 10px;
159 | }
160 | .lcontent ul li {
161 | margin: 0;
162 | padding: 5px;
163 | font-size: 1.2em;
164 | font-weight: bold;
165 | }
166 | .kcontent li {
167 | clear: both;
168 | }
169 | .mcontent {
170 | padding: 5px;
171 | font-size: 1.2em;
172 | font-weight: bold;
173 | text-align: center;
174 | border: 1px solid #dff7f7;
175 | color: #f90;
176 | background: #fefefe;
177 | }
178 | .gdate, .gmod, .reply_i {
179 | font-weight: normal;
180 | font-size: 11px;
181 | color: #666;
182 | }
183 | .gmod {
184 | display: block;
185 | float: right;
186 | padding-right: 8px;
187 | }
188 | .mlink {
189 | border-bottom: 1px solid #666;
190 | color: #666;
191 | }
192 | .al_t, .del_al_t {
193 | padding: 3px;
194 | margin: 5px;
195 | background: #fff;
196 | }
197 | .photo, .al_t {
198 | border: 1px solid #dff7f7;
199 | }
200 | .del_al_t {
201 | border: 1px solid #f30;
202 | }
203 | .al_list {
204 | margin: 5px;
205 | }
206 | .message_n, .del_n {
207 | font-weight: bold;
208 | color: #f30;
209 | }
210 | .msg_v {
211 | margin: 20px;
212 | margin-top: 0;
213 | padding: 10px;
214 | border: 1px solid #feb;
215 | font-weight: bold;
216 | color: #f60;
217 | }
218 | .reply_d {
219 | margin-left: 5px;
220 | margin-top: 10px;
221 | border-top: 1px solid #dff7f7;
222 | }
223 | .reply_v {
224 | border-bottom: 1px solid #dff7f7;
225 | padding: 10px;
226 | background: #fff;
227 | }
228 | .reply_i {
229 | text-align: right;
230 | }
231 | .skin_sdiv {
232 | padding-left: 10px;
233 | }
234 | .skin_sdiv img {
235 | border: 1px solid #dff7f7;
236 | padding: 2px;
237 | margin: 3px;
238 | }
239 | #skinlist li {
240 | float: left;
241 | width: 135px;
242 | height: 120px;
243 | text-align: center;
244 | }
245 | .skin_img {
246 | margin: 3px;
247 | padding: 2px;
248 | border: 1px solid #dff7f7;
249 | }
250 | .l_list {
251 | border-top: 1px solid #dff7f7;
252 | border-bottom: 1px solid #dff7f7;
253 | background: #fcfff2;
254 | padding: 5px;
255 | }
256 | .photo {
257 | float: left;
258 | padding: 1px;
259 | background: #fff;
260 | }
261 | .list_r {
262 | margin-left: 60px;
263 | padding: 2px;
264 | }
265 | .list_title {
266 | font-weight: bold;
267 | padding: 4px;
268 | padding-top: 0;
269 | padding-bottom: 10px;
270 | color: #f90;
271 | font-size: 14px;
272 | }
273 | .list_title a{
274 | color: #f90;
275 | }
276 | .list_c {
277 | padding: 6px;
278 | }
--------------------------------------------------------------------------------
/sync_e.php:
--------------------------------------------------------------------------------
1 | 0 and length(s_r)>0 order by id desc limit 1', $dbprefix.'m_sync', (time()-3600), time());
15 | $q_dby=mysql_query($s_dby) or die('');
16 | $r_dby=mysql_fetch_assoc($q_dby);
17 | if(mysql_num_rows($q_dby)>0){
18 | switch($r_dby['name']){
19 | case 'tqq':
20 | if($config['is_tqq']>0 && ($config['is_utqq']>0 || ($config['tqq_key']!='' && $config['tqq_se']!=''))){
21 | require_once('lib/tqq.php');
22 | $o=new tqqPHP($config['tqq_key'], $config['tqq_se']);
23 | $result=$o->access_token_refresh($r_dby['s_r']);
24 | if(isset($result['access_token']) && $result['access_token']!=''){
25 | $r_dby['s_t']=$result['access_token'];
26 | $r_dby['s_r']=$result['refresh_token'];
27 | $r_dby['edate']=time()+$result['expires_in'];
28 | }
29 | }
30 | break;
31 | case 'renren':
32 | if($config['is_renren']>0 && $config['renren_key']!='' && $config['renren_se']!=''){
33 | require_once('lib/renren.php');
34 | $o=new renrenPHP($config['renren_key'], $config['renren_se']);
35 | $result=$o->access_token_refresh($r_dby['s_r']);
36 | if(isset($result['access_token']) && $result['access_token']!=''){
37 | $r_dby['s_t']=$result['access_token'];
38 | $r_dby['s_r']=$result['refresh_token'];
39 | $r_dby['edate']=time()+$result['expires_in'];
40 | }
41 | }
42 | break;
43 | case 'kx001':
44 | if($config['is_kx001']>0 && $config['kx001_key']!='' && $config['kx001_se']!=''){
45 | require_once('lib/kaixin.php');
46 | $o=new kaixinPHP($config['kx001_key'], $config['kx001_se']);
47 | $result=$o->access_token_refresh($r_dby['s_r']);
48 | if(isset($result['access_token']) && $result['access_token']!=''){
49 | $r_dby['s_t']=$result['access_token'];
50 | $r_dby['s_r']=$result['refresh_token'];
51 | $r_dby['edate']=time()+$result['expires_in'];
52 | }
53 | }
54 | break;
55 | case 't163':
56 | if($config['is_t163']>0 && $config['t163_key']!='' && $config['t163_se']!=''){
57 | require_once('lib/t163.php');
58 | $o=new t163PHP($config['t163_key'], $config['t163_se']);
59 | $result=$o->access_token_refresh($r_dby['s_r']);
60 | if(isset($result['access_token']) && $result['access_token']!=''){
61 | $r_dby['s_t']=$result['access_token'];
62 | $r_dby['s_r']=$result['refresh_token'];
63 | $r_dby['edate']=time()+$result['expires_in'];
64 | }
65 | }
66 | break;
67 | case 'douban':
68 | if($config['is_douban']>0 && $config['douban_key']!='' && $config['douban_se']!=''){
69 | require_once('lib/douban.php');
70 | $o=new doubanPHP($config['douban_key'], $config['douban_se']);
71 | $result=$o->access_token_refresh($config['site_url'].'douban_callback.php', $r_dby['s_r']);
72 | if(isset($result['access_token']) && $result['access_token']!=''){
73 | $r_dby['s_t']=$result['access_token'];
74 | $r_dby['s_r']=$result['refresh_token'];
75 | $r_dby['edate']=time()+$result['expires_in'];
76 | }
77 | }
78 | break;
79 | case 'baidu':
80 | if($config['is_baidu']>0 && $config['baidu_key']!='' && $config['baidu_se']!=''){
81 | require_once('lib/baidu.php');
82 | $o=new baiduPHP($config['baidu_key'], $config['baidu_se']);
83 | $result=$o->access_token_refresh($r_dby['s_r']);
84 | if(isset($result['access_token']) && $result['access_token']!=''){
85 | $r_dby['s_t']=$result['access_token'];
86 | $r_dby['s_r']=$result['refresh_token'];
87 | $r_dby['edate']=time()+$result['expires_in'];
88 | }
89 | }
90 | break;
91 | case 'google':
92 | if($config['is_google']>0 && $config['google_key']!='' && $config['google_se']!=''){
93 | require_once('lib/google.php');
94 | $o=new googlePHP($config['google_key'], $config['google_se']);
95 | $result=$o->access_token_refresh($r_dby['s_r']);
96 | if(isset($result['access_token']) && $result['access_token']!=''){
97 | $r_dby['s_t']=$result['access_token'];
98 | $r_dby['edate']=time()+$result['expires_in'];
99 | }
100 | }
101 | break;
102 | case 'live':
103 | if($config['is_live']>0 && $config['live_key']!='' && $config['live_se']!=''){
104 | require_once('lib/live.php');
105 | $o=new livePHP($config['live_key'], $config['live_se']);
106 | $result=$o->access_token_refresh($r_dby['s_r']);
107 | if(isset($result['access_token']) && $result['access_token']!=''){
108 | $r_dby['s_t']=$result['access_token'];
109 | $r_dby['s_r']=$result['refresh_token'];
110 | $r_dby['edate']=time()+$result['expires_in'];
111 | }
112 | }
113 | break;
114 | default:
115 | break;
116 | }
117 | $u_db=sprintf('update %s set s_t=%s, s_r=%s, edate=%s, mdate=%s where id=%s', $dbprefix.'m_sync',
118 | SQLString($r_dby['s_t'], 'text'),
119 | SQLString($r_dby['s_r'], 'text'),
120 | SQLString($r_dby['edate'], 'int'),
121 | time(),
122 | $r_dby['id']);
123 | $result=mysql_query($u_db) or die('');
124 | echo '';
125 | }
126 | mysql_free_result($q_dby);
127 |
--------------------------------------------------------------------------------
/m/index.php:
--------------------------------------------------------------------------------
1 | 0){
24 | if(time()-$r_dbo['datetime']>600){
25 | $u_db=sprintf('update %s set visit=visit+1, visitdate=%s where id=%s', $dbprefix.'member', time(), $_SESSION[$config['u_hash']]);
26 | $result=mysql_query($u_db) or die('');
27 | }
28 | $u_db=sprintf('update %s set datetime=%s, online=1, ip_i=inet_aton(%s) where aid=%s', $dbprefix.'online', time(), SQLString(getIP(), 'text'), $_SESSION[$config['u_hash']]);
29 | $result=mysql_query($u_db) or die('');
30 | }else{
31 | $i_db=sprintf('insert into %s (aid, datetime, ip_i) values (%s, %s, inet_aton(%s))', $dbprefix.'online', $_SESSION[$config['u_hash']], time(), SQLString(getIP(), 'text'));
32 | $result=mysql_query($i_db) or die('');
33 | }
34 | mysql_free_result($q_dbo);
35 | }elseif(isset($_COOKIE[$config['u_hash'].'_u']) && $_COOKIE[$config['u_hash'].'_u']!='' && isset($_COOKIE[$config['u_hash'].'_p']) && $_COOKIE[$config['u_hash'].'_p']!=''){
36 | $s_dbu=sprintf('select id, name, status, power from %s where username=%s and password=%s limit 1', $dbprefix.'member', SQLString($_COOKIE[$config['u_hash'].'_u'], 'text'), SQLString($_COOKIE[$config['u_hash'].'_p'], 'text'));
37 | $q_dbu=mysql_query($s_dbu) or die('');
38 | $r_dbu=mysql_fetch_assoc($q_dbu);
39 | if(mysql_num_rows($q_dbu)>0){
40 | if($r_dbu['status']==0 || $config['veri']>0){
41 | $u_db=sprintf('update %s set visit=visit+1, visitdate=%s where id=%s', $dbprefix.'member', time(), $r_dbu['id']);
42 | $result=mysql_query($u_db) or die('');
43 | session_unset();
44 | session_start();
45 | $_SESSION[$config['u_hash']]=$r_dbu['id'];
46 | $pa=$r_dbu['power'];
47 | $pn=$r_dbu['name'];
48 | $c_log=true;
49 | }
50 | }
51 | mysql_free_result($q_dbu);
52 | if(!$c_log){
53 | session_unset();
54 | setcookie($config['u_hash'].'_u','',time());
55 | setcookie($config['u_hash'].'_p','',time());
56 | }
57 | }
58 | $u_db=sprintf('update %s set online=0 where %s-datetime>300', $dbprefix.'online', time());
59 | $result=mysql_query($u_db) or die('');
60 | $mid=(isset($_GET['m']) && in_array($_GET['m'], $menua))?$_GET['m']:$menua[0];
61 | if($config['open']>0 && !$c_log)$mid='login';
62 | $content='';
63 | $title='';
64 | $js_c='';
65 | require_once($mid.'.php');
66 | ?>
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
82 | $(function(){
83 | '.$js_c.'
84 | });
85 | ';
86 | ?>
87 |
88 |
89 |
90 |
99 |
100 |
101 |
102 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/lib/tqq.php:
--------------------------------------------------------------------------------
1 | client_id=$client_id;
13 | $this->client_secret=$client_secret;
14 | $this->access_token=$access_token;
15 | $this->openid=$openid;
16 | }
17 |
18 | //生成授权网址
19 | public function login_url($callback_url){
20 | $params=array(
21 | 'response_type'=>'code',
22 | 'client_id'=>$this->client_id,
23 | 'redirect_uri'=>$callback_url
24 | );
25 | return 'https://open.t.qq.com/cgi-bin/oauth2/authorize?'.http_build_query($params);
26 | }
27 |
28 | //获取access token
29 | public function access_token($callback_url, $code){
30 | $params=array(
31 | 'grant_type'=>'authorization_code',
32 | 'code'=>$code,
33 | 'client_id'=>$this->client_id,
34 | 'client_secret'=>$this->client_secret,
35 | 'redirect_uri'=>$callback_url
36 | );
37 | $url='https://open.t.qq.com/cgi-bin/oauth2/access_token?'.http_build_query($params);
38 | $result_str=$this->http($url);
39 | $json_r=array();
40 | if($result_str!='')parse_str($result_str, $json_r);
41 | return $json_r;
42 | }
43 |
44 | //使用refresh token获取新的access token
45 | public function access_token_refresh($refresh_token){
46 | $params=array(
47 | 'grant_type'=>'refresh_token',
48 | 'refresh_token'=>$refresh_token,
49 | 'client_id'=>$this->client_id
50 | );
51 | $url='https://open.t.qq.com/cgi-bin/oauth2/access_token?'.http_build_query($params);
52 | $result_str=$this->http($url);
53 | $json_r=array();
54 | if($result_str!='')parse_str($result_str, $json_r);
55 | return $json_r;
56 | }
57 |
58 | //获取登录用户信息
59 | public function me(){
60 | $params=array();
61 | return $this->api('user/info', $params);
62 | }
63 |
64 | //获取登录用户微博列表
65 | public function getMyTweet($reqnum=10, $pageflag=0){
66 | $params=array(
67 | 'pageflag'=>$pageflag,
68 | 'reqnum'=>$reqnum
69 | );
70 | return $this->api('statuses/broadcast_timeline', $params);
71 | }
72 |
73 | //发布微博
74 | public function postOne($img_c, $pic=''){
75 | $params=array(
76 | 'content'=>$img_c
77 | );
78 | if($pic!='' && is_array($pic)){
79 | $url='t/add_pic';
80 | $params['pic']=$pic;
81 | }else{
82 | $url='t/add';
83 | }
84 | return $this->api($url, $params, 'POST');
85 | }
86 |
87 | //调用接口
88 | /**
89 | //示例:获取登录用户信息
90 | $result=$tqq->api('user/info', array(), 'GET');
91 | **/
92 | public function api($url, $params=array(), $method='GET'){
93 | $url=$this->api_url.$url;
94 | $params['oauth_consumer_key']=$this->client_id;
95 | $params['access_token']=$this->access_token;
96 | $params['openid']=$this->openid;
97 | $params['clientip']=$this->getIP();
98 | $params['oauth_version']='2.a';
99 | $params['format']='json';
100 | $params['scope']='all';
101 | if($method=='GET'){
102 | $result_str=$this->http($url.'?'.http_build_query($params));
103 | }else{
104 | if(isset($params['pic'])){
105 | uksort($params, 'strcmp');
106 | $str_b=uniqid('------------------');
107 | $str_m='--'.$str_b;
108 | $str_e=$str_m. '--';
109 | $body='';
110 | foreach($params as $k=>$v){
111 | if($k=='pic'){
112 | if(is_array($v)){
113 | $img_c=$v[2];
114 | $img_n=$v[1];
115 | }elseif($v{0}=='@'){
116 | $url=ltrim($v, '@');
117 | $img_c=file_get_contents($url);
118 | $url_a=explode('?', basename($url));
119 | $img_n=$url_a[0];
120 | }
121 | $body.=$str_m."\r\n";
122 | $body.='Content-Disposition: form-data; name="'.$k.'"; filename="'.$img_n.'"'."\r\n";
123 | $body.="Content-Type: image/unknown\r\n\r\n";
124 | $body.=$img_c."\r\n";
125 | }else{
126 | $body.=$str_m."\r\n";
127 | $body.='Content-Disposition: form-data; name="'.$k.'"'."\r\n\r\n";
128 | $body.=$v."\r\n";
129 | }
130 | }
131 | $body.=$str_e;
132 | $headers[]='Content-Type: multipart/form-data; boundary='.$str_b;
133 | $result_str=$this->http($url, $body, 'POST', $headers);
134 | }else{
135 | $result_str=$this->http($url, http_build_query($params), 'POST');
136 | }
137 | }
138 | $json_r=array();
139 | if($result_str!='')$json_r=json_decode($result_str, true);
140 | return $json_r;
141 | }
142 |
143 | //获取IP地址
144 | private function getIP(){
145 | if(isset($_ENV['HTTP_CLIENT_IP'])){
146 | $ip=$_ENV['HTTP_CLIENT_IP'];
147 | }elseif(isset($_ENV['HTTP_X_FORWARDED_FOR'])){
148 | $ip=$_ENV['HTTP_X_FORWARDED_FOR'];
149 | }elseif(isset($_ENV['REMOTE_ADDR'])){
150 | $ip=$_ENV['REMOTE_ADDR'];
151 | }else{
152 | $ip=$_SERVER['REMOTE_ADDR'];
153 | }
154 | if(strstr($ip, ':')){
155 | $ipa=explode(':', $ip);
156 | foreach($ipa as $v){
157 | if(strlen($v)>7)$ip=$v;
158 | }
159 | }
160 | if(strlen($ip)<7)$ip='0.0.0.0';
161 | return $ip;
162 | }
163 |
164 | //提交请求
165 | private function http($url, $postfields='', $method='GET', $headers=array()){
166 | $ci=curl_init();
167 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
168 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
169 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
170 | curl_setopt($ci, CURLOPT_TIMEOUT, 30);
171 | if($method=='POST'){
172 | curl_setopt($ci, CURLOPT_POST, TRUE);
173 | if($postfields!='')curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
174 | }
175 | $headers[]='User-Agent: tQQ.PHP(piscdong.com)';
176 | curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
177 | curl_setopt($ci, CURLOPT_URL, $url);
178 | $response=curl_exec($ci);
179 | curl_close($ci);
180 | return $response;
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/message.php:
--------------------------------------------------------------------------------
1 | ';
13 | $page=(isset($_GET['page']) && intval($_GET['page'])>0)?intval($_GET['page']):1;
14 | if(isset($_GET['id']) && intval($_GET['id'])>0 && intval($_GET['id'])!=$_SESSION[$config['u_hash']] && getainfo(intval($_GET['id']), 'id')){
15 | $tid=intval($_GET['id']);
16 | $tn=getainfo($tid, 'name');
17 | $title.=' - '.$tn['name'];
18 | if($_SERVER['REQUEST_METHOD']=='POST'){
19 | $cont=htmlspecialchars(trim($_POST['rinfo']),ENT_QUOTES);
20 | if($cont!=''){
21 | $i_db=sprintf('insert into %s (content, aid, tid, datetime, readed) values (%s, %s, %s, %s, 1)', $dbprefix.'message',
22 | SQLString($cont, 'text'),
23 | $_SESSION[$config['u_hash']],
24 | $tid,
25 | time());
26 | $result=mysql_query($i_db) or die('');
27 | }
28 | header('Location:./?m=message&id='.$tid);
29 | exit();
30 | }else{
31 | if(isset($_GET['did'])){
32 | $d_db=sprintf('delete from %s where id=%s and aid=%s and tid=%s', $dbprefix.'message', intval($_GET['did']), $tid, $_SESSION[$config['u_hash']]);
33 | $result=mysql_query($d_db) or die('');
34 | header('Location:./?m=message&id='.$tid);
35 | exit();
36 | }
37 | $content.='发消息 - 收件人:'.$tn['name'].'
'.getcform().'
';
38 | $s_a_dbg=sprintf('select * from %s where (aid=%s and tid=%s) or (tid=%s and aid=%s) order by datetime desc', $dbprefix.'message', $tid, $_SESSION[$config['u_hash']], $tid, $_SESSION[$config['u_hash']]);
39 | $q_a_dbg=mysql_query($s_a_dbg) or die('');
40 | $c_dbg=mysql_num_rows($q_a_dbg);
41 | if($c_dbg>0){
42 | $content.='聊天记录
';
43 | $p_dbg=ceil($c_dbg/$config['pagesize']);
44 | if($page>$p_dbg)$page=$p_dbg;
45 | $s_dbg=sprintf('%s limit %d, %d', $s_a_dbg, ($page-1)*$config['pagesize'], $config['pagesize']);
46 | $q_dbg=mysql_query($s_dbg) or die('');
47 | $r_dbg=mysql_fetch_assoc($q_dbg);
48 | $js_c.='
49 | $("img[name=\'del_img\']").click(function(){
50 | if(confirm(\'确认要删除?\'))location.href=\'?m=message&id='.$tid.'&did=\'+$(this).data(\'id\');
51 | });';
52 | do{
53 | $content.=''.($r_dbg['aid']==$_SESSION[$config['u_hash']]?'我':'
'.$tn['name'].' ').':'.gbookencode($r_dbg['content']).($r_dbg['readed']>0?'
':'').'
'.getldate($r_dbg['datetime']).($r_dbg['aid']==$_SESSION[$config['u_hash']]?'
':'').'
';
54 | if($r_dbg['readed']>0 && $r_dbg['tid']==$_SESSION[$config['u_hash']]){
55 | $u_db=sprintf('update %s set readed=0 where id=%s', $dbprefix.'message', $r_dbg['id']);
56 | $result=mysql_query($u_db) or die('');
57 | }
58 | }while($r_dbg=mysql_fetch_assoc($q_dbg));
59 | mysql_free_result($q_dbg);
60 | if($p_dbg>1)$content.=getpage($page, $p_dbg);
61 | }
62 | mysql_free_result($q_a_dbg);
63 | }
64 | }else{
65 | $title.=' - 收件箱';
66 | if(isset($_GET['did'])){
67 | $d_db=sprintf('delete from %s where id=%s and tid=%s', $dbprefix.'message', intval($_GET['did']), $_SESSION[$config['u_hash']]);
68 | $result=mysql_query($d_db) or die('');
69 | header('Location:./?m=message');
70 | exit();
71 | }
72 | $content.='收件箱
';
73 | $s_a_dbg=sprintf('select a.*, b.name from %s as a, %s as b where a.tid=%s and a.aid=b.id order by a.datetime desc', $dbprefix.'message', $dbprefix.'member', $_SESSION[$config['u_hash']]);
74 | $q_a_dbg=mysql_query($s_a_dbg) or die('');
75 | $c_dbg=mysql_num_rows($q_a_dbg);
76 | if($c_dbg>0){
77 | $p_dbg=ceil($c_dbg/$config['pagesize']);
78 | if($page>$p_dbg)$page=$p_dbg;
79 | $s_dbg=sprintf('%s limit %d, %d', $s_a_dbg, ($page-1)*$config['pagesize'], $config['pagesize']);
80 | $q_dbg=mysql_query($s_dbg) or die('');
81 | $r_dbg=mysql_fetch_assoc($q_dbg);
82 | $js_c.='
83 | $("img[name=\'del_img\']").click(function(){
84 | if(confirm(\'确认要删除?\'))location.href=\'?m=message&did=\'+$(this).data(\'id\');
85 | });';
86 | do{
87 | $content.=''.gbookencode($r_dbg['content']).'
';
88 | if($r_dbg['readed']>0){
89 | $u_db=sprintf('update %s set readed=0 where id=%s', $dbprefix.'message', $r_dbg['id']);
90 | $result=mysql_query($u_db) or die('');
91 | }
92 | }while($r_dbg=mysql_fetch_assoc($q_dbg));
93 | mysql_free_result($q_dbg);
94 | $content.=' ';
95 | if($p_dbg>1)$content.=getpage($page, $p_dbg);
96 | }else{
97 | $content.='没有短消息
';
98 | }
99 | mysql_free_result($q_a_dbg);
100 | }
101 | $content.='';
102 | }else{
103 | header('Location:./');
104 | exit();
105 | }
106 |
--------------------------------------------------------------------------------