Ejemplo n.º 1
0
         $alipay = checkemail($alipay, $lang['insenz_register_alipay']);
         $response = insenz_request('<cmd id="checkHandle"><handle>' . $username . '</handle></cmd>');
         if ($response['status']) {
             insenz_alert($response['data']);
         } else {
             $response = $response['data']['response'][0]['data'][0]['VALUE'];
         }
         if ($response == 'handle_exists') {
             insenz_alert('insenz_usernameexists', 'username');
         }
         foreach ($items as $item) {
             $insenz['profile'][$item] = ${$item};
         }
         $insenz['step'] = 2;
         $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('insenz', '" . addslashes(serialize($insenz)) . "')");
         insenz_cpmsg('insenz_regstep2', '&operation=register&agreelicense=yes&step=2');
     }
 } else {
     if (!submitcheck('regsubmit')) {
         echo '<form name="form1" action="admincp.php?action=insenz&operation=register&agreelicense=yes&step=3" method="post"><input type="hidden" name="formhash" value="' . FORMHASH . '">';
         insenz_shownav('insenz_register');
         showtype('insenz_register_step2', 'top');
         insenz_showsettings();
         showtype('', 'bottom');
         echo '<br /><center><input type="button" class="button" value="' . $lang['menu_back_to_last_step'] . '" onclick="window.location=\'admincp.php?action=insenz&operation=register&agreelicense=yes&step=1\'"> &nbsp; <input type="submit" class="button" name="regsubmit" value="' . $lang['submit'] . '" onclick="this.form.target=\'register\';"><iframe name="register" style="display: none"></iframe></center></form>';
     } else {
         $softadstatus = $softadstatus1 ? $softadstatus2 ? 2 : 1 : 0;
         $softadstatus && checkmasks();
         $hardadstatus = is_array($hardadstatus) ? array_keys($hardadstatus) : array();
         $msgtoid = 0;
         if ($softadstatus && is_array($notify) && $notify[1]) {
Ejemplo n.º 2
0
function insenz_register($type)
{
    global $insenz, $db, $tablepre, $_DCACHE, $boardurl, $timestamp, $authkey, $discuz_uid, $discuz_user, $response;
    checkip();
    if ($type == 1) {
        @extract($insenz['profile']);
        foreach (array('username', 'password', 'name', 'idcard', 'email1', 'email2', 'qq', 'msn', 'tel1', 'tel2', 'tel3', 'mobile', 'fax1', 'fax2', 'fax3', 'country', 'province', 'city', 'address', 'postcode', 'alipay') as $item) {
            ${$item} = stripslashes(${$item});
        }
    } else {
        $username = $insenz['profile']['username'];
        $password = $insenz['profile']['password'];
    }
    $insenz['notify'] = is_array($insenz['notify']) ? $insenz['notify'] : array(2);
    $insenz['hardadstatus'] = is_array($insenz['hardadstatus']) ? $insenz['hardadstatus'] : array(1, 2, 3, 4, 5);
    $query = $db->query("SELECT COUNT(*) FROM {$tablepre}members");
    $members = $db->result($query, 0);
    $query = $db->query("SELECT COUNT(*) FROM {$tablepre}members WHERE posts>0");
    $post_members = $db->result($query, 0);
    $query = $db->query("SELECT COUNT(*) FROM {$tablepre}threads WHERE displayorder>='0'");
    $threads = $db->result($query, 0);
    $query = $db->query("SELECT COUNT(*) FROM {$tablepre}posts WHERE invisible='0'");
    $posts = $db->result($query, 0);
    $date = getdate($timestamp);
    $yesterday_end = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']);
    $lastweek_start = $yesterday_end - 7 * 86400;
    $lastweek_pertopics = $lastweek_perposts = $forumstats = array();
    $query = $db->query("SELECT DISTINCT(fid) AS fid, COUNT(tid) AS topics FROM {$tablepre}threads WHERE dateline BETWEEN {$lastweek_start} AND {$yesterday_end} GROUP BY fid ORDER BY topics DESC");
    while ($p = $db->fetch_array($query)) {
        $lastweek_pertopics[$p['fid']] = ceil($p['topics'] / 7);
    }
    $query = $db->query("SELECT DISTINCT(fid) AS fid, COUNT(pid) AS posts FROM {$tablepre}posts WHERE dateline BETWEEN {$lastweek_start} AND {$yesterday_end} GROUP BY fid ORDER BY posts DESC");
    while ($p = $db->fetch_array($query)) {
        $lastweek_perposts[$p['fid']] = ceil($p['posts'] / 7);
    }
    $query = $db->query("SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.displayorder, f.status, f.simple, ff.description, ff.redirect FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff ON f.fid=ff.fid");
    while ($forum = $db->fetch_array($query)) {
        $fid = $forum['fid'];
        unset($forum['fid']);
        $forum['lastweek_pertopics'] = intval($lastweek_pertopics[$fid]);
        $forum['lastweek_perposts'] = intval($lastweek_perposts[$fid]);
        $forumstats[$fid] = $forum;
    }
    $postdata = '<cmd id="register"><handle>' . insenz_convert($username) . '</handle>
		<passwd>' . $password . '</passwd>';
    if ($type == 1) {
        $postdata .= '<name>' . insenz_convert($name) . '</name>
			<idcard>' . $idcard . '</idcard>
			<tel>' . $tel1 . '-' . $tel2 . '-' . $tel3 . '</tel>
			<mobile>' . $mobile . '</mobile>
			<fax>' . $fax1 . '-' . $fax2 . '-' . $fax3 . '</fax>
			<email>' . $email1 . '</email>
			<email2>' . $email2 . '</email2>
			<qq>' . $qq . '</qq>
			<msn>' . $msn . '</msn>
			<alipay>' . $alipay . '</alipay>
			<country>' . $country . '</country>
			<province>' . $province . '</province>
			<city>' . $city . '</city>
			<addr>' . insenz_convert($address) . '</addr>
			<postcode>' . $postcode . '</postcode>';
    }
    $postdata .= '<url>' . $boardurl . '</url>
		<s_key>' . md5($authkey . 'Discuz!INSENZ') . '</s_key>
		<bbname>' . insenz_convert($_DCACHE['settings']['bbname']) . '</bbname>
		<members>' . $members . '</members>
		<post_members>' . $post_members . '</post_members>
		<topics>' . $threads . '</topics>
		<posts>' . $posts . '</posts>
		<softadstatus>' . intval($insenz['softadstatus']) . '</softadstatus>
		<notify>' . implode(',', $insenz['notify']) . '</notify>
		<autoextend>' . intval($insenz['autoextend']) . '</autoextend>
		<hardadstatus>' . implode(',', $insenz['hardadstatus']) . '</hardadstatus>
		<relatedadstatus>' . intval($insenz['relatedadstatus']) . '</relatedadstatus>
		<virtualforumstatus>' . intval($insenz['virtualforumstatus']) . '</virtualforumstatus>';
    foreach ($forumstats as $fid => $forum) {
        $postdata .= '<board>
			<board_id>' . $fid . '</board_id>
			<parent_id>' . $forum['fup'] . '</parent_id>
			<board_type>' . $forum['type'] . '</board_type>
			<name>' . insenz_convert($forum['name']) . '</name>
			<topics>' . $forum['threads'] . '</topics>
			<posts>' . $forum['posts'] . '</posts>
			<lastweek_pertopics>' . $forum['lastweek_pertopics'] . '</lastweek_pertopics>
			<lastweek_perposts>' . $forum['lastweek_perposts'] . '</lastweek_perposts>
			<description>' . insenz_convert($forum['description']) . '</description>
			<status>' . $forum['status'] . '</status>
			<simple>' . $forum['simple'] . '</simple>
			<redirect>' . insenz_convert($forum['redirect']) . '</redirect>
			<displayorder>' . $forum['displayorder'] . '</displayorder></board>';
    }
    $postdata .= '<type>' . ($type == 1 ? 'register' : 'bind') . '</type></cmd>';
    unset($insenz['siteid']);
    $response = insenz_request($postdata);
    if ($response['status']) {
        insenz_alert($response['data']);
    } else {
        $response = $response['data'];
    }
    $status = $response['response'][0]['status'][0]['VALUE'];
    if ($status == 0) {
        $insenz['authkey'] = $response['response'][0]['authkey'][0]['VALUE'];
        $insenz['siteid'] = $response['response'][0]['site_id'][0]['VALUE'];
        $insenz['uid'] = $discuz_uid;
        $insenz['username'] = $discuz_userss;
        insenz_updatesettings();
        unset($insenz['profile'], $insenz['step']);
        $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('insenz', '" . addslashes(serialize($insenz)) . "')");
        require_once DISCUZ_ROOT . './include/cache.func.php';
        updatecache('settings');
        insenz_cpmsg('insenz_register_succeed');
    } else {
        $response['reason'] = insenz_convert($response['response'][0]['reason'][0]['VALUE'], 0);
        unset($insenz['authkey'], $insenz['siteid']);
        $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('insenz', '" . addslashes(serialize($insenz)) . "')");
        insenz_alert('insenz_register_failed');
    }
}
Ejemplo n.º 3
0
         $alipay = checkemail($alipay, $lang['insenz_register_alipay']);
         $response = insenz_request('<cmd id="checkHandle"><handle>' . $username . '</handle></cmd>');
         if ($response['status']) {
             insenz_alert($response['data']);
         } else {
             $response = $response['data']['response'][0]['data'][0]['VALUE'];
         }
         if ($response == 'handle_exists') {
             insenz_alert('insenz_usernameexists', 'username');
         }
         foreach ($items as $item) {
             $insenz['profile'][$item] = ${$item};
         }
         $insenz['step'] = 2;
         $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('insenz', '" . addslashes(serialize($insenz)) . "')");
         insenz_cpmsg('insenz_regstep2', $BASESCRIPT . '?action=insenz&operation=register&agreelicense=yes&step=2');
     }
 } else {
     if (!submitcheck('regsubmit')) {
         shownav('adv', 'insenz', 'insenz_register');
         showsubmenu('insenz_register_step2');
         showformheader('insenz&operation=register&agreelicense=yes&step=3&frame=no', 'target="register"');
         showtableheader();
         insenz_showsettings();
         showtablerow('', 'colspan="2"', '<input type="button" class="btn" value="' . $lang['laststep'] . '" onclick="window.location=\'' . $BASESCRIPT . '?action=insenz&operation=register&agreelicense=yes&step=1\'"> &nbsp; <input type="submit" class="btn" name="regsubmit" value="' . $lang['submit'] . '" /><iframe name="register" style="display: none"></iframe>');
         showtablefooter();
         showformfooter();
     } else {
         $softadstatus = $softadstatus1 ? $softadstatus2 ? 2 : 1 : 0;
         $softadstatus && checkmasks();
         $hardadstatus = is_array($hardadstatus) ? array_keys($hardadstatus) : array();