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

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

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

765

主题

779

帖子

3万

积分

董事

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

积分
33029
发表于 19-4-26 21:18:01 | 显示全部楼层 |阅读模式      紫钻仅向指定用户开放  
                dedecms整合discuz同步登录与退出并且不用激活4 v7 h# C# d1 Q/ i6 x/ Y

& }1 @* p3 @$ ^+ ~    弄了一天,问题总算解决了,不过有点投机取巧,下面说下dedecms整合discuz后会员注册后不用激活的实现,以前做站时,一直在想,dede和 dz整合后,会员在网站注册后到论坛能不能不再激活,看着可不舒服,现在总算解决了,闲话不说了,下面进入正题,百度也不让发附件,只有啰嗦点了,呵呵, 比较长,分3篇:
8 ?9 S- I' G* w1.首先找到dede-〉api-〉uc.php文件
; Q0 C$ {9 a/ l打开uc.php,将内容替换为:. ?4 w$ C) ]' J! S5 ?  ]
<?php
( n  q! M  p2 C/**************************二次开发说明**************************************
- L$ |" @/ c% F6 J
此模块应用于DEDECMS5.6版本,请替换API文件夹的UC.PHP,替换后,通过DEDE注册的用户,
. ?7 E! c, K: y0 y( R7 @5 S访问论坛系统可以免激活,实现同时登陆同时退出。
4 F2 o2 Z8 z3 n- H' @  ?*****************************************版权:
http://www.zzjie.com**************/5 n3 @5 p7 u7 ~7 F4 H
include_once (dirname(__FILE__)."/../include/common.inc.php");; b" Y1 y! t% D  d4 f2 m
define('IN_DISCUZ', FALSE);

- a0 Z# ]5 ^7 d& q, _/ ^# ]define('UC_CLIENT_VERSION', '1.5.0'); //note UCenter 版本标识  |; W% ^' [# h1 ~0 J( Z
define('UC_CLIENT_RELEASE', '20081031');
2 y( e+ [4 ^0 L
define('API_DELETEUSER', 1);   //note 用户删除 API 接口开关$ L+ U* u- r7 f6 T3 N7 K0 F
define('API_RENAMEUSER', 1);   //note 用户改名 API 接口开关
" X; r/ u7 R' T$ ddefine('API_GETTAG', 1);   //note 获取标签 API 接口开关) [" W" k  o# Z4 [/ E# G
define('API_SYNLOGIN', 1);   //note 同步登录 API 接口开关
! _( L" {( z" y4 ?define('API_SYNLOGOUT', 1);   //note 同步登出 API 接口开关
* G  C% n9 B& E$ s3 Z. X( i# @# gdefine('API_UPDATEPW', 1);   //note 更改用户密码 开关
. Z6 ]0 r+ l) F$ e7 t1 q) wdefine('API_UPDATEBADWORDS', 1); //note 更新关键字列表 开关9 x7 X7 t5 Q* u5 A/ W5 m& X
define('API_UPDATEHOSTS', 1);   //note 更新域名解析缓存 开关
9 S: r( ^; t0 @- Z4 ]% bdefine('API_UPDATEAPPS', 1);   //note 更新应用列表 开关
2 t! r6 B$ s& w, S; _, Idefine('API_UPDATECLIENT', 1);   //note 更新客户端缓存 开关
  D, }2 w1 {/ V% Tdefine('API_UPDATECREDIT', 1);   //note 更新用户积分 开关
& A5 I0 j: `0 e- v& Y' kdefine('API_GETCREDITSETTINGS', 1); //note 向 UCenter 提供积分设置 开关
9 C/ q% b7 W1 R- `9 u8 V; ?* z; j/ cdefine('API_GETCREDIT', 1);   //note 获取用户的某项积分 开关
" r" M3 m" T! w; u8 Ddefine('API_UPDATECREDITSETTINGS', 1); //note 更新应用积分设置 开关
/ N4 i% v8 C# a# M: T
define('API_RETURN_SUCCEED', '1');9 D: ?/ n: i8 ^* K8 w
define('API_RETURN_FAILED', '-1');" T& M# K5 z3 p" M' S# q
define('API_RETURN_FORBIDDEN', '-2');

. d7 A/ Z* x6 a" Cdefine('UC_CLIENT_ROOT', DEDEROOT.'/uc_client');: q( N, c2 r+ V+ Z) @, Q
//note 普通的 http 通知方式7 r5 Q- v8 l" R! Z. |% J; f
if(!defined('IN_UC'))$ x( t; ?* T" i' h/ h$ N
{
$ x2 E7 g4 x) T1 y
error_reporting(0);0 K. Z; \# H3 D9 X
set_magic_quotes_runtime(0);
1 C" x0 O6 k; rdefined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
: M& Q7 j0 j1 i0 d
$_DCACHE = $get = $post = array();5 T1 l0 D# j. u# T
$code = @$_GET['code'];
7 o; i% ~& _& j6 Pparse_str(_authcode($code, 'DECODE', UC_KEY), $get);2 B8 m0 F. w& ]/ c. H
  G9 ^, {2 v& N6 g$ G
if(MAGIC_QUOTES_GPC)2 b3 x- e+ L4 n+ v! k& l, n
{- A1 z0 F; W0 d- }4 l  G! ^
   $get = _stripslashes($get);$ J. x  t# \$ k6 B8 \: F
}

8 D/ T9 p' |1 e$timestamp = time();  f* A0 S; {9 {# M
if($timestamp - $get['time'] > 3600) {
7 V6 \6 G9 j1 D2 v1 [   exit('Authracation has expiried');# r. Y: Y' ?9 D3 x5 H8 a# G
}* g6 z9 P( h( l) J0 X. D( w
if(empty($get)) {  F* x, e4 G, X1 Y0 S
   exit('Invalid Request');
' L. d2 ?# |3 J. w! ]9 g( @}( J% J$ q6 R7 b
$action = $get['action'];
8 u2 e6 v$ c4 I- q
require_once UC_CLIENT_ROOT.'/lib/xml.class.php';: [) s( [* F* V/ L! }" J
$post = xml_unserialize(file_get_contents('php://input'));

0 O0 `( s( C$ cif(in_array($get['action'], array('test',  'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout',  'updatepw', 'updatebadwords', 'updatehosts', 'updateapps',  'updateclient', 'updatecredit', 'getcreditsettings',  'updatecreditsettings')))2 q, w( a2 r, G* r# c8 v
{
# {: z( J4 A" E- X   $uc_note = new uc_note();
8 v) w3 ]: @& G& M1 P- Q   exit($uc_note->$get['action']($get, $post));& k" B* X0 N4 c  N. l3 p
}else{
, k2 C4 w! W1 v* c+ q3 Q9 I0 c   exit(API_RETURN_FAILED);
6 S5 H( l; [# g8 \1 ]/ C; P}

" p( L  B2 g! H//note include 通知方式
* e( X: S# b0 U8 Q# j; x  I; Y} else {
* k0 z1 r+ \8 F& E
exit('Invalid Request');4 K$ k  l$ \0 ~
}
8 i1 U  o8 ]9 W
class uc_note. j4 V! o, G. S, x9 p8 J& ?' d
{
) R3 r- g" y5 h7 ^9 K+ u
var $dbconfig = '';
& s0 o" u0 O8 \var $db = '';  L; `9 t7 ?! X# Z0 l
var $appdir = '';
, F/ {6 S& r' J: K; Xvar $tablepre = 'dede_';) U  I, H; a% U# A, s6 L4 H
/ P, c' c' W5 q! m$ [. i" k& l
function _serialize($arr, $htmlon = 0)+ L/ X9 K; J8 _+ d- H  P
{3 o7 m3 N1 Y3 [  Z' B: o
   if(!function_exists('xml_serialize'))
2 Z- Q- _9 C5 p   {
8 E) g+ U* l/ Z8 o! \1 l    include_once UC_CLIENT_ROOT.'/lib/xml.class.php';
. l* O! w  r# U6 h+ N+ d   }
0 s1 k8 p" g  A! E1 }& v7 T   return xml_serialize($arr, $htmlon);, T; z. u+ ?8 G& V6 o" M7 [
}

7 P8 k5 }9 k5 z8 ^function uc_note()' J6 ]5 v, J% |. M  c0 k
{
+ j( M4 ?9 C9 a- m/ r3 s- d; q# p   $this->appdir = DEDEROOT;
& k/ B* f& u8 C+ n  [2 q$ H# @   $this->dbconfig = DEDEINC.'/common.inc.php';
1 K% p2 C8 n0 l4 u   $this->db = $GLOBALS['dsql'];$ E0 M1 |5 ^+ v5 Y
   $this->tablepre = $GLOBALS['cfg_dbprefix'];
) Z5 V# V2 R  X  q- `2 N1 i}
: x5 M( o2 q. I  u: X# [
" M9 I6 V( k' R4 f; q- n/ x; efunction get_uids($uids)
& n2 y9 f8 ^/ `0 O4 |& F( V{% E' g. q8 I  }" M8 U7 \9 R
   include UC_CLIENT_ROOT.'/client.php';
6 L7 W, n4 ~% _  
" c) [% I  Y' Q7 [- y   $members = explode(",", $uids);5 o, D2 S, H8 c8 x3 h
   empty($members) && exit(API_RETURN_FORBIDDEN);$ _# ^$ V( [  n
  
5 m# g2 F* e# V( j' w: K! ]2 K   /*$members_username = array();
7 _$ N) m9 Q8 A( a  
; G0 @7 _- ~: G   foreach($members as $id)9 O: V5 T2 P2 I
   {, ]9 X+ d, e) G/ Y! S
    $row = uc_get_user($id,1);1 v/ s' E$ G  n: m. w& o! Z) @1 _* j
    $members_username[] = $row[1];  
$ q' w+ F' N* i2 y% m; w/ Y   }8 U" u( T1 k9 b( [; ^. V' i2 s! [6 a
  : n' t" _9 f/ z# Z
   $comma_temps = implode(",", $members_username);2 J3 M) Q0 q6 Q! G  M6 |
  , u3 i7 r& b9 R& }: S5 s
   empty($comma_temps) && exit(API_RETURN_FORBIDDEN);& S% |. N' D' k5 S2 ?( a! g5 @
  
& s* Q% b( F9 X# ]- `; p6 A   $comma_uids = array();*/: c! F0 `' `, R* u$ x8 i1 W
  
& e  p* ~) c4 x$ a$ h7 z# p   //$row = $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE userid IN ($comma_temps)");
2 Z2 G7 |4 O, M5 J( _9 z. j, @* I  
0 L! }, n( H; k0 `! @' \   $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE mid IN ($uids)");
7 [; O: \. n& ]* n! Y7 C+ O3 `8 e   $this->db->Execute();  - P4 n, T( p( Q) k
   while($row = $this->db->GetArray())
) ?" U) y- t3 a   {
+ K" u) B  F, F' ~4 w    $comma_uids[] = $row['mid'];% F% d! u) B" K$ [
   }$ \% ?; u; E% @8 ?
  - X' M0 e5 V. k" o
   empty($comma_uids) && exit(API_RETURN_FORBIDDEN);
  \# K4 d" m, a. R* J  $ j1 f$ A6 L; y
   return implode(",", $comma_uids);: @/ P$ f' O4 N* b3 H
}
$ B. @3 s! t0 h5 X) q
function test($get, $post)1 a/ g4 C5 ?) O* _& e
{6 _& m! ^9 o% h5 [1 ~' p$ c
   return API_RETURN_SUCCEED;' x, h- C$ i. Y+ V8 q) s
}
& C3 p, o& w% \, V; l  z5 z
function deleteuser($get, $post)
. g1 y$ S! o+ {3 I{
  }- e8 ?% c! T9 i1 J) p   $uids = $this->get_uids($get['ids']);5 Z1 \4 Q, |. a( W
   !API_DELETEUSER && exit(API_RETURN_FORBIDDEN);

% ]2 K: w! j4 @6 G7 ^: b4 D3 v8 f  O   //note 用户删除 API 接口
3 [% M. C( L4 |   $rs = $this->db->ExecuteNoneQuery2("DELETE FROM
`dede_member` WHERE mid IN ($uids) AND matt<>10 limit 1");
: K/ [. U, A6 L8 l! n' e5 o- P   if($rs > 0)
, ?7 m) m4 V% Q8 I) d   {
- y2 C3 a4 A% e' k7 t3 O% N    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_tj` WHERE mid IN ($uids) limit 1");
( U5 a4 A9 @( T3 [. ^4 B    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_space` WHERE mid IN ($uids) limit 1");# u2 ^( ~; ?# y4 i+ o
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_company` WHERE mid IN ($uids) limit 1");" Z8 N% a2 `. G; D! d/ d+ [* S
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_person` WHERE mid IN ($uids) limit 1");5 H, @3 {! o; E: \; ]
  
  i! t7 m" |9 g% _0 ^/ a7 n    //删除用户相关数据5 L: U7 M& |8 k1 n  \
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_stow` WHERE mid IN ($uids) ");
5 I- S1 Y! Z1 t( V2 \6 ?    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_flink` WHERE mid IN ($uids) ");, N$ {: P4 t% a5 A- J. A) q  S
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_guestbook` WHERE mid IN ($uids) ");
* K  m+ o8 I& \* }/ {6 E' c    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_operation` WHERE mid IN ($uids) ");% ?" ^# ]0 f, k* o; c
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_pms` WHERE toid IN ($uids) OR fromid IN ($uids) ");
5 d2 c, L" a2 T3 t    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_friends` WHERE mid IN ($uids) OR fid IN ($uids) ");
* s. M* D$ o% Y) S6 l) `, _    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_vhistory` WHERE mid IN ($uids) OR vid IN ($uids) ");
* o  ]; Y( \. j4 |& V/ }  O% c5 |    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_feedback` WHERE mid IN ($uids) ");5 M. R; h" O* n6 i) p1 w4 p
    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET mid='0' WHERE mid IN ($uids)");  ?. z; J& i& f! s
   }( r+ D0 _" G0 t$ W
   else
2 d' W' }: x- a( s- [; l& y   {/ U$ j2 o5 B0 a4 }. \$ Z; _( R  J
    exit(API_RETURN_FORBIDDEN);6 U8 R; x- M3 M3 R- K
   }
. F- f8 N) j* w1 ]5 Y# {, u
   return API_RETURN_SUCCEED;) {0 k5 {& e/ F+ w- o
}
" n1 e) a# A# X0 m
function renameuser($get, $post)
' s5 U) }8 c- l" l' Q3 Y; G{
. n8 G& G2 j9 J) D   $uids = $this->get_uids($get['ids']);
3 f7 f# B% i/ ]& F  v  ( D' f* I, J- `3 h& t: [' y4 v
  
. Q0 _9 l2 c/ W! e   $usernameold = $get['oldusername'];& p; _. p- l- V# p+ k( w- R
   $usernamenew = $get['newusername'];
$ p1 j  i, z! t0 q/ e1 v4 r   if(!API_RENAMEUSER)
4 Q$ b% h+ U! ^: R8 e. |5 M   {2 \  c$ g' `  ]
    return API_RETURN_FORBIDDEN;* o# R9 K" [/ p2 U: Y4 m
   }
+ j+ H3 F2 E- U; p* X. _# f( y
   //note 获取标签 API 接口$ {# ?1 E% P; V" E6 c( k. o
   $rs = $this->db->ExecuteNoneQuery2("UPDATE
`dede_member` SET userid='$usernamenew' WHERE userid='$usernamenew' AND matt<>10 limit 1");; Z; b! |4 Q- C  r" _) p
   if($rs > 0)9 p4 d! f) I" `. q
   {" W5 ^2 |" @- K$ C( F' S  F
    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'");7 j2 b6 {/ }% K& M$ U0 Y8 n
    $this->db->ExecuteNoneQuery("UPDATE
`dede_member_pms`  SET floginid=REPLACE(floginid, 't$usernameold',  't$usernamenew'),tologinid=REPLACE(tologinid, 't$usernameold',  't$usernamenew')");
3 V" R4 f5 K/ L" n" t: `   ( h; D1 M- x, D* z& ?# u6 U
   9 F1 C* i  O  j1 p0 Z
    $row = $this->db->GetOne("SHOW TABLE STATUS");
* ?- k7 z! c( \- K# p+ Q    $db_tables = $row['Name']; unset($row);
% C) \3 }. b6 @8 G# M   ' i1 p" Q, E3 {# P9 k) c3 W
    if(in_array($this->tablepre.'guestbook',$db_tables)). w: H$ H, h; M. ?3 N, K+ |
    {& T' x  |3 m- {
     $this->db->ExecuteNoneQuery("UPDATE
`dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
+ c4 W1 E0 ?- H2 s1 |6 x# r    }
! i  o1 A' q& [   - n9 n( F% l4 g+ a# V7 |  Y: P
    if(in_array($this->tablepre.'story_books',$db_tables))5 p# ]8 T1 Z! p4 H/ b
    {
& {2 O$ e: {; F. S7 `     $this->db->ExecuteNoneQuery("UPDATE
`dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'");' k, L8 C* `' C
    }4 ~. |: c- ~: p0 B  t9 G# Z/ N; u
   & F& F4 `; l  ?# A, W
    if(in_array($this->tablepre.'groups',$db_tables)): L( t1 q9 j! f7 S5 ~/ f+ ?
    {3 E3 b- w! L* s" ?# J( D  l, E
     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'");* b- S, u+ _0 O$ ]+ @- Q
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'");
$ n; V5 D6 }, B, T; F7 t     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'");% c- y, D' A- _7 F* I6 B
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'");1 p6 s2 \9 \; t# |  ^) g
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");& O3 T# q- f$ \# W2 b; v
     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET ismaster=REPLACE(ismaster, 't$usernameold', 't$usernamenew')");
% E) N% {* f/ s" L    }+ ~% E; {+ C9 }6 H/ r
   ) Z3 m* }2 f6 O
    return API_RETURN_SUCCEED;
/ b0 J( V( d1 N: A, }* [   }
' U! R4 c9 h$ M! T* q: X9 C3 C, t   else
$ M" ~' a$ q$ b" e   {2 o- W& u/ c5 h7 J9 u7 y
    return API_RETURN_FORBIDDEN;0 `1 d$ e& K" v$ {9 i, Z
   }) q( e* k. Z1 y9 O
}

* l: i8 z. E2 j# ^7 Kfunction gettag($get, $post)
. w8 C! D7 b4 N1 R{
$ Z0 q) a: c1 E; j6 X: F+ r   $name = $get['id'];4 C1 N8 g- B" n
   if(!API_GETTAG)
/ g  u- `" i5 d' s9 L   {3 a+ w5 j: p/ D+ d$ x0 Q" T' O
    return API_RETURN_FORBIDDEN;
# R, x4 N" m/ k  z+ D6 O+ f, F   }
& R+ O8 B+ j8 h
   //note 获取标签 API 接口
4 X, ^' [) K" ^# U! y: _   $name = trim($name);
1 v7 j# Y" A" S* \' f& t   if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/', $name) || strlen($name) > 20)
0 ~: \* p  [+ E& s; Y" ~8 U   {) Z% o' U9 z# ~5 D# x" Q. p& f
    return API_RETURN_FAILED;9 t! |- m' R/ ^/ @5 F6 D
   }

5 \, ^, m  V8 A7 ]: G   $row = $this->db->GetOne("SELECT `total`,`id` FROM `dede_tagindex` WHERE `tag`='$name'");* ?7 H5 k. ~# v- o$ {1 b6 Q
   if(!is_array($row))
8 F; u4 ]+ C0 `9 M* Y1 @   {
6 r- M; B0 q7 i% u    return API_RETURN_FAILED;. _: Y/ [+ k  a
   }
7 x, A! n: Z5 F$ W! I8 [  - M" ?; \8 G# k( A5 t9 V
   $tpp = $row['total'] > 10 ? 10 : $row['total'];  
$ m5 W! D9 {# b  g$ c+ w  ) ^& p8 A& v6 i% P: w
   $ids = array();* o8 p2 E9 {/ n# [5 ]  l: @
  
/ J, T9 q3 y0 B, W% }" |1 s1 w   $this->db->SetQuery("SELECT aid FROM
`dede_taglist` WHERE `tid`='$row[id]' AND arcrank>-1");" g. m3 i& |5 J9 }* ?, q# ~
   $this->db->Execute();
, h4 l9 `4 u5 @+ g0 a0 O1 n   while($row = $this->db->GetArray())
$ J& K' f' U8 l   {
% P5 g7 c( o* B. h, ^0 n* o8 o    $ids[] = $row['aid'];   + V$ R' }( H) D& m
   }  B0 ^$ M1 h+ U5 D$ Y$ y! S/ m4 W1 ^% d
  
( E+ ]! K6 p& ?/ T) d# \4 m   if(empty($ids))
; b) T! b' V2 e; D' z! D   {: n5 ^0 l8 x3 `7 ]; Z, ^
    return API_RETURN_FAILED;$ C2 Z4 {% Q# L. i
   }- S; R+ y1 X$ z+ C2 J* i6 c
  
# a) Y) p" U* {$ u- O   $aids = implode(",", $ids);( w9 V. a- K9 {3 @6 \3 ^
  9 I0 l2 N" F' T6 F9 N2 O( v
   include_once DEDEINC.'/channelunit.func.php';2 \8 k/ B6 v' o& j
  
, R. q1 Q0 C) ?1 P( ^( [# l   $archives_list = array();  2 g6 _( @% P4 |" A' j3 Y- X0 W
   $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  ; g  r3 g9 \% A( a
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");
$ ?9 \. b3 ^" i! Y/ |+ Y0 [   $this->db->Execute();
8 r/ n. X/ |: I% a' y" d   while($row = $this->db->GetArray())
4 ~6 K  P; d( y+ b   {
2 f# [( y! a' Z, P, b/ Y    $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']);

/ P4 U( X1 A: u7 X) W    $row['url'] = !ereg('http:',$row['url']) ? $GLOBALS['cfg_basehost'].$row['url'] : $row['url'];
1 ~/ ], c; ~! g9 M: H8 |4 v, D   
# Q+ W9 D- F: z- n! A    if(!empty($row['url']))
- Y. Q: w2 s' B" U; i    {
' Y  A% Q" |" {* G$ b     $archives_list[] = array('title' => $row['title'],'writer' =>  $row['writer'],'pubdate' => $row['pubdate'],'url' =>  $row['url']);
  B  y2 B5 b, D- e2 F5 Y' Y% g    }$ X4 q8 H: C8 U. M
   }

- e9 P+ f1 R2 @4 ]( d9 v- S   $return = array($name, $archives_list);
6 d: b" t; s( \; [   return $this->_serialize($return, 1);- h+ J1 h) v. N0 D4 R3 r6 `
}
3 V1 i5 c: D  a# ^6 ]
function synlogin($get, $post)& ^: k1 H; @/ I3 `6 O! z9 {7 l
{
, ?& M& M1 h+ d0 O  [   $uid = $get['uid'];
  \5 o4 h3 Q: P6 g   $username = $get['username'];
+ ]9 q1 B, T% s% }% s   if(!API_SYNLOGIN)
1 f1 I/ A3 w$ ?   {
! y6 b. E% u0 f2 x" [* m' Z    return API_RETURN_FORBIDDEN;3 n7 [4 |# p/ U5 ?, G
   }

9 [$ j' h; z" T4 y/ s  B   //note 同步登录 API 接口9 h/ V3 Y& r( e/ Y- {+ w- z& p
   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
- l( |6 Z7 z! H+ \" A+ M/ l: m+ R   $result = $this->db->GetOne("SELECT mid,pwd FROM
`dede_member` WHERE `userid` like '$username' AND matt<>10");
( c1 x, [$ T* o/ X3 N: z   if(is_array($result))
% a9 y7 m; @" |   {. ?# z. P, r/ }9 [& s8 U
    include_once DEDEINC.'/memberlogin.class.php';
2 ?/ Y1 [8 S* B) j/ }/ L; W    $cfg_ml = new MemberLogin(86400);8 X+ ^6 c1 E7 M, D5 R
    $cfg_ml->PutLoginInfo($result['mid']);) l. q$ q7 ?% P7 n: A0 b% F  E; e
   }, H6 X+ L, u1 X% P
   else7 m8 d, u1 K3 ?. F5 ~/ l
   {   
5 ~* P1 {, w$ P/ r    //如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie& w5 R9 h. E# l
    //会员的默认金币! d, T3 z6 ?! ]" \
    $dfscores = 0;
' t. X4 n' _& l6 b5 o    $dfmoney = 0;! W& i2 x! |" x& }+ ]) O) B
    $dfrank = $this->db->GetOne("Select money,scores From
`dede_arcrank` where rank='10' ");
; s, N8 {) s+ g7 f. D    if(is_array($dfrank))
. p' K/ I. _6 u$ |+ k    {
) c& ~2 T; ~4 C     $dfmoney = $dfrank['money'];1 T* a6 q% l6 ~7 U; M+ Q
     $dfscores = $dfrank['scores'];3 b5 b2 f+ {9 T0 o
    }4 A/ W) H2 R5 E: t% L
    $jointime = time();
. n$ K6 t. g* f/ Y3 F; G    $logintime = time();. U% }5 A" h% X! Q2 M. c2 C, L
    $joinip = $get['regip'];+ L. I  O4 E2 `* J7 {  m
    $loginip = $get['regip'];, l' u6 V" Y; C2 Z. n1 W
    $pwd = $get['password'];
0 I) h/ e+ [2 l: J   
, Q. ~; z' Z8 T; \+ G    $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);7 i* |8 x3 H2 c
    $mtype='个人';
+ A) D5 T* E( l; J    $email=$get['email'];
% m  k1 L9 w, o# i   2 ~$ x7 r& ?$ Z! _1 N& j. D5 d- E$ E& D
    $inQuery = "INSERT INTO
`dede_member` (`mtype` ,`userid` ,`pwd` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,
) K: D$ M) H# m+ P) l# C2 H    `matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )0 s3 X$ P  x) f
     VALUES ('$mtype','$username','$pwd','$username','保密','10','$dfmoney','$email','$dfscores',* y  C0 j& |( `8 J
     '0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip'); ";5 [% G, X/ g) I1 b$ j$ C8 y1 v. E
   + T2 M/ C) h, B9 o+ w/ f
    if($this->db->ExecuteNoneQuery($inQuery))
# m9 `5 z) P$ k: \/ Z    {   
  y4 p& j2 a+ P' s9 p     $mid = $this->db->GetLastID();% `) p$ _1 O! ?
  
, t2 Q* F  W* n0 f' k4 F     //写入默认会员详细资料- _3 x# |/ S3 ~2 F9 o
     $space='person';
* e; K3 Y) G, f" e& T( @  ) S/ i  z1 ]/ d0 U+ R: ^, G& K% C( Y
     //写入默认统计数据) X4 v8 U" ]1 d
     $membertjquery = "INSERT INTO
`dede_member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)! {) L* ?5 q* l% e# u& h  I
                 VALUES ('$mid','0','0','0','0','0','0','0','0'); ";6 K2 z4 [; N& i2 z$ r) V' ^
     $this->db->ExecuteNoneQuery($membertjquery);) e1 M* g1 k6 H$ ?1 H' O6 @9 w% n
  
9 o: m) E- R% f+ ~/ p& ?7 E2 [     //写入默认空间配置数据
( s+ l  ^0 \3 _* Z, F' ?( g     $spacequery = "Insert Into
`dede_member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)
. l+ T) w( s; z0 g' x               Values('$mid','10','0','$username的空间','','$space','',''); ";
# B3 I3 Z! T( G! T  b# Q7 A     $this->db->ExecuteNoneQuery($spacequery);) m' h- k) Z" d& n. v$ W
  
! |, e) C: k1 z: S- b" T5 w     //写入其它默认数据9 o! n2 Y. j' @# L
     $this->db->ExecuteNoneQuery("INSERT INTO
`dede_member_flink`(mid,title,url) VALUES('$mid','织梦内容管理系统','http://www.dedecms.com'); ");
/ O- ]2 X) y) v0 H' j   
5 o  ~, O5 r* Y6 f" E     include_once DEDEINC.'/membermodel.cls.php';
6 U0 Z1 }, V0 h    9 x$ t- [# O8 a( b( h
     $membermodel = new membermodel($mtype);' O* ~, s' G. l2 U: ~& @
   
& x) Q8 h. D+ L     $modid=$membermodel->modid;  f% R, e$ J" T2 S2 n9 X+ `
     & |2 d3 m( }9 |( T( U* V
     $modelform = $this->db->getOne("select * from
dede_member_model where id='$modid' ");
- G  W( r1 j% ^8 x/ s- u   
% h+ R* c6 C, T/ W" @5 K     $this->db->ExecuteNoneQuery("INSERT INTO `{$membermodel->table}` (`mid`) VALUES ('$mid');");
! H7 H4 E+ s  p# h0 C        3 d5 D  T' G5 T  M
     //----------------------------------------------# |, ~+ g. l+ a; x5 X7 @; n- H0 L+ V
     //模拟登录
2 V* v3 I# a1 p; H7 Q8 G     //---------------------------
) [# y( s' _9 Q4 H     include_once DEDEINC.'/memberlogin.class.php';( |& R7 q0 E. X( c- L
     $cfg_ml = new MemberLogin(7*3600);: Y! b+ ]: m0 f9 Q$ ^' ]
     $cfg_ml->PutLoginInfo($mid);    * v) g* q( ]. B) I$ U4 i# u
    9 g% ]% z" J- E% o
    }
: G0 t% g% G" h7 G1 P0 _2 Y   ' r$ D' y* q0 t3 L; m0 m
   }$ I  b: ?+ y# m1 W) d9 _) `; b0 S
}
5 S) q( d6 B0 n) Q' A
function synlogout($get, $post)
& i5 _6 s  a( I) M" `{
- U- {5 T" k% ~6 G   if(!API_SYNLOGOUT). N7 k2 b5 z; a3 t: p" e" D. G7 _: y
   {! Z: q" X- W, G. O1 D! `/ a0 t
    return API_RETURN_FORBIDDEN;9 a. z9 k% w/ G+ [1 ]
   }

: a  i, ~- O9 u" D" ^$ ~   //note 同步登出 API 接口( f4 j1 ?" N/ c1 t
   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');- S/ D" N4 u* S) u
   include_once DEDEINC.'/memberlogin.class.php';- j$ ~+ @* ]" J2 c/ d/ F  ~& k2 z
   $cfg_ml = new MemberLogin();
! G9 X* R3 i7 M2 T! w- a: O7 M   $cfg_ml->ExitCookie();
7 N0 a% q% i$ q) O0 i}
0 @6 h! b/ k- |0 s' ?  s
function updatepw($get, $post)
$ y$ S2 U% y6 \" s( Z/ A{, K3 |4 w+ [$ j# v( O3 Z: p2 j* Z
   if(!API_UPDATEPW)
& s4 C% h4 e$ z   {
3 w4 ~" |! V' b    return API_RETURN_FORBIDDEN;
- O4 v: q  k- b* Z' N  L   }; [! `% R5 R, B) B
   $username = $get['username'];
( E3 u. v8 C5 z' Y# e1 {   $password = $get['password'];
. v! z4 e/ l6 o# Q+ \# }1 x  2 U. a8 m8 `% d+ c( C5 N# G6 U
   //note 修改密码 API 接口# R! j2 _2 s5 f1 b% R* t
   $newpw = md5($password);
- `, j) w8 }' z" A# s6 K   $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `pwd`='$newpw' WHERE `userid`='$username'");
0 U0 {6 t% U$ a) ~9 l( n4 n  _   return API_RETURN_SUCCEED;- U/ ^- h  b& k) I
}

! `6 R0 S9 _" E1 W. G  ?function updatebadwords($get, $post)
: c6 p; h% j5 S  v" G6 ?{1 e) C- f# |2 S- O8 g6 r4 k
   if(!API_UPDATEBADWORDS)
. N2 e( G8 o- L   {9 S' [4 H! ]# s
    return API_RETURN_FORBIDDEN;# [4 e! L) b& e' T
   }
" l- N0 K8 c% t  T$ H
   $row = $this->db->GetOne("SELECT `value` FROM `dede_sysconfig` WHERE `varname`='cfg_replacestr'");& _7 _$ `7 W& @, Q! W' j9 u
  
1 X; s3 M; o4 C0 b. m   $badwords = isset($row['value']) ? explode(",", $row['value']) : array();. k: v# U8 V  V7 b: H1 ?/ ]$ Y2 ^. D, Z
  9 C2 T( W0 k* S2 ^: S3 P4 x  P( b( l0 U
   if(is_array($post))
  K& l. W5 g- h, d( p   {
, q. ~) }  K1 c; w# D    foreach($post as $k => $v)
* C! ?" g1 O- O. r    {* Z" T0 g* l, F: m2 g
     if(in_array($v['find'],$badwords)) continue;
5 f! e/ }& D6 g2 Q; o     $badwords[] = $v['find'];; F5 Z- p6 f. t4 r) N- }/ ]
    }6 n% e. t4 Y3 J# s" W) P+ |/ b5 m
   }

9 O! h8 P& s+ h0 F+ S- Q   $badwords_comma = !empty($badwords) ? implode(",", $badwords) : '';
/ b5 f4 R4 }, ^3 {& o5 W  

- C( q4 _& t. y0 t8 C3 M( z3 i   $this->db->ExecuteNoneQuery("UPDATE `dede_sysconfig` SET `value`='$badwords_comma' WHERE `varname`='cfg_replacestr'");& D3 Y7 E4 U' s9 M" X, O
  9 p+ ?; O. G+ e4 t( Q
   $cachefile = DEDEDATA.'/config.cache.inc.php';
& K" \( p& R+ y# L  
& ~; ^# O) n2 k9 o7 z0 Q6 l+ f   if(!is_writeable($cachefile))
1 t" t4 k2 w( ]2 W   {
$ Q* f8 \2 h$ x* E, K* U- p2 f    return API_RETURN_FORBIDDEN;0 U4 E  {  ^8 \9 Q& p! i
   }
" s6 h, ?4 u( @: R
   $fp = fopen($cachefile, 'w');. n9 Q, L! u0 Z
   $this->db->SetQuery("SELECT `varname`,`type`,`value`,`groupid` From
`dede_sysconfig` order by aid asc ");! w" L) R7 h* v" b$ V
   $this->db->Execute();; I* Z# Y9 l6 M8 n& w# P, B1 g
   $s = '<?php'."rn";6 Y7 l  m5 w' J* U, U9 F: Q
   while($row = $this->db->GetArray())6 B4 D6 ~$ |/ P9 H$ v
   {
6 r1 d! W% d. A- E& s    $s .= '$'.$row['varname'].' = '.($row['type']=='number' ?  $row['value'] : "'".str_replace("'",'',$row['value'])."'").";rn";0 Y4 w# x9 _1 h5 R3 m+ }
   }
. D9 \( V7 B* D! ~- l+ |7 _   $s .= '?>';7 D+ G2 L2 C1 @  A2 A* C. o/ w; H8 P
   fwrite($fp, $s);
" x4 Z4 n1 q/ ?5 @4 @% k, Y" o& ?   fclose($fp);) |7 b+ H0 Z' d6 Q5 Y
   return API_RETURN_SUCCEED;
5 r) F$ h& p# g5 {( f, Y}

# d" S4 q  I* |* Cfunction updatehosts($get, $post)
; S* A5 t* a. v" ]0 Y- K( s{( z5 n. x0 M% _4 K$ @
   if(!API_UPDATEHOSTS)
4 s8 D, n3 b& n( r! y* C5 z7 z7 J   {
: J( |! r; U5 s/ @3 D0 H, y0 d    return API_RETURN_FORBIDDEN;
3 }' o/ P6 k5 K  v( r; _, L% W   }
$ L7 A; e3 c6 t$ g) @2 u; h   //note 理新HOST缓存 API 接口
  L* c- a% k8 s. U% y; i   $cachefile = UC_CLIENT_ROOT.'/data/cache/hosts.php';  q! y! K$ Q# |: G# O
   $fp = fopen($cachefile, 'w');9 n6 }3 |6 i) `9 y+ m- g: t
   $s = "<?phprn";" H0 z: W. u$ _
   $s .= '$_CACHE['hosts'] = '.var_export($post, TRUE).";rn";# T4 p  W) s8 s" K
   fwrite($fp, $s);
6 w' M3 x1 ]* E' z1 X! Z, F7 a" ^   fclose($fp);3 a1 |+ u$ m, R5 r- R
   return API_RETURN_SUCCEED;0 _5 }" `  ~7 M  ~- K  W8 H
}

1 D- n: Y: H# mfunction updateapps($get, $post)
: L/ e  L7 s4 L{
  Z$ I9 u6 m' J! T& l* f   if(!API_UPDATEAPPS)
  q8 \  z- L' l4 m' i   {; Z6 ?$ B- {) [: p
    return API_RETURN_FORBIDDEN;- k* j7 }/ `# f  e% I+ m
   }
& |( o  L' h1 j- ^7 n   $UC_API = $post['UC_API'];
$ N7 S# Q- v. ^! ^" P  W/ e2 h
   //note 写 app 缓存文件3 i0 n" s# A3 K/ @7 _& g2 O& n
   $cachefile = UC_CLIENT_ROOT.'/data/cache/apps.php';2 P4 X) q1 n  n' p9 ]# c
   $fp = fopen($cachefile, 'w');$ {$ D' k& d! q' d  s
   $s = "<?phprn";
1 J* l  r  q5 C' Y: U) k4 q   $s .= '$_CACHE['apps'] = '.var_export($post, TRUE).";rn";
* |/ c/ y& v" L$ \# `( ?   fwrite($fp, $s);/ ^! {; F8 W' V+ @
   fclose($fp);
, A9 ^/ ]" s. v  a6 o/ ~* {; C
   return API_RETURN_SUCCEED;3 k# N- E3 ]4 X+ K0 X4 S
}

$ i# K' z: p- Y. S; L; @function updateclient($get, $post)' [6 G- r* Q0 A; \; V# X
{
+ k, D" S  u/ _: l  ]   if(!API_UPDATECLIENT)6 i, a( c$ r# O
   {
8 p+ G) B' [% B6 f/ z    return API_RETURN_FORBIDDEN;# X" q* x$ X0 j" c3 l5 @. ]- J
   }
" w1 I0 e# y, x& S) [+ r$ Y   $cachefile = UC_CLIENT_ROOT.'/data/cache/settings.php';
$ @# x! Y. c" x. C   $fp = fopen($cachefile, 'w');
, ?, T+ b+ Y$ L- W% m   $s = '<?php'."rn";, j( |! O. M, O( G6 q
   $s .= '$_CACHE['settings'] = '.var_export($post, TRUE).";rn";
7 I" `+ @- i- C6 P2 Q5 Z* y   fwrite($fp, $s);
; N1 M: ?+ F- W# M  @1 M   fclose($fp);, K1 I+ h; a9 q. r8 d: F
  / e, `& t& p7 l& G' D( @
   return API_RETURN_SUCCEED;. |! x& G0 o0 o7 Z+ F: I6 d% L
}

& l; q  W# u) i" }function updatecredit($get, $post)) N4 i9 i/ Q3 p* U! D  g7 i5 \( x
{
1 a, |. S) u, {. K6 Q   if(!API_UPDATECREDIT); g/ C/ t4 }# H
   {/ Y% W6 ]- Y1 r: Y: |7 Y
    return API_RETURN_FORBIDDEN;2 O" o8 a, R5 I4 o% v" P
   }
9 C8 f, k! M* T" j& `9 D5 f   /*
) _4 Z) S. I1 G6 Q9 w7 W% P   note 更新积分, d+ |7 T* `2 q0 v- t, F( q
   discuz 默认8个积分表达,而DedeCMS只有一个积分字段,scores.注意money不能做积分来用.& o0 j) `8 f5 o8 d
   extcredits1 extcredits2 extcredits3 extcredits4 extcredits5 extcredits6 extcredits7 extcredits8
; h3 q2 K: a3 E& G   */
" A/ Z+ h1 B# x, T: }) w    9 T4 C  M, [8 f: o2 o( y% R
   $credit = intval($get['credit']);0 s8 X: G9 t1 R2 P) M3 u  Q
   $fileds = $credit > 1 ? 'money' : 'scores';
* g1 i9 U4 t! w0 }/ B. _; }; ~4 _- [   $amount = $get['amount'];/ q" |: G$ D) _$ t7 @+ J5 ]
   $uid = $get['uid'];
; I! y: B" W3 v+ M: E# p. Y; L   include UC_CLIENT_ROOT.'/client.php';
# r3 Y7 j; U! H1 ]) R. O   $data = uc_get_user($uid,1);% J# y/ e7 T! U
   $username = $data[1];- t( ]) Y4 Q/ `
  ; q  T/ U. D9 f1 K6 C9 Q, b
   $result = $this->db->GetOne("SELECT mid FROM
`dede_member` WHERE userid='$username'");: l4 K8 a* X+ \- D
   if(is_array($result))
, E% a0 [1 A- G! q/ P; L: u) V   {) a3 n. @( K. N, X4 S  Y0 A* w4 W
    $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `$fileds`=`$fileds`+'$amount' WHERE mid='$result[mid]'");
' s5 Z4 g$ m$ p1 ?7 b$ }   }- u' U; m! ~, N, L4 Y$ |
  . @4 m# Z2 a% ?. m" ^
   return API_RETURN_SUCCEED;+ D3 b+ v6 P& t! ~3 e
}

0 \7 h3 k( L. B! u" h1 B4 Yfunction getcredit($get, $post)( y+ `$ e$ l# i, S
{! L5 ^2 l  N1 K5 P* k
   if(!API_GETCREDIT)- x8 m! T7 k& m/ }- V( M
   {
0 o( q( M' s% v* ?  c, ?9 A    return API_RETURN_FORBIDDEN;/ T" U+ y. e+ t8 z) K
   }: A6 b7 V  R$ j1 u8 _
  
9 E. }! K, N; P   include UC_CLIENT_ROOT.'/client.php';
/ r0 _8 J2 ^4 i5 o# \$ E   $data = uc_get_user($uid,1);
0 M: C* M- O" e6 u) A' u+ ]   $username = $data[1];/ `& @( O7 F% E
   $credit = intval($get['credit']);( S: f( [8 O$ ~& n
   $fileds = $credit > 1 ? 'money' : 'scores';
  g! N' @1 v6 s( B7 R, a/ b   $result = $this->db->GetOne("SELECT `$fileds` AS credit FROM
`dede_member` WHERE userid='$username'");, N+ t& ]  V! P3 w" Z7 `
  % }; r3 i' D/ c( Y0 l
   echo is_array($result) ? $result['credit'] : 0;  8 T7 _) u! ~' p6 E9 \& u# u
}

/ l/ Q* I8 ~8 R. G& t( J( a# bfunction getcreditsettings($get, $post)9 O4 h. Y2 I# d0 Q. n2 n
{
3 y6 O( W* F6 ~   if(!API_GETCREDITSETTINGS)4 u! ]- J: E3 b- L9 c& W
   {
- V7 o. ]) v) H& |3 d    return API_RETURN_FORBIDDEN;0 a& h0 i0 W& M) V
   }
8 r6 T( {6 z) x  _3 y; w* P  ! x1 `. f- K9 P( C/ x. R$ j
   //这里支持DedeCMS积分,金币设置
) q; q) W- L% N   $credits[1] = array(strip_tags('积分'), '分');
0 r' W- z6 I* V# O( a$ D   $credits[2] = array(strip_tags('金币'), '枚');, p8 q  H$ g; a; b
   return $this->_serialize($credits);  j6 z; w% ~0 b9 ^1 }3 a, D
}

( l! b, f1 B9 Ffunction updatecreditsettings($get, $post)% d% x5 q$ [% g1 e! L2 u
{
% F# d1 a& j# w1 a   if(!API_UPDATECREDITSETTINGS)
8 T! y! ?+ [" U   {
" v, n6 L/ \& z6 K. r, k    return API_RETURN_FORBIDDEN;
6 {( I) W, {, T4 b5 K3 a  n/ y   }6 O2 j: n4 p' t$ ?7 b
   $credit = $get['credit'];
# b* [0 Z; y2 }, ^: V0 ~! j   $outextcredits = array();
3 j6 f# h. v! U, m5 x   if($credit && is_array($credit)) {
* E$ a. Z  P) O9 O! P8 F; f1 q    foreach($credit as $appid => $credititems) {
* j: W' N% y* B, \1 F  i     foreach($credititems as $value) {
8 y/ P" Z& v% P7 ~" B" |" J9 c& b      if($value['appiddesc']!=UC_APPID) continue;7 d' F5 t0 _4 Q% |  t/ S5 q
      $outextcredits[$appid][] = array(0 s' C( M, U4 X1 W* t! P
       'appiddesc' => $value['appiddesc'],  p) F* i# e- A; ?( l% e
       'creditdesc' => $value['creditdesc'],- W& z# ?9 F2 z6 s
       'creditsrc' => $value['creditsrc'],# w- b/ G' C0 ~
       'title' => $value['title'],
4 K0 q) _0 Z9 {. p. P7 B. ~0 O% A       'unit' => $value['unit'],; X) o! s! I% Y' [
       'ratiosrc' => $value['ratiosrc'],. u' [# ?+ f+ R
       'ratiodesc' => $value['ratiodesc'],' G  S# W# V4 {3 A: z
       'ratio' => $value['ratio']/ p2 T: {! p7 M9 k' Q: S
      );9 \6 t& p* p( N! ~3 E. R3 l
     }2 U# E, M8 _! f- S' n5 A
    }: f- R; H! P2 S8 s: b+ n, m0 {
   }3 y- [" Q% x4 U/ H
   $_CACHE = "<?php !defined('UC_API') && exit("403  Forbidden!");n".'$_CACHE['credit'] =  unserialize("'.addslashes(serialize($outextcredits)).'");'."rn".'?>';& c" g. Z! a# x" \
   $fp = @fopen(DEDEDATA.'/credits.inc.php', 'w');- e3 g- n1 H* e  _! n
   @fwrite($fp, $_CACHE);
' ^, h( o0 O2 U. T, t1 ^+ j: I   @fclose($fp);
8 }; d4 c& K. B; J4 z3 A- E   return API_RETURN_SUCCEED;; ?. m0 e2 e& B$ M- G/ Q% m
}
* O/ K7 B' U/ C( c$ I}
- t5 l6 N$ P1 _' s
$ k) m1 |, Q, ^( ~
function _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {% X7 B# {4 x% f  O% g
$ckey_length = 4;
+ Z" B7 E& Z8 c, b* c, o" f
$key = md5($key ? $key : UC_KEY);" j* d& x( \  d% a+ w8 {" E
$keya = md5(substr($key, 0, 16));# O" c; W! n0 J/ A7 u; E
$keyb = md5(substr($key, 16, 16));- N& w/ S# f+ ~. _6 [
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0,  $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
# Q8 [3 G* ]% @* P' Y
$cryptkey = $keya.md5($keya.$keyc);# P# X, m6 e' U0 L5 Z  k1 f2 R! p
$key_length = strlen($cryptkey);
# W( E  G7 X5 k% k9 Q$ f1 @$ H
$string = $operation == 'DECODE' ?  base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ?  $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;- M" E% `+ C  m  f- h' u, y
$string_length = strlen($string);
. r6 a+ I& O7 ~, p
$result = '';0 E$ r% e0 a1 [  v& ]
$box = range(0, 255);

) V2 f" e. @: k, U. V: l9 W$rndkey = array();
3 C/ N$ P) y9 B$ Afor($i = 0; $i <= 255; $i++) {3 y+ O( }* d( J2 r6 }2 g- T! n! ]
   $rndkey[$i] = ord($cryptkey[$i % $key_length]);
9 b- x- f) Q3 _! M}

7 l3 g" o% D0 Jfor($j = $i = 0; $i < 256; $i++) {
8 F7 [( S8 C6 }; Q: {   $j = ($j + $box[$i] + $rndkey[$i]) % 256;( t! e  H& s. S: z4 f
   $tmp = $box[$i];: o+ B+ G  b8 g8 D" ?
   $box[$i] = $box[$j];
$ S9 B$ o  x" C. w/ k  c   $box[$j] = $tmp;
# `7 B' H3 p* [8 p& e3 a: h7 X}
. p* ~7 [3 _3 G5 o
for($a = $j = $i = 0; $i < $string_length; $i++) {
8 |) ~3 F" ?/ s5 J  m  ]   $a = ($a + 1) % 256;" y3 |% i( V; h' n) \" `; V0 R& T0 y; G
   $j = ($j + $box[$a]) % 256;
& ?3 @1 I: I5 k( K4 `   $tmp = $box[$a];: W/ ]# W4 n) T' T* n! q
   $box[$a] = $box[$j];
( N* _' F& H! ^   $box[$j] = $tmp;
% h# p' ?3 \2 I3 D% g0 t   $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));7 B% N' s" n+ R3 m9 c
}

. v/ O- S6 q6 A7 g% m1 jif($operation == 'DECODE') {
: B+ R1 f1 V8 a3 i: P  I" q   if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time()  > 0) && substr($result, 10, 16) == substr(md5(substr($result,  26).$keyb), 0, 16)) {
8 g3 C5 X4 v) Q% B( h1 c    return substr($result, 26);
9 \6 f% @' u# H   } else {2 d: ^  r9 J& f/ `" M& F/ E$ H
     return '';
' a! v3 X: D! v4 a- l+ i    }% a- ]. Q0 {( n& |8 t/ H) O+ s  `1 P
} else {3 q! J3 q( T' q% H' H
   return $keyc.str_replace('=', '', base64_encode($result));
5 u$ j/ r7 \1 M! W. l5 \! l% t0 W+ y}
  h" G8 X9 y7 e2 L
}& }- b. M$ \/ _
function _stripslashes($string) {: z* J6 W- L  z6 k
if(is_array($string)) {% s6 u4 Z) V& ?8 S6 E
   foreach($string as $key => $val) {( E8 g% B4 w3 O* H7 n6 e' Y: ^
    $string[$key] = _stripslashes($val);3 C' ^* X: Y1 W  l+ u0 p
   }7 O$ b  e; t) m5 Q/ z" O0 @
} else {8 N/ p0 I) m: W
   $string = stripslashes($string);
3 @* C5 u' C/ c" b# \' R; [}2 ]) i; t4 P9 I  d! y9 r! y4 d! _
return $string;
/ R1 a- U) u7 S9 |& s}

3 Y0 k$ B- g! v4 Z?>" X6 h5 }, v. {, z; U3 s7 w

" t, B/ j0 K& o" D
+ a- ]& g8 Q1 l. l6 F            

0

主题

9

帖子

20

积分

1°伸手党

Rank: 2

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

使用道具 举报

网站简介

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