Esempio n. 1
0
     showtablefooter();
     showformfooter();
 } else {
     if (!$_GET['email'] || !$_GET['passwd'] || !$_GET['repasswd'] || !$_GET['nickname'] || !$_GET['realname'] || !$_GET['tel'] || !$_GET['qq']) {
         cpmsg($installlang['not_fill'], '', 'error');
     }
     if ($_GET['passwd'] !== $_GET['repasswd']) {
         cpmsg($installlang['psw_not_match'], '', 'error');
     }
     define('HD_API_HOST', 'http://api.haodai.com/');
     include_once DISCUZ_ROOT . './source/plugin/dzapp_haodai/haodai.api.class.php';
     $client = new HaoDaiClient('1000002', 'sLXuof1JgsqxssYSkJVXqci4MNHftaxB');
     $client->set_debug(0);
     $config = array();
     $data = array('email' => diconv($_GET['email'], CHARSET, 'UTF-8'), 'tel' => $_GET['tel'], 'nickname' => diconv($_GET['nickname'], CHARSET, 'UTF-8'), 'passwd' => diconv($_GET['passwd'], CHARSET, 'UTF-8'), 'realname' => diconv($_GET['realname'], CHARSET, 'UTF-8'), 'qq' => $_GET['qq'], 'domain' => $_G['siteurl'], 'sitename' => diconv($_G['setting']['sitename'], CHARSET, 'UTF-8'));
     $result = $client->register_union_account($data);
     if ($result['rs_code'] != '1000') {
         cpmsg($installlang['errmsg'] . "<br>" . diconv($result['rs_msg'], 'UTF-8', CHARSET), '', 'error');
     }
     $config['HD_REF'] = $result['hd_ref'];
     define('HD_REF', $config['HD_REF']);
     $client = new HaoDaiClient('1000002', 'sLXuof1JgsqxssYSkJVXqci4MNHftaxB');
     $client->set_debug(0);
     $data = array('app_name' => diconv($_G['setting']['sitename'] . ' ' . dgmdate($_G['timestamp'], 'Y-m-d-H:i'), CHARSET, 'UTF-8'), 'site_url' => $_G['siteurl'], 'desc' => diconv($_G['setting']['sitename'] . $installlang['hd_desc'], CHARSET, 'UTF-8'), 'callback_url' => $_G['siteurl'] . 'plugin.php?id=dzapp_haodai:callback');
     $result = $client->haodai_app_register($data);
     if ($result['rs_code'] != '1000') {
         cpmsg($installlang['errmsg'] . "<br>" . diconv($result['rs_msg'], 'UTF-8', CHARSET), '', 'error');
     } else {
         $config['HD_AKEY'] = $result['hd_akey'];
         $config['HD_SKEY'] = $result['hd_skey'];
         $config['HD_CALLBACK_URL'] = $result['hd_callback_url'];