腾讯云网站解决方案帮您轻松应对建站成本高/网络不稳等常见问题

dedecms注册的会员自动激活discuz论坛

1
回复
1078
查看
[复制链接]

761

主题

775

帖子

3万

积分

董事

Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72

积分
32849
发表于 19-4-26 21:18:01 | 显示全部楼层 |阅读模式      紫钻仅向指定用户开放  
                dedecms整合discuz同步登录与退出并且不用激活
, ^  [/ @: l* n9 q+ ~
& D0 x* a; ~& L# P" a    弄了一天,问题总算解决了,不过有点投机取巧,下面说下dedecms整合discuz后会员注册后不用激活的实现,以前做站时,一直在想,dede和 dz整合后,会员在网站注册后到论坛能不能不再激活,看着可不舒服,现在总算解决了,闲话不说了,下面进入正题,百度也不让发附件,只有啰嗦点了,呵呵, 比较长,分3篇:
) {1 X0 [( X0 q: O$ S0 R1.首先找到dede-〉api-〉uc.php文件" ^9 j3 _4 g8 l8 O# S* k' b: b
打开uc.php,将内容替换为:
) E: G1 ^3 y- W% O<?php4 _6 ^/ `. W' V5 G
/**************************二次开发说明**************************************

4 u9 V3 L5 N$ E( V) [此模块应用于DEDECMS5.6版本,请替换API文件夹的UC.PHP,替换后,通过DEDE注册的用户,1 M; \# U) R: I  X8 A0 X+ k+ l$ s
访问论坛系统可以免激活,实现同时登陆同时退出。
% Y1 Z3 \0 P9 t*****************************************版权:
http://www.zzjie.com**************/: Z+ g' a6 K% t0 s
include_once (dirname(__FILE__)."/../include/common.inc.php");' O6 x. X9 c. v- T! }. i
define('IN_DISCUZ', FALSE);
7 l$ l( P5 k- _+ i( v+ X, D8 b
define('UC_CLIENT_VERSION', '1.5.0'); //note UCenter 版本标识( P% E0 |2 b8 h8 g  D
define('UC_CLIENT_RELEASE', '20081031');

1 S- h. E1 {+ ?4 d) K; |# odefine('API_DELETEUSER', 1);   //note 用户删除 API 接口开关: s0 ]" j8 `2 S
define('API_RENAMEUSER', 1);   //note 用户改名 API 接口开关1 \2 a  v. c4 g8 B% N1 o1 a
define('API_GETTAG', 1);   //note 获取标签 API 接口开关+ m$ k6 F! o7 E
define('API_SYNLOGIN', 1);   //note 同步登录 API 接口开关
! K, ]4 j0 x) {; W* m6 edefine('API_SYNLOGOUT', 1);   //note 同步登出 API 接口开关5 {$ B4 w% Z; }: c9 n2 D
define('API_UPDATEPW', 1);   //note 更改用户密码 开关
3 A$ B5 C) {$ c' edefine('API_UPDATEBADWORDS', 1); //note 更新关键字列表 开关
8 u% o( ]- t  k+ ^9 I8 M8 j5 edefine('API_UPDATEHOSTS', 1);   //note 更新域名解析缓存 开关
" u3 ?' {0 t2 S) W+ m9 _define('API_UPDATEAPPS', 1);   //note 更新应用列表 开关3 m# K) {5 u- D- Z( ^
define('API_UPDATECLIENT', 1);   //note 更新客户端缓存 开关+ {! c' j- k1 x
define('API_UPDATECREDIT', 1);   //note 更新用户积分 开关
# j  M  |7 p6 P, f1 p6 h0 udefine('API_GETCREDITSETTINGS', 1); //note 向 UCenter 提供积分设置 开关& \3 Y2 H8 }4 \5 o. X1 l5 u: L
define('API_GETCREDIT', 1);   //note 获取用户的某项积分 开关
. }0 \; j' W9 [* l' p  m% Ndefine('API_UPDATECREDITSETTINGS', 1); //note 更新应用积分设置 开关

) x2 Q* f) {( q! A6 @0 |6 N: K4 hdefine('API_RETURN_SUCCEED', '1');: u( ^, n; i- f% {9 _4 a
define('API_RETURN_FAILED', '-1');
* `6 r4 f' ]$ g+ x  K  D% b& Zdefine('API_RETURN_FORBIDDEN', '-2');
  f, O2 z" C: }4 m6 x, T
define('UC_CLIENT_ROOT', DEDEROOT.'/uc_client');
" k  d: @9 C2 N) M//note 普通的 http 通知方式
8 T" ^* h6 J4 }, M& b9 t  Mif(!defined('IN_UC'))
/ Z* u0 Q, X& y+ h7 P{
0 W7 `/ x' x: v, v. S! }1 {
error_reporting(0);6 Y& E! F6 t. M3 v& d* D. J; k0 Q* Z
set_magic_quotes_runtime(0);' S4 J$ i# O6 h6 I3 S8 \
defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
. n6 p% X! p' R1 I# m0 X
$_DCACHE = $get = $post = array();
' V3 l) P! z1 \# V- P$code = @$_GET['code'];6 l% N- \2 q$ Y5 Z8 k6 D1 U
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);1 S1 o5 X  m5 H

8 w" t9 R  N2 r9 {1 Y7 {7 `# D* R8 |if(MAGIC_QUOTES_GPC)
$ ^8 U! ^# k( Z$ t3 J{' o/ w! L5 J+ k  E3 ^' b* ~# h. A& N9 `' {
   $get = _stripslashes($get);( j" R0 |. |/ Y# q
}
3 `8 V6 q) H1 }1 ]$ k
$timestamp = time();# m  Q" O. T8 T  S1 K. y  Q( j
if($timestamp - $get['time'] > 3600) {
) X3 m% J6 A& I1 C- g* _7 `   exit('Authracation has expiried');, `' W" |. t  Y# @5 z- _
}* u! u, F' J- H0 \$ j2 o9 I" \
if(empty($get)) {: q$ \+ `' ~# a5 B; h3 N  D4 D
   exit('Invalid Request');
& r% l- {7 M/ c- T6 i# M: w}
$ U8 ^0 ?5 Q( h7 J) E$action = $get['action'];
* `# z5 z; y  g) A( z7 K
require_once UC_CLIENT_ROOT.'/lib/xml.class.php';( ~/ K8 h+ P( x% [
$post = xml_unserialize(file_get_contents('php://input'));
6 D+ I% i! u, o& @( U0 z
if(in_array($get['action'], array('test',  'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout',  'updatepw', 'updatebadwords', 'updatehosts', 'updateapps',  'updateclient', 'updatecredit', 'getcreditsettings',  'updatecreditsettings')))
$ t4 J! H' A. \. w# r2 k; k) R0 ^{! ]  B( ~% B* ^
   $uc_note = new uc_note();
9 E( }7 ~; J9 C; L& k3 p" ^   exit($uc_note->$get['action']($get, $post));# k; r, r+ W3 s$ F* o' }6 C( ]/ \
}else{9 F4 \! \: G% L: P8 s* M
   exit(API_RETURN_FAILED);: a& ]. o+ F7 L0 K" C, @+ Z1 l+ X
}

( r/ ?8 @) j$ a. K0 ?( ]% V, @//note include 通知方式; j0 Q- |8 }3 f6 Q% r+ E$ w2 J
} else {
. s- H2 N2 e$ N$ W" e1 s" X
exit('Invalid Request');
: i/ q" E, v& S: o}
+ V; c- p1 @/ z+ ]! W* J# g- b
class uc_note3 t5 A% s! Q! c! ^: V
{
/ H: N; f+ {) E1 j! t
var $dbconfig = '';
0 ]- \0 u$ o! C/ p# m& o( X3 |var $db = '';# m5 `8 [; Y7 }, Q
var $appdir = '';
! x3 @9 V5 a9 Y/ ~var $tablepre = 'dede_';
4 l. N5 y0 d8 v7 g9 e1 L, W% W9 l7 N
function _serialize($arr, $htmlon = 0)/ j: i) Q8 Z6 G/ `3 T+ B
{
* ?/ r3 f0 c# Q4 a: ^' o3 i   if(!function_exists('xml_serialize'))
  ^% u  I4 I" W   {$ H* ?; y4 p0 x) z% l, g- C
    include_once UC_CLIENT_ROOT.'/lib/xml.class.php';
. W- Q6 u% ]7 \8 s/ t5 v! }* M+ T2 y   }% @7 L! P# \# q
   return xml_serialize($arr, $htmlon);
3 \/ l0 y* S' s}

' O& f+ B& u9 U' o* l" F1 l0 Tfunction uc_note()0 r5 ]) g) v2 s' z1 E4 W
{
7 _5 F& J/ L, z   $this->appdir = DEDEROOT;! ]% y9 z9 k4 A* c3 o2 _/ d
   $this->dbconfig = DEDEINC.'/common.inc.php';8 f! |/ _; D" f# n7 g: v3 J
   $this->db = $GLOBALS['dsql'];
' t8 k) O. U4 m% O7 G+ x* H   $this->tablepre = $GLOBALS['cfg_dbprefix'];
3 ], ^' |" n5 a  e9 W1 l. }1 {- e+ p}& u5 t9 X! l# i* D" T
  h3 h' |" d% M+ y0 [' Z1 P. [5 H
function get_uids($uids)
3 T' h/ C/ t. g. |{6 n4 e0 v/ {! E$ q1 u
   include UC_CLIENT_ROOT.'/client.php';$ ~: P/ Q5 H. t$ _
  ) A6 f$ y7 E$ }' w( W
   $members = explode(",", $uids);
+ u' o# S2 V; w* F( U   empty($members) && exit(API_RETURN_FORBIDDEN);; O5 c6 i* \8 \# Z! r
  
! l( l  s5 h6 q# M1 x   /*$members_username = array();+ M6 Z) ~% c, B; r$ I! A
  
! |0 ?8 n: @0 n& L# s0 X- B' q. U   foreach($members as $id)
1 ]1 L8 v8 C2 n) x) B5 a   {
+ S( D4 [$ ^9 F7 N- M# L. J( }    $row = uc_get_user($id,1);  v/ j$ H' @, S" f  j
    $members_username[] = $row[1];  
/ e$ c/ _$ S* A5 m( d   }2 O; [" j7 `( x* ^1 o* t- V) p6 ?
  
& V" k6 a) m8 L6 r! }0 `/ Z; ?; I$ M   $comma_temps = implode(",", $members_username);2 H/ ~' C7 h- n" F% p; L
  ! }# Z& o# S+ I( @4 J
   empty($comma_temps) && exit(API_RETURN_FORBIDDEN);
1 F, W0 ?2 |! T' t  6 w: E) S2 a3 x' g; I
   $comma_uids = array();*/& c7 P' Y+ ]6 J$ R! l" R4 k" {0 k$ w
  
4 Q9 }2 X/ R$ H, k0 @) d   //$row = $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE userid IN ($comma_temps)");
$ r. r# h5 e& l: Y  3 f- H- V  ~( Z2 \1 l: ~0 P: @
   $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE mid IN ($uids)");
" d# r+ e% w- y   $this->db->Execute();  
4 \# G" a% }* Q/ E  z   while($row = $this->db->GetArray())
; f- Y3 Y+ [0 t, Z0 d   {
( Z/ C2 L0 y# T# V1 u" c    $comma_uids[] = $row['mid'];$ E/ c9 ^0 P+ y0 s' z/ e2 U
   }7 R  O9 p* j0 U8 G
  # \0 }, j, I  ^  G7 ?1 |2 p3 v( i
   empty($comma_uids) && exit(API_RETURN_FORBIDDEN);' |* e- `5 n3 E9 }/ h. A% ^7 n& D
  3 C' m  v# F6 s3 S2 K/ a
   return implode(",", $comma_uids);
3 M9 ]7 ]* W" ~! G/ t! V& Q4 V! v}

3 z& `+ X8 l+ o3 V1 Z% T' kfunction test($get, $post)
  R% n) U' ]" s& l+ q{7 N% C7 h; h* L7 Q' |3 ?$ x8 v2 P
   return API_RETURN_SUCCEED;, _' Q8 r& R# h, \2 B5 \$ [: r
}

$ S7 }  k5 V: d: O6 X/ o3 B7 ffunction deleteuser($get, $post)
- q) G1 I5 L! _( e0 y0 j9 p{
$ e  `" k& L$ @# d4 L# [5 i5 @   $uids = $this->get_uids($get['ids']);! X* [: i+ ~* x  m) h2 w8 b- X5 |
   !API_DELETEUSER && exit(API_RETURN_FORBIDDEN);
+ x& E! G0 K' w5 c# h( o
   //note 用户删除 API 接口- d* t. q0 D6 [- A6 G* l
   $rs = $this->db->ExecuteNoneQuery2("DELETE FROM
`dede_member` WHERE mid IN ($uids) AND matt<>10 limit 1");# Q* ]) N* [8 T- W: v; X
   if($rs > 0)0 ?8 b' _! W6 g
   {% d6 c8 v* f. N0 Q1 P
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_tj` WHERE mid IN ($uids) limit 1");
* k) l; H$ R% p1 Q5 L  o    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_space` WHERE mid IN ($uids) limit 1");# h3 ^0 J$ `7 ~" }5 Y$ n. ?
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_company` WHERE mid IN ($uids) limit 1");
) O& J" \; }5 q' D    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_person` WHERE mid IN ($uids) limit 1");* f9 N& x* G7 V6 {! c
  
. @, F1 I5 I- b7 W, F    //删除用户相关数据# a8 [& \) ~" L: I6 h9 D$ M0 d0 T
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_stow` WHERE mid IN ($uids) ");
+ i! m* o/ r( X    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_flink` WHERE mid IN ($uids) ");3 ~7 t. }) H6 _7 t
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_guestbook` WHERE mid IN ($uids) ");
7 q  t/ A% w7 l' |& J1 P: L/ e    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_operation` WHERE mid IN ($uids) ");
- |% x) K. ~. ]& I$ k    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_pms` WHERE toid IN ($uids) OR fromid IN ($uids) ");
7 E% {: ]" F2 C0 y1 F. O. U2 l: j    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_friends` WHERE mid IN ($uids) OR fid IN ($uids) ");0 I; V$ R3 G; Q$ V  Y( J4 M
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_vhistory` WHERE mid IN ($uids) OR vid IN ($uids) ");
" t, o0 T+ x* T* W2 M* P( K- w    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_feedback` WHERE mid IN ($uids) ");( L5 F/ N. d  g
    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET mid='0' WHERE mid IN ($uids)");% s. T7 h( m' x$ ]
   }6 U9 b$ x- @1 L% s& y0 |* A
   else% y+ `" Z9 K4 N7 b) s
   {) N; p8 h: M+ L
    exit(API_RETURN_FORBIDDEN);: y- q7 B  n1 }: n) W5 q1 H
   }

7 K# l5 X) s; I6 r   return API_RETURN_SUCCEED;
6 v6 e+ \, @8 |& y* M/ ?5 ^# W}
- v" I$ }! L6 l  q$ [, d
function renameuser($get, $post)# p+ [% s) C3 p$ H
{
4 }+ K2 P0 \5 j) j$ Q   $uids = $this->get_uids($get['ids']);( j9 K" u. @8 @# t
  ) ]7 ?5 n2 D9 J2 V$ t- g/ j3 c
  
4 h4 ^* r9 Y5 N8 z* K/ o% H2 K   $usernameold = $get['oldusername'];
: z  D  G; }; I/ z" O   $usernamenew = $get['newusername'];
* t% p2 E. X8 H: A   if(!API_RENAMEUSER)
- Y2 }5 s( Z6 F. F9 E; u6 O$ G% I   {
" J' h4 H) ~6 E, B    return API_RETURN_FORBIDDEN;6 ~1 M% M3 z& ]# M$ R5 R( S! ?3 X, a; \
   }

% A6 ^8 B4 g* g* K1 E" n* ~9 m5 q   //note 获取标签 API 接口- U' p; {% i. \9 x' h6 }5 o
   $rs = $this->db->ExecuteNoneQuery2("UPDATE
`dede_member` SET userid='$usernamenew' WHERE userid='$usernamenew' AND matt<>10 limit 1");
: @5 }& T, y: K# ^6 T   if($rs > 0)& r& ^# G! |3 F* U2 O
   {) H+ Y$ x3 p7 X7 c+ E
    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'");
2 s, \: w5 h& O. C* z/ ^" C" l9 n, X    $this->db->ExecuteNoneQuery("UPDATE
`dede_member_pms`  SET floginid=REPLACE(floginid, 't$usernameold',  't$usernamenew'),tologinid=REPLACE(tologinid, 't$usernameold',  't$usernamenew')");& v7 v8 D9 e5 n, F( b5 I( s* }0 Z
   2 N: }- D% L! p) O; l
   
' Q  N, u$ o- w3 T8 u    $row = $this->db->GetOne("SHOW TABLE STATUS");  |& L2 h* d/ v& c
    $db_tables = $row['Name']; unset($row);
* A8 v$ i5 G, p& Y* C   6 O/ t8 e8 `5 o# ]4 ~) m0 P
    if(in_array($this->tablepre.'guestbook',$db_tables))9 ?; r) \" f) w4 R# C4 V: d* U
    {* j' H$ `; K8 E
     $this->db->ExecuteNoneQuery("UPDATE
`dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");) w' }" z* T" g( v1 R% `2 T
    }
6 ?6 ~! S8 Z; o- O6 X   
* v' M  s1 R4 J0 s0 T% B6 n. H    if(in_array($this->tablepre.'story_books',$db_tables)), B1 i2 T: A6 v& M0 O
    {+ ~! r8 j! [# Q
     $this->db->ExecuteNoneQuery("UPDATE
`dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'");2 `  E1 ^3 P2 K$ e9 {
    }
# l4 J* `3 Y) ?) ?) A   
, i  Z# ^# w" ]$ `( g( `    if(in_array($this->tablepre.'groups',$db_tables))) \$ D! ~- S& r
    {& a2 l! s( F6 J( C
     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'");
; K$ t# p4 R$ j0 _5 _* A" Q+ B     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'");" x0 `7 p1 r/ \* i+ d+ N9 m  F& H
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'");
: S( |9 G$ b: H( W8 a1 x/ e     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'");
, E8 b* d! _& z3 J7 w) F$ a: H     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");; }1 I5 k+ ^  G7 K3 C
     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET ismaster=REPLACE(ismaster, 't$usernameold', 't$usernamenew')");
- f* O9 }* j% d# b8 t    }
9 E* E$ z4 ?3 v! l2 K& |4 c$ p   0 o8 L1 L3 B; o1 G' W
    return API_RETURN_SUCCEED;
  H( i4 R5 Q3 v5 `   }
' J- P: x: W* f) o3 Q5 A1 v0 T   else; B. v, ~7 H% h3 o+ A8 |
   {
/ w) ?) z. a* m    return API_RETURN_FORBIDDEN;6 X! C1 T; S" P8 R: S
   }2 ~, l2 H, [! ~" F) G, {! a
}

% Q3 i2 P& ?- @& S" @0 w, Z8 [0 Nfunction gettag($get, $post)
3 |& O6 |5 \7 C{
! f7 d0 k( Q0 S. `   $name = $get['id'];5 C0 @, U, D) ~
   if(!API_GETTAG)2 G& L& s6 p% b$ c5 I- K
   {5 U! z" u% m# O/ G  @! p
    return API_RETURN_FORBIDDEN;
5 l# W& c" s' ?% ?9 H0 Q% W   }

0 `6 i3 e8 k4 Z# s   //note 获取标签 API 接口; v" a" A; F' z' Z& n5 c- |
   $name = trim($name);% h" C: q" W0 J
   if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/', $name) || strlen($name) > 20)
8 b9 ?0 D& q1 `# f$ H- B) A   {! f: V( ]7 M4 U, k
    return API_RETURN_FAILED;& P8 r5 V0 G+ D8 m: b
   }

8 C- q  f+ F3 Y5 s8 s' X   $row = $this->db->GetOne("SELECT `total`,`id` FROM `dede_tagindex` WHERE `tag`='$name'");2 P6 w+ ^- ]( ?9 n- |
   if(!is_array($row))
* {/ k4 q3 C3 r$ i   {1 a% z. B, }* W' _% ]( _! M  _
    return API_RETURN_FAILED;
% }# P2 F2 I7 m; e, ?+ n   }
" c; t% Y( x1 r! @6 ?1 {  - C. c8 O0 e1 D3 P2 {' S
   $tpp = $row['total'] > 10 ? 10 : $row['total'];  $ j9 ~: X& ^  d) r: a  ^
  . A/ A: S- @( Q1 F* c+ h
   $ids = array();4 W3 c7 J1 s. i
  
( G) R7 c: W" R: R2 }   $this->db->SetQuery("SELECT aid FROM
`dede_taglist` WHERE `tid`='$row[id]' AND arcrank>-1");% _1 ^$ q6 I. V, `0 [+ d
   $this->db->Execute();) B6 a' t' s. Y. N  s) W1 u6 P
   while($row = $this->db->GetArray())
* f1 `- E# C8 d! a- g   {; @' h" f, a, u1 u
    $ids[] = $row['aid'];   ! Y$ ?2 X4 @. ]+ l5 h$ d; v* Z
   }
* p& D  y1 S0 w! p7 Y  
/ s- L  \- I* a% D2 c0 G5 h   if(empty($ids))! T8 y0 @0 C! b4 ^+ X
   {
' z1 t9 k7 t4 F! H    return API_RETURN_FAILED;
, k! W* ?, c6 R6 ~1 O* Q8 q   }
% l# a' G  z! }3 s7 _0 V& a- F  K  
( u" X* W" a( `+ C   $aids = implode(",", $ids);8 c* O! [. y! @9 l7 l( ?( T' X" b
  ( V$ J( m) F! D# ?% }/ |
   include_once DEDEINC.'/channelunit.func.php';/ h& r& }+ }, a
  
4 O1 i5 f: d+ A# x6 b& Q   $archives_list = array();  * }0 M9 d& L+ h8 c5 y+ E
   $this->db->SetQuery("SELECT  arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath  % h( F2 [2 A0 ^1 l1 Q" q. p
FROM
`dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id WHERE arc.id IN($aids) ORDER BY id DESC LIMIT $tpp");4 C5 E$ o/ c- `) y/ \
   $this->db->Execute();
' S4 z0 Y6 r1 D/ \   while($row = $this->db->GetArray())1 |7 p" y. Y0 I3 ]9 B  t
   {+ T# H! q+ a4 `
    $row['url'] =  GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
4 `4 e1 g1 |  O; I
    $row['url'] = !ereg('http:',$row['url']) ? $GLOBALS['cfg_basehost'].$row['url'] : $row['url'];
3 Z* @, X8 G. m3 K! v. k+ f5 r   
/ ]# s7 q6 f) x7 r    if(!empty($row['url']))
; D, t/ D, {0 u0 Z    {9 z: i7 P, M6 r. g8 t
     $archives_list[] = array('title' => $row['title'],'writer' =>  $row['writer'],'pubdate' => $row['pubdate'],'url' =>  $row['url']);  W1 p3 O, [, [! S) `6 ], A( t
    }3 y) f( w, i' O- ~# @1 G
   }
( Q) X2 k# k' \, d; q
   $return = array($name, $archives_list);& E9 Q9 P/ y* @& l6 _; f. H! D
   return $this->_serialize($return, 1);
! y3 ^; d1 f) B4 m; g* D9 x# o}
+ {  S/ `1 A0 V) C8 M- w. t* i
function synlogin($get, $post)
) J9 l. V$ ^' j. C) C* Y/ l{
/ x2 K! w, j7 F9 x0 u$ b+ G   $uid = $get['uid'];$ x2 Q% h" Z% ^& i
   $username = $get['username'];
0 Y) M3 X# h7 |: o; Z   if(!API_SYNLOGIN)
  X! j8 I2 N3 D* |9 f6 X: k   {6 W5 w- D. I/ T! m
    return API_RETURN_FORBIDDEN;& c6 k) Q  {, ~& P
   }

& ?9 U2 I4 i8 Q8 P   //note 同步登录 API 接口7 ^. W: K- A9 g+ Z( ?! ]) C
   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');% j. L8 ~' \0 d8 x" G: G
   $result = $this->db->GetOne("SELECT mid,pwd FROM
`dede_member` WHERE `userid` like '$username' AND matt<>10");) k8 n: M; Y% |* f3 K; T
   if(is_array($result))
) I$ Y9 e9 |1 l1 Y( R   {
+ e' V4 ~5 \. G9 Y  s+ j    include_once DEDEINC.'/memberlogin.class.php';
) g2 Y5 j3 b% s( a8 O' Z" |3 \    $cfg_ml = new MemberLogin(86400);
* @. Q& J# C5 L7 {6 r" ~- y    $cfg_ml->PutLoginInfo($result['mid']);
( z# i7 _& r$ M" W  O) J   }
1 B# l7 [! `* T5 U   else* U% Z* J- E# U. c4 D+ _' ]1 o
   {   
- b' X4 {+ Q1 B/ g+ A; g& M    //如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie
4 k9 B$ s) x! ?    //会员的默认金币9 Q* K8 P' z" Z. l! k, R* j% j
    $dfscores = 0;
& T. x) `7 c& b! s" t: [; U! I9 L    $dfmoney = 0;2 Z3 K4 [: s+ x9 m- W- w
    $dfrank = $this->db->GetOne("Select money,scores From
`dede_arcrank` where rank='10' ");' M2 W4 ~9 H6 d7 b* K8 L
    if(is_array($dfrank))
- [8 s$ ]0 O) Z    {
8 C& J2 l- N; D# ^/ ?     $dfmoney = $dfrank['money'];, j& l/ ]5 `, E; b: L
     $dfscores = $dfrank['scores'];
" i9 d7 J: `* G9 n4 K    }6 X8 }# v% A! B+ J) ~* \$ d
    $jointime = time();5 ]5 X& W( P8 a: F& o
    $logintime = time();
8 X! B. F& N$ v# ]# e, O! Q    $joinip = $get['regip'];
+ j2 @8 \& g! R* }    $loginip = $get['regip'];: N; f/ j3 q8 d+ }4 j# [; d- l
    $pwd = $get['password'];
9 a: j9 `8 o; p4 G9 P   
2 K/ p. e: Q" p    $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);$ C" V; q3 \6 j& [5 @+ ~
    $mtype='个人';
) N/ Y3 y2 e! o    $email=$get['email'];
. r% c3 |( j8 N8 Y   ( ^7 Q' [' Q8 L# X" v
    $inQuery = "INSERT INTO
`dede_member` (`mtype` ,`userid` ,`pwd` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,
, S2 {* D/ i* Q0 }    `matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )% z. ^* ?# A0 ?
     VALUES ('$mtype','$username','$pwd','$username','保密','10','$dfmoney','$email','$dfscores',: s. m3 R  P% S4 x
     '0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip'); ";
, q8 K" X  w- S* q# `% z! ]   / ?8 s( v) H3 l' H$ T5 n4 P  u
    if($this->db->ExecuteNoneQuery($inQuery))/ @2 a) b2 ]) ?$ L7 C/ w. c
    {   
) I5 \4 V+ ?1 D# }% p* n8 m     $mid = $this->db->GetLastID();$ f) y& {  o3 W- m) d
  7 @0 M- m/ [" f4 X3 S1 b
     //写入默认会员详细资料- S2 T  K( n: B) l2 G
     $space='person';
5 u7 d3 P; W. A; P7 u' N9 N: q  ; u7 P- T8 F8 d6 Z: z7 |* z! P
     //写入默认统计数据4 C6 d  V5 j" p0 O, f: b
     $membertjquery = "INSERT INTO
`dede_member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)2 A8 h3 P/ _: ^) Y
                 VALUES ('$mid','0','0','0','0','0','0','0','0'); ";
; C& ]7 n- P* r5 ?/ H+ \9 S8 J     $this->db->ExecuteNoneQuery($membertjquery);
, H3 n& `% v  _5 j+ d( [  2 Y5 o5 }$ }. _/ L/ z
     //写入默认空间配置数据4 f8 R7 t1 V% R
     $spacequery = "Insert Into
`dede_member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)3 r; Q* a1 ~  z3 D- E, s
               Values('$mid','10','0','$username的空间','','$space','',''); ";
, u$ e. H; ^' |" ]     $this->db->ExecuteNoneQuery($spacequery);, N) E; Z( _' Y6 x- P6 K7 v
  % w  J  Z: D( m/ ]+ j
     //写入其它默认数据
" V! E6 R* {7 q/ X: e: Z" t     $this->db->ExecuteNoneQuery("INSERT INTO
`dede_member_flink`(mid,title,url) VALUES('$mid','织梦内容管理系统','http://www.dedecms.com'); ");: z. F1 R' _& o
   
  S& v- `/ R- P2 ?* g: W% n4 f     include_once DEDEINC.'/membermodel.cls.php';
, C8 ?6 A( D% \% N   
0 E$ z- P! x! l* n  X% ^     $membermodel = new membermodel($mtype);4 V$ I  P2 D. l, o  n- v
   
. }7 S! I/ w$ a, @" v0 @     $modid=$membermodel->modid;
; b" a& X# Z1 R     
; U- x, |/ z" V+ S3 I- m     $modelform = $this->db->getOne("select * from
dede_member_model where id='$modid' ");
- ^3 G: Z+ A2 Y1 C; ^- n   
1 b$ s& A& v. k! S( [1 Z" {/ [     $this->db->ExecuteNoneQuery("INSERT INTO `{$membermodel->table}` (`mid`) VALUES ('$mid');");
! m5 m. o" d* }& ~        
, ~& e4 N  \# y     //----------------------------------------------/ [: ~% ^( D$ U
     //模拟登录1 c- P% u, O+ G. ?' U0 P* g
     //---------------------------, ?1 k+ n7 i( t
     include_once DEDEINC.'/memberlogin.class.php';  e: ^' u; D9 l+ v% p' n. t
     $cfg_ml = new MemberLogin(7*3600);" g. H- ]! b0 f2 Y$ M- n" n
     $cfg_ml->PutLoginInfo($mid);   
9 q# S5 c0 g" ]/ q   
' n" B  h$ V$ d  q: o' u" ?    }
/ U3 k; `+ r( @/ G% o   # z% r6 c# g+ x6 h. ]
   }9 C/ E5 f2 n3 S' }3 j, ?+ L* j
}
5 c7 I. f' }4 @3 V5 m0 I; c% f
function synlogout($get, $post)
5 r' v* U* E% l  I, c+ }" c{( e% y; b2 S; H/ O+ v& J
   if(!API_SYNLOGOUT)& q' {6 @. t" z  ^/ J+ S' N0 V7 W
   {. R, l0 x! b& `: A0 j* A; t
    return API_RETURN_FORBIDDEN;
# c4 N$ ?$ F- q! Q6 |, d9 b, i   }

2 b( S) ?1 T1 _: A( c   //note 同步登出 API 接口  ~/ `/ r6 m4 X
   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');1 }0 m% w2 [; |! g% K- k
   include_once DEDEINC.'/memberlogin.class.php';
1 k9 o' z* v8 t   $cfg_ml = new MemberLogin();3 H( N; s! F1 s# n1 [0 R
   $cfg_ml->ExitCookie();$ ?6 J9 k% ?6 k/ ]
}

6 N* @- c) Z: S0 V+ d* F. }- W0 ^function updatepw($get, $post)
' ^+ \7 D% a5 c$ [{: s) o( q7 |! N# u$ E  n/ F' A! U
   if(!API_UPDATEPW)
% C# P* K7 G6 c   {+ Y. w$ u" o8 T0 @2 G8 R1 H6 Y
    return API_RETURN_FORBIDDEN;7 J4 W- o+ s- M5 O& F9 C
   }
' v: \# ^5 x3 W+ _$ R   $username = $get['username'];' u% d1 \& V9 z" \) N0 F' C
   $password = $get['password'];: A* G8 f& K/ X* O
  ) }# f0 _9 m" m6 H0 P
   //note 修改密码 API 接口
( v% `. K5 F+ c% v0 \) H   $newpw = md5($password);
! ^! s) i1 z7 I9 O: C0 E$ ~) A+ ^   $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `pwd`='$newpw' WHERE `userid`='$username'");; ]  A( ?! L0 t5 D1 x" w$ q
   return API_RETURN_SUCCEED;& v  R: |: X" l3 a* B
}

6 {3 c, q- w- Efunction updatebadwords($get, $post)
" d: |) W) |* X6 Y7 [{4 t$ A/ o# M. [5 x
   if(!API_UPDATEBADWORDS): @# l6 M! ^) I6 C& ~" v0 R
   {) g1 i( H$ {0 ^$ K
    return API_RETURN_FORBIDDEN;( w9 ^; z% R7 g8 d$ v1 t* n( `
   }

6 D$ R8 ]) u+ N; @   $row = $this->db->GetOne("SELECT `value` FROM `dede_sysconfig` WHERE `varname`='cfg_replacestr'");% U" ~7 t! B/ m2 a
  ) [$ E; X  v, |+ M! A! P; ]
   $badwords = isset($row['value']) ? explode(",", $row['value']) : array();0 ?" n& }$ G5 L+ J2 H" e
  # J* n1 Y: A2 I: s( C4 D
   if(is_array($post))
& H3 ]- n: X# y# Q* n   {9 C# }8 `+ L: P# A1 ^6 q
    foreach($post as $k => $v)' f' o6 H8 _# ^( w1 [; E
    {! B$ {$ ?' P4 b! z; e& x% V7 l* S7 f
     if(in_array($v['find'],$badwords)) continue;
3 @' x  I- z/ T9 W) S     $badwords[] = $v['find'];
; H7 k1 C$ H1 ~8 v    }
" U2 ?' Z) b7 s% l   }
& {: q1 _3 }* U6 a8 }' A
   $badwords_comma = !empty($badwords) ? implode(",", $badwords) : '';9 k2 ^; }# Y" ]
  

. V/ c  L" ^6 a4 G& c   $this->db->ExecuteNoneQuery("UPDATE `dede_sysconfig` SET `value`='$badwords_comma' WHERE `varname`='cfg_replacestr'");( [( T1 Z4 \# c: q. d9 l! ?
  
& Q+ a. t; d+ l* H* H& V   $cachefile = DEDEDATA.'/config.cache.inc.php';
7 @: A% a" p7 V1 d9 o  % d. Y; W: M: W, t
   if(!is_writeable($cachefile))- N% @9 C9 H9 Y7 d; x6 F
   {# R- c, o, D/ m0 ^3 k  L- n
    return API_RETURN_FORBIDDEN;9 J+ t' G/ H& f3 h* l
   }
& d& C" `$ l% B" T# w8 t' c4 ^$ p4 l
   $fp = fopen($cachefile, 'w');2 @" M/ y$ c1 s1 ^
   $this->db->SetQuery("SELECT `varname`,`type`,`value`,`groupid` From
`dede_sysconfig` order by aid asc ");
8 G' T6 I7 |8 m$ G, q/ c   $this->db->Execute();
8 f- g1 J: z+ |3 y. o5 E# d# C   $s = '<?php'."rn";
$ }$ ]9 C4 k1 }2 v% \/ }   while($row = $this->db->GetArray())/ [/ E9 U# v4 ~
   {
$ i. ]+ h2 U) @  j% r: t3 M. O3 \! _    $s .= '$'.$row['varname'].' = '.($row['type']=='number' ?  $row['value'] : "'".str_replace("'",'',$row['value'])."'").";rn";9 y2 q2 O+ v% e2 E' B' E
   }
6 D3 w+ I7 d4 }" i; y9 }   $s .= '?>';# S7 N. i5 @0 Y  g: V6 F/ E" F
   fwrite($fp, $s);
2 S' M9 `" C( U! z' @* ]2 D   fclose($fp);
/ ]9 H2 E2 z) {( O6 ]- B* Z   return API_RETURN_SUCCEED;8 m4 k" a! @% g& J3 R
}
! H' n6 ]6 t' |! k; U6 j( d
function updatehosts($get, $post)$ m- `: W* I7 l6 Q0 H6 R. c
{7 K5 W3 j3 o' y1 ?% }* Z; K7 C5 I
   if(!API_UPDATEHOSTS)
9 t& E" a0 O3 O8 `. l% k4 n. V   {
( f6 D5 ?8 q7 B% x) c    return API_RETURN_FORBIDDEN;$ [; s/ K1 p- M5 C9 ?. b
   }
2 K4 M. j, m* V& I   //note 理新HOST缓存 API 接口
& z2 f8 X# u0 c7 g) o4 r   $cachefile = UC_CLIENT_ROOT.'/data/cache/hosts.php';& k( v! Q. R4 Y* F  p4 [! |& n
   $fp = fopen($cachefile, 'w');* W" g$ w" H/ K) g
   $s = "<?phprn";4 {+ j4 e  w9 ~2 F$ _; i& `0 F. |
   $s .= '$_CACHE['hosts'] = '.var_export($post, TRUE).";rn";$ t1 d6 A" C* c6 k
   fwrite($fp, $s);
. a+ t0 J4 R3 C1 y   fclose($fp);
& P& u" I" g' ?/ R2 l% o   return API_RETURN_SUCCEED;4 ~& |+ u- ]% N2 k0 B# Y2 H* T' l
}
/ i3 U9 l. x1 ]5 d
function updateapps($get, $post)
0 n% e, s' O) r: R$ f, l1 o* m3 m{
. b# D0 w) H' ~2 E) I! O   if(!API_UPDATEAPPS)
( s2 ]$ q# F* h$ c5 ?   {9 N% a+ @, `- H0 l
    return API_RETURN_FORBIDDEN;1 `0 z+ C; r+ t7 c6 u& D4 c# G
   }
7 `& p# Q5 F3 U! K. H2 `8 r- b) g   $UC_API = $post['UC_API'];
( p% S/ R7 y' N% H# C
   //note 写 app 缓存文件
" q9 [/ v" X& U% n) r0 y) A   $cachefile = UC_CLIENT_ROOT.'/data/cache/apps.php';
3 X6 q: A& x0 Y/ w   $fp = fopen($cachefile, 'w');% U, V' z/ h( E7 \8 _: T
   $s = "<?phprn";
$ N" q  b7 Y! S! K9 X   $s .= '$_CACHE['apps'] = '.var_export($post, TRUE).";rn";/ d& f; ~0 h' S8 i
   fwrite($fp, $s);
" w% e/ O) _2 n$ d7 D   fclose($fp);
+ r5 S0 w) j! A9 a4 m# q
   return API_RETURN_SUCCEED;2 X7 X" K2 c8 J6 e1 u/ k
}
4 _5 Q$ A2 J9 J$ l
function updateclient($get, $post)' v  _2 l- O* `4 x1 M5 B1 n
{9 c* u7 |, M) b4 ]
   if(!API_UPDATECLIENT)0 i' N" }0 e# n$ {0 v* D5 Q3 L& Y
   {# Q2 |1 o8 Z( e3 \8 e0 @. L/ M" Q
    return API_RETURN_FORBIDDEN;
2 j6 ^+ }0 k( ~- o4 S: h+ s   }% r" P2 B# L1 Z$ R% C' I5 Y
   $cachefile = UC_CLIENT_ROOT.'/data/cache/settings.php';) o2 W0 I- ^. u. J
   $fp = fopen($cachefile, 'w');# Q* c, [7 u. x
   $s = '<?php'."rn";
0 p9 N0 _( O; L* [2 p$ c   $s .= '$_CACHE['settings'] = '.var_export($post, TRUE).";rn";
$ h: A. P. [7 R; o! f7 N% A& w   fwrite($fp, $s);
6 d) g) Z' E2 `% K' F  u   fclose($fp);
: r9 B! ]  K, l' W! }  
, s, G( T* w4 v. Y5 G   return API_RETURN_SUCCEED;) [! a  F+ Z1 R' [/ M1 [2 I, j/ A
}

! j8 I; {( X4 |$ ifunction updatecredit($get, $post)
8 @2 F$ c; K" Q% d* p& D{
7 E% `0 c+ p5 u1 K2 _8 W+ F   if(!API_UPDATECREDIT), `3 ^) E6 N- S1 S; G9 [0 j6 V
   {
- t3 I# m, [4 c7 M7 X* x# z8 w    return API_RETURN_FORBIDDEN;
) ?- f9 H$ Q: c: y   }
! ?+ _$ V1 c1 s# {   /** {( A2 k; H/ v; I+ t# Z
   note 更新积分
1 X. G- h8 ?& c3 S- X: K! S3 Y   discuz 默认8个积分表达,而DedeCMS只有一个积分字段,scores.注意money不能做积分来用.- S" A! u0 o- I+ O
   extcredits1 extcredits2 extcredits3 extcredits4 extcredits5 extcredits6 extcredits7 extcredits8
  o/ ?7 v2 {+ B$ `   */
% S- w8 |3 h9 r6 w    - k( p& i1 E# S4 G4 R
   $credit = intval($get['credit']);" ~; n8 N, e6 ~6 ^! |3 ?; @7 f% [
   $fileds = $credit > 1 ? 'money' : 'scores';, ]1 ]. S0 F0 N8 Y! K2 f! X
   $amount = $get['amount'];# E9 x7 X' S" o3 N! ]) _
   $uid = $get['uid'];; {+ P6 i7 d$ e3 X; B
   include UC_CLIENT_ROOT.'/client.php';
" F7 ~* Y& i1 W) X# y8 A   $data = uc_get_user($uid,1);. d  A: f5 @& c) M" f/ y
   $username = $data[1];
! q5 ~/ j3 l( R' L; u  
2 r  q: h. u2 l  B' y   $result = $this->db->GetOne("SELECT mid FROM
`dede_member` WHERE userid='$username'");
- S+ Q# _& F9 r! V4 R$ `' |5 G   if(is_array($result)), {# `/ w- J- B+ l0 i4 G; z9 {
   {
5 Y! n" |: x  R% s4 S/ ^3 C    $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `$fileds`=`$fileds`+'$amount' WHERE mid='$result[mid]'");, l" h0 v: N1 }1 Z
   }  [) X( }. W$ ^/ c! N" A
  0 b! V7 r3 W# Z& P. n3 A& J% {
   return API_RETURN_SUCCEED;. Q, b+ A) T' L: p: D  m( R0 c
}
& b) ?4 s$ I  f* U4 w
function getcredit($get, $post)
! Y3 s* q& N0 L- A. N{
6 ?8 v; l  D4 V   if(!API_GETCREDIT)/ k$ a. j+ J, c/ n+ {% O0 f# x6 X! Y
   {& k! Z" V5 _. s
    return API_RETURN_FORBIDDEN;9 e; v" C5 H; c7 y# J' {" z
   }
' ]3 S: b/ E+ Q4 w$ o/ f0 [  ' p3 {1 O3 B3 k5 [% X# z
   include UC_CLIENT_ROOT.'/client.php';
8 ^' g5 q! w' ?7 {. N9 v   $data = uc_get_user($uid,1);
. Q8 e8 e; X1 H! {5 u( g( p   $username = $data[1];- I. H2 C: `2 s0 i" o; S2 H; E) V) P6 l
   $credit = intval($get['credit']);
- T; X2 B7 F' @7 U   $fileds = $credit > 1 ? 'money' : 'scores';
' i5 H2 C% J' d* a9 C   $result = $this->db->GetOne("SELECT `$fileds` AS credit FROM
`dede_member` WHERE userid='$username'");- c2 c) l3 V7 ?, A* l
  ) r7 R5 v6 i9 G# Y
   echo is_array($result) ? $result['credit'] : 0;  3 W: S0 ^/ ]* u) L
}
' e" D# v% Q- |# c3 s0 f
function getcreditsettings($get, $post)
5 ?* x8 {, _# |: e3 b{
. T  W( ~7 B1 z2 R   if(!API_GETCREDITSETTINGS)- D2 q' a1 \; r' b- H+ s  \2 h! {6 g
   {
8 R$ p4 e" V8 F) s) A    return API_RETURN_FORBIDDEN;0 ~0 i1 s" H9 ^" e4 I
   }* H" H4 B. M1 i3 M, D3 ?
  
0 a, Y6 s+ z" X# d, h   //这里支持DedeCMS积分,金币设置  Y6 A3 `/ F( r
   $credits[1] = array(strip_tags('积分'), '分');. F7 s8 a2 H3 f) |2 h
   $credits[2] = array(strip_tags('金币'), '枚');1 d+ g; g0 w7 N
   return $this->_serialize($credits);
! S# o  ]8 P* L1 g}
( \, H+ n& w4 }! Q
function updatecreditsettings($get, $post)  F4 I$ Q5 X1 t( ]% p9 g
{
  g6 O+ X* y* g1 ]8 N* L  e/ r  v   if(!API_UPDATECREDITSETTINGS)
0 ]0 m9 n6 \; o3 L' Z4 E   {
. \  Y' B$ ^6 D6 z. a    return API_RETURN_FORBIDDEN;. P' P& d* C% ?: J/ s
   }# Z+ I; J, X* b8 `4 X' Z1 c
   $credit = $get['credit'];
( S0 Z$ M9 E6 t) {2 Q   $outextcredits = array();
. d% l. w) Q" A# D   if($credit && is_array($credit)) {3 b$ W7 ?) m# U- R. @  R$ M
    foreach($credit as $appid => $credititems) {
7 Q! E+ k+ C+ @- y8 Z8 E     foreach($credititems as $value) {
! _% I$ T9 }8 S) g2 T9 R      if($value['appiddesc']!=UC_APPID) continue;
, g; R, S( T) v& \. w      $outextcredits[$appid][] = array(
/ C! ]% H9 m/ R' I1 H  x+ B, G       'appiddesc' => $value['appiddesc'],
$ s" H2 {; e: {  r2 k5 a  `       'creditdesc' => $value['creditdesc'],
6 w- J% w$ C/ f1 ?- }0 ~- v       'creditsrc' => $value['creditsrc'],1 h$ h+ A) k+ {2 A
       'title' => $value['title'],# r6 u' C  q* E" N; Q3 ^' B6 b
       'unit' => $value['unit'],
, {, w7 G" I7 U, k8 E       'ratiosrc' => $value['ratiosrc'],
6 _1 t! N5 Q: L7 ~' B7 o3 k4 ~       'ratiodesc' => $value['ratiodesc'],
8 o7 A4 j' ?5 u: k" g& G3 t5 [- R       'ratio' => $value['ratio']. h% y; t# F' U
      );
. G" }! I7 ?/ ^4 a" m     }6 Z) o7 I( M& C9 t( x: r
    }
: h, Q6 D1 A9 ^2 ~& E   }
! i+ y' g" @* \$ b5 F   $_CACHE = "<?php !defined('UC_API') && exit("403  Forbidden!");n".'$_CACHE['credit'] =  unserialize("'.addslashes(serialize($outextcredits)).'");'."rn".'?>';. x  d$ g( R3 B0 ~$ n
   $fp = @fopen(DEDEDATA.'/credits.inc.php', 'w');1 |3 r- R6 [$ M" t) o' _. e' G
   @fwrite($fp, $_CACHE);6 G/ Y2 J; L( R5 N" O- M% Y" ~5 V
   @fclose($fp);
2 f, e0 V8 t; ^( N  P) _( D   return API_RETURN_SUCCEED;
# j+ d- F4 c) w3 |}
6 z2 \% a1 g; W}
$ P  v& C( e9 a1 e( B9 f$ |1 w

+ K5 N/ K) |! Y1 m  {  ufunction _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ W3 E% ?5 _* _4 t% t# _7 I1 n% B$ckey_length = 4;

: P* P8 j3 y; O; `% F7 g$key = md5($key ? $key : UC_KEY);2 `# Z, N% C. c
$keya = md5(substr($key, 0, 16));6 S) k- j5 J# |8 p/ f
$keyb = md5(substr($key, 16, 16));
" k4 c% ~5 t1 T3 O; u* p$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0,  $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

  I- v# Q5 e# G( T+ z9 a$cryptkey = $keya.md5($keya.$keyc);, z3 ?9 k4 n8 I; ~% D' I4 K7 W1 p& N
$key_length = strlen($cryptkey);
8 n, y! \, I* T* V3 f
$string = $operation == 'DECODE' ?  base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ?  $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
8 r- B, y5 ?% R4 V$string_length = strlen($string);
* ~+ T, R$ L0 e9 {4 q
$result = '';4 o9 j/ _3 ^- U+ @. \$ d
$box = range(0, 255);
: o" t# g* E# E! J/ y+ D$ F
$rndkey = array();
; T  d! v! [$ Z- I& D5 [8 B$ {for($i = 0; $i <= 255; $i++) {4 y$ `- Z" ^3 Q
   $rndkey[$i] = ord($cryptkey[$i % $key_length]);! I3 m% ]4 E0 G" ]) D
}
7 c4 E8 p+ h. P& c& b
for($j = $i = 0; $i < 256; $i++) {- P: [' o/ }: w' d6 H8 V- B- a. B. T
   $j = ($j + $box[$i] + $rndkey[$i]) % 256;3 y) b, v& j8 a5 h  @$ w
   $tmp = $box[$i];% A! e6 A" ^9 n6 g
   $box[$i] = $box[$j];+ q2 q+ ^- N- N# x7 j  ]; ?) c
   $box[$j] = $tmp;
+ _7 A; Y2 Y: }* e& o& s}
3 K; V: l% d7 `4 R- S
for($a = $j = $i = 0; $i < $string_length; $i++) {
% s5 c3 Q' t# n, j   $a = ($a + 1) % 256;* N% m7 o: e) t( n% l
   $j = ($j + $box[$a]) % 256;
5 z# T: D) e+ ^# ?  e3 [( Q   $tmp = $box[$a];
+ U" x( k! L1 X5 z0 d  y   $box[$a] = $box[$j];
3 h1 e4 W) |1 i1 H/ n6 g# c   $box[$j] = $tmp;6 O7 u* D( [- Y# E  h$ u* }
   $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
7 z' Q$ d/ Z/ R( ?! z% b$ L6 Y/ }}
, `& l& A/ L5 |- i0 r! E( e" V8 j* d& R
if($operation == 'DECODE') {
2 h0 ^& |3 J0 I& |' N   if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time()  > 0) && substr($result, 10, 16) == substr(md5(substr($result,  26).$keyb), 0, 16)) {* j$ }( w- t- s( K% A/ R
    return substr($result, 26);9 z$ {5 m. g+ O  n
   } else {
4 a1 u9 K3 U! b! J' u3 y7 q9 _     return '';2 j3 O- b5 J2 ^
    }; P. C) `6 p0 W+ D5 V' |6 f
} else {
, X$ W& D/ d( e- I6 A6 Y   return $keyc.str_replace('=', '', base64_encode($result));
* i# k- J% |! `7 h8 R}
5 V+ `; s( X. L$ v( ]9 g
}
" c7 k% N7 O, C/ Ffunction _stripslashes($string) {4 j* ~5 m* b, Y! q/ ?1 m
if(is_array($string)) {
0 Z  I) E& D6 S3 Z2 H: E   foreach($string as $key => $val) {
( X' o  r5 d+ @# E    $string[$key] = _stripslashes($val);: C  p, m% _  q# O! H6 E
   }. y7 A2 ?, s# Z( @7 E0 I2 e1 [
} else {
, C, Y/ Z, k: m' c- v0 _) T   $string = stripslashes($string);
6 g  q; \3 d$ G/ f3 i6 X2 n}0 L: I* [( j7 e: u2 y
return $string;
; ^1 X7 N% i! e! U) D/ Q}
$ ]5 P; L1 a5 s* g8 V
?>
7 y0 y& o( U/ O  l0 k  a) D; A, l
) O. f7 }6 F7 K & `4 g& C+ q  M, v. I, g
            

0

主题

5

帖子

20

积分

1°伸手党

Rank: 2

积分
20
发表于 19-10-29 05:28:19 | 显示全部楼层         
好好 学习了 确实不错
回复

使用道具 举报

网站简介

球球发,是一家 Discuz! 商业插件、风格模板、网站源码、 Discuz!运营维护技术等于一体的交流分享网站,全站95%的资源都是免费下载,对于资源我们是每天更新,每个亲测资源最新最全---球球发(如果我们有侵犯了您权益的资源请联系我们删除