UCenter应用程序开发简单实例(双向同步)

上传人:壹****1 文档编号:486655682 上传时间:2022-10-04 格式:DOC 页数:18 大小:133.02KB
返回 下载 相关 举报
UCenter应用程序开发简单实例(双向同步)_第1页
第1页 / 共18页
UCenter应用程序开发简单实例(双向同步)_第2页
第2页 / 共18页
UCenter应用程序开发简单实例(双向同步)_第3页
第3页 / 共18页
UCenter应用程序开发简单实例(双向同步)_第4页
第4页 / 共18页
UCenter应用程序开发简单实例(双向同步)_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《UCenter应用程序开发简单实例(双向同步)》由会员分享,可在线阅读,更多相关《UCenter应用程序开发简单实例(双向同步)(18页珍藏版)》请在金锄头文库上搜索。

1、测试环境:IIS5.1 + PHP本程序使用的是PDO,所以php.ini中的extension=php_pdo.dll和extension=php_pdo_mysql.dll必须打开。首先安装UCenter1.5,路径:http:/localhost/ucenter然后进入后台添加一个新的应用,安装方式选择“自定义安装”;应用名称:我的应用1;应用URL:http:/localhost/myapp1;应用IP:;通信密钥先不用管;应用类型:其他;同步登录:是;接收通知:是。添加成功之后返回应用列表,可以看到“我的应用1”通信失败,暂时不用管。在所在的目录下新建一个文件夹,命名为myapp1,

2、拷贝一份UCenter的客户端(uc_client)到myapp1目录下。在http:/localhost/myapp1所在的目录下新建一个文件夹,命名为api,拷贝一份UCenter的api(uc.php)到api目录下,官方Example中10KB的那个文件(但还是有点问题)。在http:/localhost/myapp1所在的目录下新建一个文件夹,命名为include,拷贝一份Discuz的和到include目录下。在http:/localhost/文件,这是本应用的配置文件。在数据库里建立本应用的数据表,一般都需要有自己的数据表。准备工作完成了,下面详细介绍各个模块的代码。本应用程序的

3、配置文件:query(set names gbk);/*define(UC_CONNECT, mysql);define(UC_DBHOST, localhost);define(UC_DBUSER, yutiedun);define(UC_DBPW, 11111111);define(UC_DBNAME, discuz);define(UC_DBCHARSET, gbk);define(UC_DBTABLEPRE, discuz.uc_);define(UC_DBCONNECT, 0);define(UC_KEY, 4961DYjLak6oE0cJq9jNDbxNUzSalwMXq6qp1X

4、0);define(UC_API, http:/localhost/ucenter);define(UC_CHARSET, gbk);define(UC_IP, 127.0.0.1);define(UC_APPID, 5); /根据具体情况设置define(UC_PPP, 20);/*?UCenter接口文件:uc.php 3600) exit(Authracation has expiried);if(empty($get) exit(Invalid Request);$action = $getaction;require_once DISCUZ_ROOT./uc_client/lib/x

5、ml.class.php;$post = xml_unserialize(file_get_contents(php:/input);if(in_array($getaction, array(test, deleteuser, renameuser, gettag, synlogin, synlogout, updatepw, updatebadwords, updatehosts, updateapps, updateclient, updatecredit, getcreditsettings, updatecreditsettings) require_once DISCUZ_ROOT

6、./include/db_mysql.class.php;$GLOBALSdb = new dbstuff;$GLOBALSdb-connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);$GLOBALStablepre = $tablepre;unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);$uc_note = new uc_note();exit($uc_note-$getaction($get, $post); else exit(API_RETURN

7、_FAILED);/note include 通知方式 else require_once DISCUZ_ROOT./config.inc.php;require_once DISCUZ_ROOT./include/db_mysql.class.php;$GLOBALSdb = new dbstuff;$GLOBALSdb-connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);$GLOBALStablepre = $tablepre;unset($dbhost, $dbuser, $dbpw, $dbnam

8、e, $pconnect);class uc_note var $dbconfig = ;var $db = ;var $tablepre = ;var $appdir = ;function _serialize($arr, $htmlon = 0) if(!function_exists(xml_serialize) include_once DISCUZ_ROOT./uc_client/lib/xml.class.php;return xml_serialize($arr, $htmlon);function uc_note() $this-appdir = substr(dirname(_FILE_), 0, -3);$this-dbconfig = $this-appdir./config.inc.php;$this-db = $GLOBALSdb;$this-tablepre = $GLOBALStablepre;function test($get, $post) return API_RETURN_SUCCEED;function deleteuser($get, $post) $uids = $getids;!API_DELETEUSER &

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号