Ejemplo n.º 1
0
function loadInfo($filename)
{
    $logFile = dirname(__FILE__) . '/' . DATA_PATH . '/' . $filename . '.php';
    if (!file_exists($logFile)) {
        return false;
    }
    $info = @file_get_contents($logFile);
    if (strncmp($info, '<?php exit();?>', 15) != 0) {
        return false;
    }
    $info = substr($info, 15);
    if (ENABLE_ENCRYPT) {
        $info = decrypt($info, ENCRYPT_PASS);
    } else {
        $info = base64_decode($info);
    }
    if (!preg_match('/^[A-Za-z0-9\\x00-\\x80~!@#$%&_+-=:";\'<>,\\/"\\[\\]\\\\^\\.\\|\\?\\*\\+\\(\\)\\{\\}\\s]+$/', $info)) {
        return false;
    }
    $info = json_decode($info, true);
    $isChange = false;
    if (!isset($info['location'])) {
        $info['location'] = convertip($info['user_IP'], IPDATA_PATH);
        $isChange = true;
    }
    if ($isChange) {
        saveInfo(json_encode($info), $filename);
    }
    return $info;
}
Ejemplo n.º 2
0
 function global_footer()
 {
     global $_G;
     if (!$this->allow) {
         return;
     }
     require_once DISCUZ_ROOT . './source/plugin/smstong/smstong.func.php';
     $data = DB::fetch_first("SELECT mobile FROM " . DB::table("common_member_profile") . " WHERE uid = {$_G['uid']}");
     if ($_G['cache']['plugin']['smstong']['reportmsgnotify'] && $_G['gp_mod'] == 'report' && $_G['gp_reportsubmit']) {
         $content = $_G['cache']['plugin']['smstong']['reportmsgnotifymsg'];
         $rp = array('$username', '$tid', '$message');
         $sm = array($_G['username'], $_G['gp_rid'], $_G['gp_message']);
         $content = str_replace($rp, $sm, $content);
         $arraymobile = explode(',', $_G['cache']['plugin']['smstong']['reportmsgnotifymobile']);
         foreach ($arraymobile as $mobile) {
             $ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $mobile, $content);
         }
     } elseif ($_G['cache']['plugin']['smstong']['loggingmsgnotify'] && ismobile($data['mobile']) && $_G['cookie']['loginmark'] != $_G['cookie']['lastvisit']) {
         dsetcookie('loginmark', $_G['cookie']['lastvisit']);
         require_once DISCUZ_ROOT . './source/function/function_misc.php';
         $content = $_G['cache']['plugin']['smstong']['loggingmsgnotifymsg'];
         $rp = array('$username', '$logtime', '$ipaddress', '$location');
         $sm = array($_G['username'], date('Y-m-d H:i:s', TIMESTAMP), $_G['clientip'], str_replace('-', '', str_replace(' ', '', convertip($_G['clientip']))));
         $content = str_replace($rp, $sm, $content);
         $ret = sendsms($_G['cache']['plugin']['smstong']['smsusername'], $_G['cache']['plugin']['smstong']['smspassword'], $data['mobile'], $content);
     }
 }
Ejemplo n.º 3
0
 function chlogin()
 {
     $adminname = getgpc("adminname");
     $adminpwd = getgpc("adminpwd");
     $chres = fetch_one_array("select * from " . dbtable("admin_user") . " where username='******'");
     //dump($chres);
     if ($chres) {
         $md5salt = $this->config->item("md5salt");
         if ($chres["password"] == md5($md5salt . $adminpwd)) {
             //正常登录
             $_SESSION['chadmin'] = 1;
             $_SESSION['admin_id'] = $chres['id'];
             $_SESSION['admin_utype'] = $chres['utype'];
             $_SESSION['admin_username'] = $chres['username'];
             $query_group = $this->db->select('admin_group.name')->from('admin_group')->join('admin_user', 'admin_user.groupid = admin_group.id')->where(array('admin_user.id' => $chres['id']))->get();
             $_SESSION['group_name'] = $query_group->row_array()['name'];
             $ip = convertip();
             $updata = array('uid' => $chres['id'], 'username' => $chres['username'], 'time' => date("Y-m-d H:i:s"), 'ip' => $ip['ip'], 'ipaddr' => $ip['addr']);
             $this->db->insert('admin_user_loginlog', $updata);
             alert("登录成功", "/admin.php");
             exit;
         }
     }
     alert("账号或者密码错误", "/admin.php?mod=login");
 }
Ejemplo n.º 4
0
 public function get_resideprovince_by_ip($ip)
 {
     require_once libfile('function/misc');
     $location = cutstr(str_replace('- ', '', convertip($ip)), 4, '');
     if (!empty($location)) {
         $district = DB::fetch_first('SELECT * FROM %t WHERE level=1 AND (usetype&2>0) AND name LIKE %s', array($this->_table, $location . '%'));
         if (!empty($district)) {
             return $district['name'];
         }
     }
     return NULL;
 }
Ejemplo n.º 5
0
function get_client_info()
{
    global $_G;
    require_once libfile('function/misc');
    if (strtoupper(convertip($_G['clientip'])) == '- LAN') {
        return FALSE;
    }
    $re['siteurl'] = $_G['siteurl'];
    $re['domain'] = get_domain($re['siteurl']);
    if (!$re['domain']) {
        return FALSE;
    }
    $re['sitename'] = $_G['setting']['bbname'];
    $re['dxc_version'] = PICK_VERSION;
    $re['dxc_release'] = V_D;
    $re['discuz_version'] = DISCUZ_VERSION;
    $re['discuz_release'] = DISCUZ_RELEASE;
    return $re;
}
Ejemplo n.º 6
0
function load_xss_record($filename)
{
    if (strpos($filename, "..") === false && strpos($filename, "/") === false && strpos($filename, "\\") === false) {
        $logFile = dirname(__FILE__) . '/' . DATA_PATH . '/' . $filename . '.php';
        if (!file_exists($logFile)) {
            return false;
        }
        $info = @file_get_contents($logFile);
        if ($info === false) {
            return false;
        }
        if (strncmp($info, '<?php exit();?>', 15) != 0) {
            return false;
        }
        $info = substr($info, 15);
        $info = decrypt($info);
        //只会出现在加密密码错误的时候
        if (!preg_match('/^[A-Za-z0-9\\x00-\\x80~!@#$%&_+-=:";\'<>,\\/"\\[\\]\\\\^\\.\\|\\?\\*\\+\\(\\)\\{\\}\\s]+$/', $info)) {
            return false;
        }
        $info = json_decode($info, true);
        //只会出现在加密密码错误的时候
        if ($info === false) {
            return false;
        }
        $isChange = false;
        if (!isset($info['location'])) {
            $info['location'] = stripStr(convertip($info['user_IP'], IPDATA_PATH));
            $isChange = true;
        }
        //只会出现在加密密码错误的时候
        if (!isset($info['request_time'])) {
            return false;
        }
        if ($isChange) {
            save_xss_record(json_encode($info), $filename);
        }
        return $info;
    } else {
        return false;
    }
}
Ejemplo n.º 7
0
function dirList()
{
    $list = array();
    $files = glob(DATA_PATH . '/*.php');
    arsort($files);
    foreach ($files as $file) {
        $filename = basename($file, ".php");
        $info = loadInfo($filename);
        $isChange = false;
        //如果没有设置location,就查询qqwry.dat判断location
        if (!isset($info['location'])) {
            $info['location'] = convertip($info['user_IP'], IPDATA_PATH);
            $isChange = true;
        }
        if ($isChange) {
            saveInfo(json_encode($info), $filename);
        }
        $list[] = $info;
    }
    return $list;
}
Ejemplo n.º 8
0
function tin_new_friend()
{
    global $pagenow;
    if (tin_get_http_response_code('http://cdn.zhiyanblog.com/tinection/version.json') == '200') {
        if ('themes.php' == $pagenow && isset($_GET['activated'])) {
            $url = get_bloginfo('url');
            $name = get_bloginfo('name');
            $email = get_bloginfo('admin_email');
            $theme = wp_get_theme();
            $ip = $_SERVER['REMOTE_ADDR'];
            $ipaddr = convertip($ip);
            $data = array('url' => $url, 'name' => $name, 'email' => $email, 'version' => $theme->get('Version'), 'ip' => $ip, 'ipaddr' => $ipaddr);
            tin_socket_post('http://cdn.zhiyanblog.com/tinection/r.php', $data);
        }
    }
}
 function on_register()
 {
     global $_G;
     $_GET['username'] = $_GET['' . $this->setting['reginput']['username']];
     $_GET['password'] = $_GET['' . $this->setting['reginput']['password']];
     $_GET['password2'] = $_GET['' . $this->setting['reginput']['password2']];
     $_GET['email'] = $_GET['' . $this->setting['reginput']['email']];
     if ($_G['uid']) {
         $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
         $url_forward = dreferer();
         if (strpos($url_forward, $this->setting['regname']) !== false) {
             $url_forward = 'forum.php';
         }
         showmessage('login_succeed', $url_forward ? $url_forward : './', array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']), array('extrajs' => $ucsynlogin));
     } elseif (!$this->setting['regclosed'] && (!$this->setting['regstatus'] || !$this->setting['ucactivation'])) {
         if ($_GET['action'] == 'activation' || $_GET['activationauth']) {
             if (!$this->setting['ucactivation'] && !$this->setting['closedallowactivation']) {
                 showmessage('register_disable_activation');
             }
         } elseif (!$this->setting['regstatus']) {
             if ($this->setting['regconnect']) {
                 dheader('location:connect.php?mod=login&op=init&referer=forum.php&statfrom=login_simple');
             }
             showmessage(!$this->setting['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $this->setting['regclosemessage']));
         }
     }
     $bbrules =& $this->setting['bbrules'];
     $bbrulesforce =& $this->setting['bbrulesforce'];
     $bbrulestxt =& $this->setting['bbrulestxt'];
     $welcomemsg =& $this->setting['welcomemsg'];
     $welcomemsgtitle =& $this->setting['welcomemsgtitle'];
     $welcomemsgtxt =& $this->setting['welcomemsgtxt'];
     $regname = $this->setting['regname'];
     if ($this->setting['regverify']) {
         if ($this->setting['areaverifywhite']) {
             $location = $whitearea = '';
             $location = trim(convertip($_G['clientip'], "./"));
             if ($location) {
                 $whitearea = preg_quote(trim($this->setting['areaverifywhite']), '/');
                 $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                 $whitearea = '.*' . $whitearea . '.*';
                 $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                 if (@preg_match($whitearea, $location)) {
                     $this->setting['regverify'] = 0;
                 }
             }
         }
         if ($_G['cache']['ipctrl']['ipverifywhite']) {
             foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $this->setting['regverify'] = 0;
                     break;
                 }
             }
         }
     }
     $invitestatus = false;
     if ($this->setting['regstatus'] == 2) {
         if ($this->setting['inviteconfig']['inviteareawhite']) {
             $location = $whitearea = '';
             $location = trim(convertip($_G['clientip'], "./"));
             if ($location) {
                 $whitearea = preg_quote(trim($this->setting['inviteconfig']['inviteareawhite']), '/');
                 $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                 $whitearea = '.*' . $whitearea . '.*';
                 $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                 if (@preg_match($whitearea, $location)) {
                     $invitestatus = true;
                 }
             }
         }
         if ($this->setting['inviteconfig']['inviteipwhite']) {
             foreach (explode("\n", $this->setting['inviteconfig']['inviteipwhite']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $invitestatus = true;
                     break;
                 }
             }
         }
     }
     $groupinfo = array();
     if ($this->setting['regverify']) {
         $groupinfo['groupid'] = 8;
     } else {
         $groupinfo['groupid'] = $this->setting['newusergroupid'];
     }
     $seccodecheck = $this->setting['seccodestatus'] & 1;
     $secqaacheck = $this->setting['secqaa']['status'] & 1;
     $fromuid = !empty($_G['cookie']['promotion']) && $this->setting['creditspolicy']['promotion_register'] ? intval($_G['cookie']['promotion']) : 0;
     $username = isset($_GET['username']) ? $_GET['username'] : '';
     $bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : '';
     $auth = $_GET['auth'];
     if (!$invitestatus) {
         $invite = getinvite();
     }
     $sendurl = $this->setting['sendregisterurl'] ? true : false;
     if ($sendurl) {
         if (!empty($_GET['hash'])) {
             $_GET['hash'] = preg_replace("/[^\\[A-Za-z0-9_\\]%]/", '', $_GET['hash']);
             $hash = explode("\t", authcode($_GET['hash'], 'DECODE', $_G['config']['security']['authkey']));
             if (is_array($hash) && isemail($hash[0]) && TIMESTAMP - $hash[1] < 259200) {
                 $sendurl = false;
             }
         }
     }
     if (!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) {
         if ($_GET['action'] == 'activation') {
             $auth = explode("\t", authcode($auth, 'DECODE'));
             if (FORMHASH != $auth[1]) {
                 showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
             }
             $username = $auth[0];
             $activationauth = authcode("{$auth['0']}\t" . FORMHASH, 'ENCODE');
             $sendurl = false;
         }
         if (!$sendurl) {
             if ($fromuid) {
                 $member = getuserbyuid($fromuid);
                 if (!empty($member)) {
                     $fromuser = dhtmlspecialchars($member['username']);
                 } else {
                     dsetcookie('promotion');
                 }
             }
             if ($_GET['action'] == 'activation') {
                 $auth = dhtmlspecialchars($auth);
             }
             if ($seccodecheck) {
                 $seccode = random(6, 1);
             }
             $username = dhtmlspecialchars($username);
             $htmls = $settings = array();
             foreach ($_G['cache']['fields_register'] as $field) {
                 $fieldid = $field['fieldid'];
                 $html = profile_setting($fieldid, array(), false, false, true);
                 if ($html) {
                     $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
                     $htmls[$fieldid] = $html;
                 }
             }
             $navtitle = $this->setting['reglinkname'];
             if ($this->extrafile && file_exists($this->extrafile)) {
                 require_once $this->extrafile;
             }
         }
         $bbrulestxt = nl2br("\n{$bbrulestxt}\n\n");
         $dreferer = dreferer();
         include template($this->template);
     } else {
         $activationauth = array();
         if (isset($_GET['activationauth']) && $_GET['activationauth']) {
             $activationauth = explode("\t", authcode($_GET['activationauth'], 'DECODE'));
             if ($activationauth[1] != FORMHASH) {
                 showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
             }
             $sendurl = false;
         }
         if (!$activationauth && ($sendurl || !$_G['setting']['forgeemail'])) {
             checkemail($_GET['email']);
         }
         if ($sendurl) {
             $hashstr = urlencode(authcode("{$_GET['email']}\t{$_G['timestamp']}", 'ENCODE', $_G['config']['security']['authkey']));
             $registerurl = "{$_G[siteurl]}member.php?mod=" . $this->setting['regname'] . "&amp;hash={$hashstr}&amp;email={$_GET[email]}";
             $email_register_message = lang('email', 'email_register_message', array('bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $registerurl));
             if (!sendmail("{$_GET['email']} <{$_GET['email']}>", lang('email', 'email_register_subject'), $email_register_message)) {
                 runlog('sendmail', "{$_GET['email']} sendmail failed.");
             }
             showmessage('register_email_send_succeed', dreferer(), array('bbname' => $this->setting['bbname']), array('showdialog' => false, 'msgtype' => 3, 'closetime' => 10));
         }
         $emailstatus = 0;
         if ($this->setting['sendregisterurl'] && !$sendurl) {
             $_GET['email'] = strtolower($hash[0]);
             $this->setting['regverify'] = $this->setting['regverify'] == 1 ? 0 : $this->setting['regverify'];
             if (!$this->setting['regverify']) {
                 $groupinfo['groupid'] = $this->setting['newusergroupid'];
             }
             $emailstatus = 1;
         }
         if ($this->setting['regstatus'] == 2 && empty($invite) && !$invitestatus) {
             showmessage('not_open_registration_invite');
         }
         if ($bbrules && $bbrulehash != $_POST['agreebbrule']) {
             showmessage('register_rules_agree');
         }
         $activation = array();
         if (isset($_GET['activationauth']) && $activationauth && is_array($activationauth)) {
             if ($activationauth[1] == FORMHASH && !($activation = uc_get_user($activationauth[0]))) {
                 showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
             }
         }
         if (!$activation) {
             $usernamelen = dstrlen($username);
             if ($usernamelen < 3) {
                 showmessage('profile_username_tooshort');
             } elseif ($usernamelen > 15) {
                 showmessage('profile_username_toolong');
             }
             if (uc_get_user(addslashes($username)) && !C::t('common_member')->fetch_uid_by_username($username) && !C::t('common_member_archive')->fetch_uid_by_username($username)) {
                 if ($_G['inajax']) {
                     showmessage('profile_username_duplicate');
                 } else {
                     showmessage('register_activation_message', 'member.php?mod=logging&action=login', array('username' => $username));
                 }
             }
             if ($this->setting['pwlength']) {
                 if (strlen($_GET['password']) < $this->setting['pwlength']) {
                     showmessage('profile_password_tooshort', '', array('pwlength' => $this->setting['pwlength']));
                 }
             }
             if ($this->setting['strongpw']) {
                 $strongpw_str = array();
                 if (in_array(1, $this->setting['strongpw']) && !preg_match("/\\d+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_1');
                 }
                 if (in_array(2, $this->setting['strongpw']) && !preg_match("/[a-z]+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_2');
                 }
                 if (in_array(3, $this->setting['strongpw']) && !preg_match("/[A-Z]+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_3');
                 }
                 if (in_array(4, $this->setting['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['password'])) {
                     $strongpw_str[] = lang('member/template', 'strongpw_4');
                 }
                 if ($strongpw_str) {
                     showmessage(lang('member/template', 'password_weak') . implode(',', $strongpw_str));
                 }
             }
             $email = strtolower(trim($_GET['email']));
             if (empty($email) && $_G['setting']['forgeemail']) {
                 $_GET['email'] = $email = strtolower(random(6)) . '@' . $_SERVER['HTTP_HOST'];
             }
             if (empty($this->setting['ignorepassword'])) {
                 if ($_GET['password'] !== $_GET['password2']) {
                     showmessage('profile_passwd_notmatch');
                 }
                 if (!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {
                     showmessage('profile_passwd_illegal');
                 }
                 $password = $_GET['password'];
             } else {
                 $password = md5(random(10));
             }
         }
         $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($this->setting['censoruser'] = trim($this->setting['censoruser']), '/')) . ')$/i';
         if ($this->setting['censoruser'] && @preg_match($censorexp, $username)) {
             showmessage('profile_username_protect');
         }
         if ($this->setting['regverify'] == 2 && !trim($_GET['regmessage'])) {
             showmessage('profile_required_info_invalid');
         }
         if ($_G['cache']['ipctrl']['ipregctrl']) {
             foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $ctrlip = $ctrlip . '%';
                     $this->setting['regctrl'] = $this->setting['ipregctrltime'];
                     break;
                 } else {
                     $ctrlip = $_G['clientip'];
                 }
             }
         } else {
             $ctrlip = $_G['clientip'];
         }
         if ($this->setting['regctrl']) {
             if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $this->setting['regctrl'] * 3600)) {
                 showmessage('register_ctrl', NULL, array('regctrl' => $this->setting['regctrl']));
             }
         }
         $setregip = null;
         if ($this->setting['regfloodctrl']) {
             $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400);
             if ($regip) {
                 if ($regip['count'] >= $this->setting['regfloodctrl']) {
                     showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $this->setting['regfloodctrl']));
                 } else {
                     $setregip = 1;
                 }
             } else {
                 $setregip = 2;
             }
         }
         $profile = $verifyarr = array();
         foreach ($_G['cache']['fields_register'] as $field) {
             if (defined('IN_MOBILE')) {
                 break;
             }
             $field_key = $field['fieldid'];
             $field_val = $_GET['' . $field_key];
             if ($field['formtype'] == 'file' && !empty($_FILES[$field_key]) && $_FILES[$field_key]['error'] == 0) {
                 $field_val = true;
             }
             if (!profile_check($field_key, $field_val)) {
                 $showid = !in_array($field['fieldid'], array('birthyear', 'birthmonth')) ? $field['fieldid'] : 'birthday';
                 showmessage($field['title'] . lang('message', 'profile_illegal'), '', array(), array('showid' => 'chk_' . $showid, 'extrajs' => $field['title'] . lang('message', 'profile_illegal') . ($field['formtype'] == 'text' ? '<script type="text/javascript">' . '$(\'registerform\').' . $field['fieldid'] . '.className = \'px er\';' . '$(\'registerform\').' . $field['fieldid'] . '.onblur = function () { if(this.value != \'\') {this.className = \'px\';$(\'chk_' . $showid . '\').innerHTML = \'\';}}' . '</script>' : '')));
             }
             if ($field['needverify']) {
                 $verifyarr[$field_key] = $field_val;
             } else {
                 $profile[$field_key] = $field_val;
             }
         }
         if (!$activation) {
             $uid = uc_user_register(addslashes($username), $password, $email, $questionid, $answer, $_G['clientip']);
             if ($uid <= 0) {
                 if ($uid == -1) {
                     showmessage('profile_username_illegal');
                 } elseif ($uid == -2) {
                     showmessage('profile_username_protect');
                 } elseif ($uid == -3) {
                     showmessage('profile_username_duplicate');
                 } elseif ($uid == -4) {
                     showmessage('profile_email_illegal');
                 } elseif ($uid == -5) {
                     showmessage('profile_email_domain_illegal');
                 } elseif ($uid == -6) {
                     showmessage('profile_email_duplicate');
                 } else {
                     showmessage('undefined_action');
                 }
             }
         } else {
             list($uid, $username, $email) = $activation;
         }
         $_G['username'] = $username;
         if (getuserbyuid($uid, 1)) {
             if (!$activation) {
                 uc_user_delete($uid);
             }
             showmessage('profile_uid_duplicate', '', array('uid' => $uid));
         }
         $password = md5(random(10));
         $secques = $questionid > 0 ? random(8) : '';
         if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) {
             $profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
         }
         if (isset($_POST['birthyear'])) {
             $profile['zodiac'] = get_zodiac($_POST['birthyear']);
         }
         if ($_FILES) {
             $upload = new discuz_upload();
             foreach ($_FILES as $key => $file) {
                 $field_key = 'field_' . $key;
                 if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') {
                     $upload->init($file, 'profile');
                     $attach = $upload->attach;
                     if (!$upload->error()) {
                         $upload->save();
                         if (!$upload->get_image_info($attach['target'])) {
                             @unlink($attach['target']);
                             continue;
                         }
                         $attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
                         if ($_G['cache']['fields_register'][$field_key]['needverify']) {
                             $verifyarr[$key] = $attach['attachment'];
                         } else {
                             $profile[$key] = $attach['attachment'];
                         }
                     }
                 }
             }
         }
         if ($setregip !== null) {
             if ($setregip == 1) {
                 C::t('common_regip')->update_count_by_ip($_G['clientip']);
             } else {
                 C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp']));
             }
         }
         if ($invite && $this->setting['inviteconfig']['invitegroupid']) {
             $groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid'];
         }
         $init_arr = array('credits' => explode(',', $this->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus);
         C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
         if ($emailstatus) {
             updatecreditbyaction('realemail', $uid);
         }
         if ($verifyarr) {
             $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => serialize($verifyarr), 'dateline' => TIMESTAMP);
             C::t('common_member_verify_info')->insert($setverify);
             C::t('common_member_verify')->insert(array('uid' => $uid));
         }
         require_once libfile('cache/userstats', 'function');
         build_cache_userstats();
         if ($this->extrafile && file_exists($this->extrafile)) {
             require_once $this->extrafile;
         }
         if ($this->setting['regctrl'] || $this->setting['regfloodctrl']) {
             C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($this->setting['regctrl'] > 72 ? $this->setting['regctrl'] : 72) * 3600);
             if ($this->setting['regctrl']) {
                 C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
             }
         }
         $regmessage = dhtmlspecialchars($_GET['regmessage']);
         if ($this->setting['regverify'] == 2) {
             C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => $regmessage, 'remark' => ''), false, true);
             manage_addnotify('verifyuser');
         }
         setloginstatus(array('uid' => $uid, 'username' => $_G['username'], 'password' => $password, 'groupid' => $groupinfo['groupid']), 0);
         include_once libfile('function/stat');
         updatestat('register');
         if ($invite['id']) {
             $result = C::t('common_invite')->count_by_uid_fuid($invite['uid'], $uid);
             if (!$result) {
                 C::t('common_invite')->update($invite['id'], array('fuid' => $uid, 'fusername' => $_G['username'], 'regdateline' => $_G['timestamp'], 'status' => 2));
                 updatestat('invite');
             } else {
                 $invite = array();
             }
         }
         if ($invite['uid']) {
             if ($this->setting['inviteconfig']['inviteaddcredit']) {
                 updatemembercount($uid, array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['inviteaddcredit']));
             }
             if ($this->setting['inviteconfig']['invitedaddcredit']) {
                 updatemembercount($invite['uid'], array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['invitedaddcredit']));
             }
             require_once libfile('function/friend');
             friend_make($invite['uid'], $invite['username'], false);
             notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1);
             space_merge($invite, 'field_home');
             if (!empty($invite['privacy']['feed']['invite'])) {
                 require_once libfile('function/feed');
                 $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>');
                 feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']);
             }
             if ($invite['appid']) {
                 updatestat('appinvite');
             }
         }
         if ($welcomemsg && !empty($welcomemsgtxt)) {
             $welcomemsgtitle = replacesitevar($welcomemsgtitle);
             $welcomemsgtxt = replacesitevar($welcomemsgtxt);
             if ($welcomemsg == 1) {
                 $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
                 notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1);
             } elseif ($welcomemsg == 2) {
                 sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
             } elseif ($welcomemsg == 3) {
                 sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt);
                 $welcomemsgtxt = nl2br(str_replace(':', '&#58;', $welcomemsgtxt));
                 notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1);
             }
         }
         if ($fromuid) {
             updatecreditbyaction('promotion_register', $fromuid);
             dsetcookie('promotion', '');
         }
         dsetcookie('loginuser', '');
         dsetcookie('activationauth', '');
         dsetcookie('invite_auth', '');
         $url_forward = dreferer();
         $refreshtime = 3000;
         switch ($this->setting['regverify']) {
             case 1:
                 $idstring = random(6);
                 $authstr = $this->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : '';
                 C::t('common_member_field_forum')->update($_G['uid'], array('authstr' => $authstr));
                 $verifyurl = "{$_G[siteurl]}member.php?mod=activate&amp;uid={$_G[uid]}&amp;id={$idstring}";
                 $email_verify_message = lang('email', 'email_verify_message', array('username' => $_G['member']['username'], 'bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl));
                 if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) {
                     runlog('sendmail', "{$email} sendmail failed.");
                 }
                 $message = 'register_email_verify';
                 $locationmessage = 'register_email_verify_location';
                 $refreshtime = 10000;
                 break;
             case 2:
                 $message = 'register_manual_verify';
                 $locationmessage = 'register_manual_verify_location';
                 break;
             default:
                 $message = 'register_succeed';
                 $locationmessage = 'register_succeed_location';
                 break;
         }
         $param = array('bbname' => $this->setting['bbname'], 'username' => $_G['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']);
         if (strpos($url_forward, $this->setting['regname']) !== false || strpos($url_forward, 'buyinvitecode') !== false) {
             $url_forward = 'forum.php';
         }
         $href = str_replace("'", "\\'", $url_forward);
         $extra = array('showid' => 'succeedmessage', 'extrajs' => '<script type="text/javascript">' . 'setTimeout("window.location.href =\'' . $href . '\';", ' . $refreshtime . ');' . '$(\'succeedmessage_href\').href = \'' . $href . '\';' . '$(\'main_message\').style.display = \'none\';' . '$(\'main_succeed\').style.display = \'\';' . '$(\'succeedlocation\').innerHTML = \'' . lang('message', $locationmessage) . '\';' . '</script>', 'striptags' => false);
         showmessage($message, $url_forward, $param, $extra);
     }
 }
Ejemplo n.º 10
0
 $censor =& discuz_censor::instance();
 $censor->highlight = '#FF0000';
 require_once libfile('function/misc');
 while ($comment = DB::fetch($query)) {
     $comment['dateline'] = dgmdate($comment['dateline']);
     $short_desc = cutstr($comment['message'], 75);
     if ($showcensor) {
         $censor->check($short_desc);
         $censor->check($comment['message']);
     }
     $comment_censor_words = $censor->words_found;
     if (count($comment_censor_words) > 3) {
         $comment_censor_words = array_slice($comment_censor_words, 0, 3);
     }
     $comment['censorwords'] = implode(', ', $comment_censor_words);
     $comment['ip'] = $comment['ip'] . ' - ' . convertip($comment['ip']);
     $comment['modkey'] = modauthkey($comment['id']);
     $comment['modcommentkey'] = modauthkey($comment['cid']);
     if (count($comment_censor_words)) {
         $comment_censor_text = "<span style=\"color: red;\">({$comment['censorwords']})</span>";
     } else {
         $comment_censor_text = lang('admincp', 'no_censor_word');
     }
     $viewurl = '';
     $commenttype = '';
     $editurl = "home.php?mod=spacecp&ac=comment&op=edit&cid={$comment['cid']}&modcommentkey={$comment['modcommentkey']}";
     switch ($comment['idtype']) {
         case 'uid':
             $commenttype = lang('admincp', 'comment_uid');
             $viewurl = "home.php?mod=space&uid={$comment['uid']}&do=wall#comment_anchor_{$comment['cid']}";
             break;
Ejemplo n.º 11
0
function fun_comment_quote($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount_quote, $wpdb, $post;
    if (!$commentcount_quote) {
        $cnt = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_post_ID = {$post->ID} AND (comment_type = 'trackback' OR comment_type = 'pingback') AND comment_approved = '1' AND !comment_parent");
        $page = get_query_var('cpage');
        $cpp = get_option('comments_per_page');
        if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) {
            $commentcount_quote = $cnt + 1;
        } else {
            $commentcount_quote = $cpp * $page + 1;
        }
    }
    ?>
<li <?php 
    comment_class();
    ?>
 id="comment-<?php 
    comment_ID();
    ?>
">
   <div id="div-comment-<?php 
    comment_ID();
    ?>
" class="comment-body">
      <?php 
    $add_below = 'div-comment';
    ?>
		<div class="comment-author"><?php 
    $uid = get_user_by_email($comment->comment_author_email)->ID;
    echo fun_get_avatar($uid, 40, fun_get_avatar_type($uid));
    ?>
<div style="float:right">
	<span class="datetime">
 		<?php 
    comment_date('Y-m-d');
    comment_time();
    ?>
 	</span>
 </div>
 <span class="comment_author_link"><?php 
    if ($comment->user_id != 0) {
        echo '<a href="' . get_author_posts_url($comment->user_id) . '" class="name">' . $comment->comment_author . '</a>';
    } else {
        comment_author_link();
    }
    ?>
</span><span class="comment_author_ip"><?php 
    _e('[ 来自 ', 'tinection');
    ?>
<span><?php 
    echo convertip(get_comment_author_ip());
    ?>
</span>&nbsp;]
</span>
 </div>
		<?php 
    if ($comment->comment_approved == '0') {
        ?>
			<span style="color:#C00; font-style:inherit; margin-top:5px; line-height:25px;"><?php 
        $cpid = $comment->comment_parent;
        if ($cpid != 0) {
            echo '@';
        }
        comment_author_link($cpid);
        _e('您的评论正在等待审核中...', 'tinection');
        ?>
</span>
			<br />			
		<?php 
    }
    ?>
		<?php 
    if ($comment->comment_approved == '1') {
        ?>
		<?php 
        comment_text();
        ?>
		<?php 
    }
    ?>
        </div>
		<div class="clear"></div>
  
<?php 
}
Ejemplo n.º 12
0
require_once QISHI_ROOT_PATH . 'include/help.class.php';
require_once QISHI_ROOT_PATH . 'include/common.fun.php';
require_once QISHI_ROOT_PATH . 'include/74cms_version.php';
$QSstarttime = exectime();
if (!empty($_GET)) {
    $_GET = help::addslashes_deep($_GET);
}
if (!empty($_POST)) {
    $_POST = help::addslashes_deep($_POST);
}
$_COOKIE = help::addslashes_deep($_COOKIE);
$_REQUEST = help::addslashes_deep($_REQUEST);
date_default_timezone_set("PRC");
$timestamp = time();
$online_ip = getip();
$ip_address = convertip($online_ip);
$_NAV = get_cache('nav');
$_PAGE = get_cache('page');
$_CFG = get_cache('config');
$_SUBSITE = get_cache('subsite');
$_M_SUBSITE = get_cache('m_subsite');
$_CFG['statistics'] = htmlspecialchars_decode($_CFG['statistics']);
$_PLUG = get_cache('plug');
if ($_CFG['uc_open'] == "1") {
    require_once QISHI_ROOT_PATH . 'data/cache_uc_config.php';
}
$QS_cookiedomain = get_cookiedomain();
$_CFG['main_domain'] = $_CFG['site_domain'] . $_CFG['site_dir'];
$_CFG['wap_domain'] = $_CFG['wap_domain'] == "" ? $_CFG['site_domain'] . $_CFG['site_dir'] . "m" : $_CFG['wap_domain'];
$_CFG['m_main_domain'] = $_CFG['wap_domain'];
$_CFG['version'] = QISHI_VERSION;
Ejemplo n.º 13
0
                $hd_token = $client->oauth->getAccessToken('token', $hd_token);
                writetocache('dzapp_haodai_setting', getcachevars(array('hd_token' => $hd_token)));
            } else {
                showmessage('dzapp_haodai:callback_error_user');
            }
        }
    } elseif (isset($hd_token['expires']) && TIMESTAMP < $hd_token['expires'] - 3600) {
    } else {
        showmessage('dzapp_haodai:callback_error_user');
    }
}
if ($_G['cookie']['HD_CITY'] && $zones[$_G['cookie']['HD_CITY']]) {
    $city = $_G['cookie']['HD_CITY'];
} else {
    require_once libfile('function/misc');
    $location = convertip($_G['clientip']);
    $charset = strtoupper(CHARSET);
    foreach ($zones as $key => $value) {
        if ($charset == 'UTF-8') {
            $value = substr($value, 0, strlen($value) - 3);
        } elseif ($charset == 'GBK') {
            $value = substr($value, 0, strlen($value) - 2);
        } elseif ($charset == 'BIG5') {
            $city = '';
            break;
        }
        if (stripos($location, $value) !== FALSE) {
            $city = $key;
            break;
        }
    }
Ejemplo n.º 14
0
    $space['lastvisit'] = dgmdate($space['lastvisit']);
}
if ($space['lastactivity']) {
    $space['lastactivitydb'] = $space['lastactivity'];
    $space['lastactivity'] = dgmdate($space['lastactivity']);
}
if ($space['lastpost']) {
    $space['lastpost'] = dgmdate($space['lastpost']);
}
if ($space['lastsendmail']) {
    $space['lastsendmail'] = dgmdate($space['lastsendmail']);
}
if ($_G['uid'] == $space['uid'] || $_G['group']['allowviewip']) {
    require_once libfile('function/misc');
    $space['regip_loc'] = convertip($space['regip']);
    $space['lastip_loc'] = convertip($space['lastip']);
}
$space['buyerrank'] = 0;
if ($space['buyercredit']) {
    foreach ($_G['setting']['ec_credit']['rank'] as $level => $credit) {
        if ($space['buyercredit'] <= $credit) {
            $space['buyerrank'] = $level;
            break;
        }
    }
}
$space['sellerrank'] = 0;
if ($space['sellercredit']) {
    foreach ($_G['setting']['ec_credit']['rank'] as $level => $credit) {
        if ($space['sellercredit'] <= $credit) {
            $space['sellerrank'] = $level;
Ejemplo n.º 15
0
                foreach ($_G['cache']['fields_register'] as $field) {
                    if (!$field['available'] || in_array($field['fieldid'], array('uid', 'constellation', 'zodiac', 'birthmonth', 'birthyear', 'birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) {
                        continue;
                    }
                    $member[$field['fieldid']] = !empty($member[$field['fieldid']]) ? $member[$field['fieldid']] : $fields[$field['fieldid']];
                    if ($member[$field['fieldid']]) {
                        $fieldstr = profile_show($field['fieldid'], $member);
                        $str .= $field['title'] . ':' . $fieldstr . "<br/>";
                    }
                }
                $str = !empty($str) ? '<br/>' . $str : '';
                $member['regdate'] = dgmdate($member['regdate']);
                $member['submitdate'] = dgmdate($member['submitdate']);
                $member['moddate'] = $member['moddate'] ? dgmdate($member['moddate']) : $lang['none'];
                $member['admin'] = $member['admin'] ? "<a href=\"home.php?mod=space&username="******"\" target=\"_blank\">{$member['admin']}</a>" : $lang['none'];
                $members .= "<tr class=\"hover\" id=\"mod_uid_{$member[uid]}\"><td class=\"rowform\" style=\"width:80px;\"><ul class=\"nofloat\"><li><input id=\"mod_uid_{$member[uid]}_1\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"invalidate\" onclick=\"set_bg('invalidate', {$member['uid']});\"><label for=\"mod_uid_{$member[uid]}_1\">{$lang['invalidate']}</label></li><li><input id=\"mod_uid_{$member[uid]}_2\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"validate\" onclick=\"set_bg('validate', {$member['uid']});\"><label for=\"mod_uid_{$member[uid]}_2\">{$lang['validate']}</label></li>\n" . "<li><input id=\"mod_uid_{$member[uid]}_3\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"delete\" onclick=\"set_bg('delete', {$member['uid']});\"><label for=\"mod_uid_{$member[uid]}_3\">{$lang['delete']}</label></li><li><input id=\"mod_uid_{$member[uid]}_4\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"ignore\" onclick=\"set_bg('ignore', {$member['uid']});\"><label for=\"mod_uid_{$member[uid]}_4\">{$lang['ignore']}</label></li></ul></td><td><b><a href=\"home.php?mod=space&uid={$member['uid']}\" target=\"_blank\">{$member['username']}</a></b>\n" . "<br />{$lang['members_edit_regdate']} {$member['regdate']}<br />{$lang['members_edit_regip']} {$member['regip']} " . convertip($member['regip']) . "<br />Email: {$member['email']}{$str}</td>\n" . "<td align=\"center\"><textarea rows=\"4\" name=\"userremark[{$member['uid']}]\" style=\"width: 95%; word-break: break-all\">{$member['message']}</textarea></td>\n" . "<td>{$lang['moderate_members_submit_times']}: {$member['submittimes']}<br />{$lang['moderate_members_submit_time']}: {$member['submitdate']}<br />{$lang['moderate_members_admin']}: {$member['admin']}<br />\n" . "{$lang['moderate_members_mod_time']}: {$member['moddate']}</td><td><textarea rows=\"4\" id=\"remark[{$member['uid']}]\" name=\"remark[{$member['uid']}]\" style=\"width: 95%; word-break: break-all\">{$member['remark']}</textarea></td></tr>\n";
            }
            if ($vuids) {
                C::t('common_member_validate')->delete($vuids);
            }
        }
        shownav('user', 'nav_modmembers');
        showsubmenu('nav_moderate_users', array(array('nav_moderate_users_mod', 'moderate&operation=members&do=mod', 1), array('clean', 'moderate&operation=members&do=del', 0)));
        showtips('moderate_members_tips');
        $moderate_members_bad_reason = cplang('moderate_members_bad_reason');
        $moderate_members_succeed = cplang('moderate_members_succeed');
        echo <<<EOT
<script type="text/javascript">
function set_bg(operation, uid) {
\tif(operation == 'invalidate') {
\t\t\$('mod_uid_' + uid).className = "mod_invalidate";
Ejemplo n.º 16
0
            $newversion++;
        }
    }
    include template('common/header_ajax');
    if ($newversion) {
        $lang = lang('forum/misc');
        echo '<div class="bm"><div class="bm_h cl"><a href="javascript:;" onclick="$(\'plugin_notice\').style.display=\'none\';setcookie(\'pluginnotice\', 1, 86400)" class="y" title="' . $lang['patch_close'] . '">' . $lang['patch_close'] . '</a>';
        echo '<h2 class="i">' . $lang['plugin_title'] . '</h2></div><div class="bm_c">';
        echo '<div class="cl bbda pbm">' . lang('forum/misc', 'plugin_memo', array('number' => $newversion)) . '</div>';
        echo '<div class="ptn cl"><a href="admin.php?action=plugins" class="xi2 y">' . $lang['plugin_link'] . ' &raquo;</a></div>';
        echo '</div></div>';
    }
    include template('common/footer_ajax');
    exit;
} elseif ($_GET['action'] == 'ipnotice') {
    require_once libfile('function/misc');
    include template('common/header_ajax');
    if ($_G['cookie']['lip'] && $_G['cookie']['lip'] != ',' && $_G['uid']) {
        $status = C::t('common_member_status')->fetch($_G['uid']);
        $lip = explode(',', $_G['cookie']['lip']);
        $lastipConvert = convertip($lip[0]);
        $lastipDate = dgmdate($lip[1]);
        $nowipConvert = convertip($status['lastip']);
        if ($lastipConvert != $nowipConvert && stripos($lastipConvert, $nowipConvert) == false && stripos($nowipConvert, $lastipConvert) == false) {
            $lang = lang('forum/misc');
            include template('common/ipnotice');
        }
    }
    include template('common/footer_ajax');
    exit;
}
Ejemplo n.º 17
0
     $threadlist[$thread['tid']] = $thread;
 }
 if ($tids) {
     foreach ($tids as $posttableid => $tid) {
         $query = DB::query("SELECT tid, pid, message, useip, attachment, htmlon, smileyoff, bbcodeoff FROM " . DB::table(getposttable($posttableid)) . " WHERE tid IN (" . dimplode($tid) . ") AND first='1'");
         while ($post = DB::fetch($query)) {
             $threadlist[$post['tid']] = array_merge($threadlist[$post['tid']], $post);
         }
     }
 }
 $multipage = multi($modcount, $tpp, $page, ADMINSCRIPT . "?action=moderate&operation=threads&filter={$filter}&modfid={$modfid}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&title={$_G['gp_title']}&tpp={$tpp}&showcensor={$showcensor}");
 echo '<p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">' . cplang('moderate_all_expand') . '</a> &nbsp;<a href="javascript:;" onclick="foldall();">' . cplang('moderate_all_fold') . '</a><p>';
 require_once libfile('function/misc');
 foreach ($threadlist as $thread) {
     $threadsortinfo = '';
     $thread['useip'] = $thread['useip'] . '-' . convertip($thread['useip']);
     if ($thread['authorid'] && $thread['author']) {
         $thread['author'] = "<a href=\"?action=members&operation=search&uid={$thread['authorid']}&submit=yes\" target=\"_blank\">{$thread['author']}</a>";
     } elseif ($thread['authorid'] && !$thread['author']) {
         $thread['author'] = "<a href=\"?action=members&operation=search&uid={$thread['authorid']}&submit=yes\" target=\"_blank\">{$lang['anonymous']}</a>";
     } else {
         $thread['author'] = $lang['guest'];
     }
     $thread['dateline'] = dgmdate($thread['dateline']);
     $thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff']);
     require_once libfile('class/censor');
     $censor =& discuz_censor::instance();
     $censor->highlight = '#FF0000';
     if ($showcensor) {
         $censor->check($thread['subject']);
         $censor->check($thread['message']);
Ejemplo n.º 18
0
    fclose($fd);
    //最后做相应的替换操作后返回结果
    if (preg_match('/http/i', $ipAddr2)) {
        $ipAddr2 = '';
    }
    $ipaddr = "{$ipAddr1} {$ipAddr2}";
    $ipaddr = preg_replace('/CZ88.Net/is', '', $ipaddr);
    $ipaddr = preg_replace('/^s*/is', '', $ipaddr);
    $ipaddr = preg_replace('/s*$/is', '', $ipaddr);
    if (preg_match('/http/i', $ipaddr) || $ipaddr == '') {
        $ipaddr = 'Unknown';
    }
    return $ipaddr;
}
//========================
//
//  调用举例(速度很快)
//
//========================
echo convertip('219.238.235.10');
//输出: 北京市 电信通
echo convertip('23.56.82.12');
//输出:IANA
echo convertip('250.69.52.0');
//输出:IANA保留地址
echo convertip('238.69.52.0');
//输出:IANA保留地址 用于多点传送
echo convertip('192.168.0.1');
//输出:局域网 对方和您在同一内部网
echo convertip('255.255.255.255');
//输出:纯真网络 2006年11月20日IP数据
Ejemplo n.º 19
0
         }
     } else {
         $perpage = 30;
         $start = ($page - 1) * $perpage;
         $mpurl .= '&perpage=' . $perpage;
         $mpurl = ADMINSCRIPT . '?action=setting&operation=antitheft&anchor=' . $_GET['anchor'];
         showformheader('setting&operation=antitheft&anchor=' . $_GET['anchor']);
         showtableheader('setting_antitheft_iplist');
         showsubtitle(array('', 'setting_antitheft_ip', 'setting_antitheft_view', 'setting_antitheft_op'));
         $multipage = '';
         $count = C::t('common_visit')->count();
         if ($count) {
             require_once libfile('function/misc');
             foreach (C::t('common_visit')->range($start, $perpage) as $value) {
                 $ip = long2ip($value['ip']);
                 showtablerow('', array('class="td25"', 'class=""', 'class="td28"'), array("<input type=\"checkbox\" class=\"checkbox\" name=\"ips[]\" value=\"{$value['ip']}\">", "{$ip} " . convertip($ip), $value['view'], "<a href=\"{$mpurl}&optype=white&ips[]={$value['ip']}&antitheftsubmit=yes\">{$lang['setting_antitheft_addwhitelist']}</a> |\n\t\t\t\t\t\t\t\t <a href=\"{$mpurl}&optype=black&ips[]={$value['ip']}&antitheftsubmit=yes\">{$lang['setting_antitheft_addblacklist']}</a> |\n\t\t\t\t\t\t\t\t <a href=\"{$mpurl}&optype=delete&ips[]={$value['ip']}&antitheftsubmit=yes\">{$lang['delete']}</a>\n\t\t\t\t\t\t\t\t"));
             }
             $multipage = multi($count, $perpage, $page, $mpurl);
         }
         $batchradio = '<input type="radio" name="optype" value="white" id="op_white" class="radio" /><label for="op_white">' . cplang('setting_antitheft_addwhitelist') . '</label>&nbsp;&nbsp;';
         $batchradio .= '<input type="radio" name="optype" value="black" id="op_black" class="radio" /><label for="op_black">' . cplang('setting_antitheft_addblacklist') . '</label>&nbsp;&nbsp;';
         $batchradio .= '<input type="radio" name="optype" value="delete" id="op_remove" class="radio" /><label for="op_remove">' . cplang('delete') . '</label>&nbsp;&nbsp;<input type="hidden" name="antitheftsubmit" value="yes" />';
         showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ips\')" /><label for="chkall">' . cplang('select_all') . '</label>&nbsp;&nbsp;' . $batchradio . '<input type="submit" class="btn" name="antitheftbutton" value="' . cplang('submit') . '" />', $multipage);
         showtablefooter();
         showformfooter();
     }
 } else {
     showtips('setting_antitheft_tips');
     $setting['antitheft'] = dunserialize($setting['antitheft']);
     $setting['antitheftsetting'] = dunserialize($setting['antitheftsetting']);
     showtableheader('setting_antitheft_status', 'fixpadding');
Ejemplo n.º 20
0
    $censor->highlight = '#FF0000';
    require_once libfile('function/misc');
    while ($blog = DB::fetch($query)) {
        $blog['dateline'] = dgmdate($blog['dateline']);
        $blog['subject'] = $blog['subject'] ? '<b>' . $blog['subject'] . '</b>' : '<i>' . $lang['nosubject'] . '</i>';
        if ($showcensor) {
            $censor->check($blog['subject']);
            $censor->check($blog['message']);
        }
        $blog_censor_words = $censor->words_found;
        if (count($post_censor_words) > 3) {
            $blog_censor_words = array_slice($blog_censor_words, 0, 3);
        }
        $blog['censorwords'] = implode(', ', $blog_censor_words);
        $blog['modblogkey'] = modauthkey($blog['blogid']);
        $blog['postip'] = $blog['postip'] . '-' . convertip($blog['postip']);
        if (count($blog_censor_words)) {
            $blog_censor_text = "<span style=\"color: red;\">({$blog['censorwords']})</span>";
        } else {
            $blog_censor_text = '';
        }
        showtagheader('tbody', '', true, 'hover');
        showtablerow("id=\"mod_{$blog['blogid']}_row1\"", array("id=\"mod_{$blog['blogid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_1\" value=\"validate\" onclick=\"mod_setbg({$blog['blogid']}, 'validate');\"><label for=\"mod_{$blog['blogid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_2\" value=\"delete\" onclick=\"mod_setbg({$blog['blogid']}, 'delete');\"><label for=\"mod_{$blog['blogid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$blog['blogid']}, 'ignore');\"><label for=\"mod_{$blog['blogid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$blog['blogid']}');\">{$blog['subject']}</a> {$blog_censor_text}</h3><p>{$blog['postip']}</p>", $blog[classname], "<p><a target=\"_blank\" href=\"" . ADMINSCRIPT . "?action=members&operation=search&uid={$blog['uid']}&submit=yes\">{$blog['username']}</a></p> <p>{$blog['dateline']}</p>", "<a href=\"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}&modblogkey={$blog['modblogkey']}\" target=\"_blank\">{$lang['view']}</a>&nbsp;<a href=\"home.php?mod=spacecp&ac=blog&blogid={$blog['blogid']}&modblogkey={$blog['modblogkey']}\" target=\"_blank\">{$lang['edit']}</a>"));
        showtablerow("id=\"mod_{$blog['blogid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">' . $blog['message'] . '</div>');
        showtablerow("id=\"mod_{$blog['blogid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=validate&page={$page}&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=delete&page={$page}&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=ignore&page={$page}&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
        showtagfooter('tbody');
    }
    showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">' . cplang('moderate_all_validate') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">' . cplang('moderate_all_delete') . '</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">' . cplang('moderate_all_ignore') . '</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">' . cplang('moderate_all_cancel') . '</a>', $multipage, false);
    showtablefooter();
    showformfooter();
} else {
Ejemplo n.º 21
0
function periodscheck($periods, $showmessage = 1)
{
    global $_G;
    if (($periods == 'postmodperiods' || $periods == 'postbanperiods') && ($_G['setting']['postignorearea'] || $_G['setting']['postignoreip'])) {
        if ($_G['setting']['postignoreip']) {
            foreach (explode("\n", $_G['setting']['postignoreip']) as $ctrlip) {
                if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                    return false;
                    break;
                }
            }
        }
        if ($_G['setting']['postignorearea']) {
            $location = $whitearea = '';
            require_once libfile('function/misc');
            $location = trim(convertip($_G['clientip'], "./"));
            if ($location) {
                $whitearea = preg_quote(trim($_G['setting']['postignorearea']), '/');
                $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                $whitearea = '.*' . $whitearea . '.*';
                $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                if (@preg_match($whitearea, $location)) {
                    return false;
                }
            }
        }
    }
    if (!$_G['group']['disableperiodctrl'] && $_G['setting'][$periods]) {
        $now = dgmdate(TIMESTAMP, 'G.i', $_G['setting']['timeoffset']);
        foreach (explode("\r\n", str_replace(':', '.', $_G['setting'][$periods])) as $period) {
            list($periodbegin, $periodend) = explode('-', $period);
            if ($periodbegin > $periodend && ($now >= $periodbegin || $now < $periodend) || $periodbegin < $periodend && $now >= $periodbegin && $now < $periodend) {
                $banperiods = str_replace("\r\n", ', ', $_G['setting'][$periods]);
                if ($showmessage) {
                    showmessage('period_nopermission', NULL, array('banperiods' => $banperiods), array('login' => 1));
                } else {
                    return TRUE;
                }
            }
        }
    }
    return FALSE;
}
Ejemplo n.º 22
0
function register()
{
    /*{{{*/
    require_once dirname(dirname(dirname(__FILE__))) . '/bigappjson.class.php';
    require_once libfile('function/misc');
    require_once libfile('function/member');
    require_once libfile('class/member');
    $userName = isset($_REQUEST["username"]) ? $_REQUEST["username"] : "";
    $password = isset($_REQUEST["password"]) ? $_REQUEST["password"] : "";
    $email = isset($_REQUEST["email"]) ? strtolower($_REQUEST["email"]) : "";
    global $_G;
    if (function_exists('iconv')) {
        $userName = iconv('UTF-8', CHARSET . '//ignore', $userName);
    } else {
        $userName = mb_convert_encoding($userName, CHARSET, 'UTF-8');
    }
    if (empty($userName) || empty($password) || empty($email)) {
        echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'empty_params'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'empty_params'))));
        die(0);
    }
    $userNamelen = dstrlen($userName);
    if ($userNamelen < 3) {
        echo BIGAPPJSON::encode(array('error_code' => 3, 'error_msg' => lang('plugin/bigapp', 'username_short'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_short'))));
        die(0);
    }
    if ($userNamelen > 15) {
        echo BIGAPPJSON::encode(array('error_code' => 4, 'error_msg' => lang('plugin/bigapp', 'username_long'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_long'))));
        die(0);
    }
    $ctlObj = new register_ctl();
    $ctlObj->setting = $_G['setting'];
    if (isset($ctlObj->setting['pwlength']) && $ctlObj->setting['pwlength']) {
        if (strlen($password) < $ctlObj->setting['pwlength']) {
            echo BIGAPPJSON::encode(array('error_code' => 5, 'error_msg' => lang('plugin/bigapp', 'password_length') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_not_equal') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]')));
            die(0);
        }
    }
    if (isset($ctlObj->setting['strongpw']) && $ctlObj->setting['strongpw']) {
        $strongpw_str = array();
        if (in_array(1, $ctlObj->setting['strongpw']) && !preg_match("/\\d+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_number');
        }
        if (in_array(2, $ctlObj->setting['strongpw']) && !preg_match("/[a-z]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_lowercase_char');
        }
        if (in_array(3, $ctlObj->setting['strongpw']) && !preg_match("/[A-Z]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_uppercase_char');
        }
        if (in_array(4, $ctlObj->setting['strongpw']) && !preg_match("/[^a-zA-Z0-9]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_charset');
        }
        if ($strongpw_str) {
            echo BIGAPPJSON::encode(array('error_code' => 6, 'error_msg' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]')));
            die(0);
        }
    }
    /*
    	if(!isset($_G['setting']['mobile']['mobileregister']) || !$_G['setting']['mobile']['mobileregister']){
    		echo BIGAPPJSON::encode(array('error_code' => 7, 'error_msg' => lang('plugin/bigapp', 'forbid_mobreg'), 
    				'Variables' => array('auth' => null),
                    'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_mobreg'))));
    		die(0);
    	}
    */
    loaducenter();
    if (!$ctlObj->setting['regclosed'] && (!$ctlObj->setting['regstatus'] || !$ctlObj->setting['ucactivation'])) {
        if (!$ctlObj->setting['regstatus']) {
            echo BIGAPPJSON::encode(array('error_code' => 8, 'error_msg' => lang('plugin/bigapp', 'forbid_registration'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_registration'))));
            die(0);
        }
    }
    if ($ctlObj->setting['regverify']) {
        if ($ctlObj->setting['areaverifywhite']) {
            $location = $whitearea = '';
            $location = trim(convertip($_G['clientip'], "./"));
            if ($location) {
                $whitearea = preg_quote(trim($ctlObj->setting['areaverifywhite']), '/');
                $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                $whitearea = '.*' . $whitearea . '.*';
                $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                if (@preg_match($whitearea, $location)) {
                    $ctlObj->setting['regverify'] = 0;
                }
            }
        }
        if ($_G['cache']['ipctrl']['ipverifywhite']) {
            foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) {
                if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                    $ctlObj->setting['regverify'] = 0;
                    break;
                }
            }
        }
    }
    if ($ctlObj->setting['regverify']) {
        $groupinfo['groupid'] = 8;
    } else {
        $groupinfo['groupid'] = $ctlObj->setting['newusergroupid'];
    }
    if (!$password || $password != addslashes($password)) {
        echo BIGAPPJSON::encode(array('error_code' => 9, 'error_msg' => lang('plugin/bigapp', 'password_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid_char'))));
        die(0);
    }
    $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($ctlObj->setting['censoruser'] = trim($ctlObj->setting['censoruser']), '/')) . ')$/i';
    if ($ctlObj->setting['censoruser'] && @preg_match($censorexp, $userName)) {
        echo BIGAPPJSON::encode(array('error_code' => 10, 'error_msg' => lang('plugin/bigapp', 'forbid_username'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_username'))));
        die(0);
    }
    if ($_G['cache']['ipctrl']['ipregctrl']) {
        foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) {
            if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                $ctrlip = $ctrlip . '%';
                $ctlObj->setting['regctrl'] = $ctlObj->setting['ipregctrltime'];
                break;
            } else {
                $ctrlip = $_G['clientip'];
            }
        }
    } else {
        $ctrlip = $_G['clientip'];
    }
    if ($ctlObj->setting['regctrl']) {
        if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $ctlObj->setting['regctrl'] * 3600)) {
            echo BIGAPPJSON::encode(array('error_code' => 11, 'error_msg' => lang('plugin/bigapp', 'forbid_ip'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_ip'))));
            die(0);
        }
    }
    $setregip = null;
    if ($ctlObj->setting['regfloodctrl']) {
        $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400);
        if ($regip) {
            if ($regip['count'] >= $ctlObj->setting['regfloodctrl']) {
                echo BIGAPPJSON::encode(array('error_code' => 12, 'error_msg' => lang('plugin/bigapp', 'forbid_ip_today'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_ip_today'))));
                die(0);
            } else {
                $setregip = 1;
            }
        } else {
            $setregip = 2;
        }
    }
    $uid = uc_user_register($userName, $password, $email, '', '', $_G['clientip']);
    if ($uid <= 0) {
        if ($uid == -1) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_invalid_char'))));
        } elseif ($uid == -2) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_invalid_char'))));
        } elseif ($uid == -3) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_used'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_used'))));
        } elseif ($uid == -4) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'invalid_email'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_email'))));
        } elseif ($uid == -5) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'invalid_email'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_email'))));
        } elseif ($uid == -6) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'email_used'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email_used'))));
        }
        die(0);
    }
    $_G['username'] = $userName;
    $password = md5(random(10));
    if ($setregip !== null) {
        if ($setregip == 1) {
            C::t('common_regip')->update_count_by_ip($_G['clientip']);
        } else {
            C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp']));
        }
    }
    $profile = $verifyarr = array();
    $emailstatus = 0;
    $init_arr = array('credits' => explode(',', $ctlObj->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus);
    C::t('common_member')->insert($uid, $userName, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
    if ($ctlObj->setting['regctrl'] || $ctlObj->setting['regfloodctrl']) {
        C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($ctlObj->setting['regctrl'] > 72 ? $ctlObj->setting['regctrl'] : 72) * 3600);
        if ($ctlObj->setting['regctrl']) {
            C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
        }
    }
    if ($ctlObj->setting['regverify'] == 1) {
        $idstring = random(6);
        $authstr = $ctlObj->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : '';
        C::t('common_member_field_forum')->update($uid, array('authstr' => $authstr));
        $verifyurl = "{$_G[siteurl]}member.php?mod=activate&amp;uid={$uid}&amp;id={$idstring}";
        $email_verify_message = lang('email', 'email_verify_message', array('username' => $username, 'bbname' => $ctlObj->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl));
        if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) {
            runlog('sendmail', "{$email} sendmail failed.");
        }
    }
    require_once libfile('cache/userstats', 'function');
    build_cache_userstats();
    $_GET['regmessage'] = 'from bigapp client';
    $regmessage = dhtmlspecialchars($_GET['regmessage']);
    if ($ctlObj->setting['regverify'] == 2) {
        C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => $regmessage, 'remark' => ''), false, true);
        manage_addnotify('verifyuser');
    }
    setloginstatus(array('uid' => $uid, 'username' => $_G['username'], 'password' => $password, 'groupid' => $groupinfo['groupid']), 0);
    include_once libfile('function/stat');
    updatestat('register');
    checkfollowfeed();
    C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
    ////////////////////////////////////////////////
    // 注册成功,绑定第三方openid
    $plat = $_GET["platform"];
    if ($plat == "qq") {
        include_once CUR_PATH . "/../qqconnect/bind.php";
    } else {
        if ($plat == "wechat") {
            include_once CUR_PATH . "/../wechatconnect/bind.php";
        }
    }
    ////////////////////////////////////////////////
    echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => lang('plugin/bigapp', 'regist_succ'), 'Message' => array('messageval' => 'register_succeed', 'messagestr' => lang('plugin/bigapp', 'regist_succ')), 'Variables' => array('auth' => 'in order to be comapatible')));
    die(0);
}
Ejemplo n.º 23
0
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<link rel="stylesheet" type="text/css"  href="index.css" />
</head>

<body>

<div id="wtop">
		<div id="left">
			<img src="images/htlogo.gif" width="356" height="60" border="0" alt="瑞欣网络" />
		</div>
		<div id="center">管理员:<?php 
echo @$_SESSION['user'][1];
?>
 &nbsp;&nbsp;上次登录地址: <?php 
echo @convertip($_SESSION['user'][3]);
?>
&nbsp;&nbsp;上次登录时间:<?php 
echo date('Y-m-d H:i:s', @$_SESSION['user'][2]);
?>
</div>
		<div id="right">
			<a href="logout.php" target="_top"></a>
		</div>
	</div>
</body>
</html>
Ejemplo n.º 24
0
function chackmobile($mobile)
{
    global $_G;
    $mobile_array = explode(",", $_G['cache']['plugin']['smstong']['blackmobile']);
    if (in_array($mobile, $mobile_array)) {
        return lang('plugin/smstong', 'smstong_blackmobile_existed');
    }
    if ($_G['cache']['plugin']['smstong']['areacons'] == "0") {
        return true;
    }
    if (empty($_G['cache']['plugin']['smstong']['areavalue'])) {
        return true;
    }
    $checkmobile = false;
    if (!empty($_G['cache']['plugin']['smstong']['areaconstime'])) {
        $now = dgmdate(TIMESTAMP, 'G.i');
        foreach (explode("\r\n", str_replace(':', '.', $_G['cache']['plugin']['smstong']['areaconstime'])) as $period) {
            list($periodbegin, $periodend) = explode('-', $period);
            if ($periodbegin > $periodend && ($now >= $periodbegin || $now < $periodend) || $periodbegin < $periodend && $now >= $periodbegin && $now < $periodend) {
                $checkmobile = true;
            }
        }
    } else {
        $checkmobile = true;
    }
    if ($_G['cache']['plugin']['smstong']['areacons'] == "1" && $checkmobile) {
        $checkurl = "http://www.ip138.com:8080/search.asp?action=mobile&mobile=" . $mobile;
        $result = httprequest($checkurl);
        $checkresult = "";
        $errormsg = lang('plugin/smstong', 'smstong_checkmobile_error');
        $result = strip_tags($result);
        $result = preg_replace('/\\s/', '', $result);
        switch ($_G['cache']['plugin']['smstong']['areatype']) {
            case 1:
                if ($_G['charset'] == "gbk") {
                    preg_match(lang('plugin/smstong', 'smstong_mobilearea_ip138'), $result, $area);
                    $checkresult = $area[2];
                } else {
                    preg_match(lang('plugin/smstong', 'smstong_mobilearea_ip138'), iconv("gbk", "utf-8", $result), $area);
                    $checkresult = $area[2];
                }
                $errormsg = lang('plugin/smstong', 'smstong_checkmobile_default') . $_G['cache']['plugin']['smstong']['areavalue'] . lang('plugin/smstong', 'smstong_checkmobile_areatype_city');
                break;
            case 2:
                if ($_G['charset'] == "gbk") {
                    preg_match(lang('plugin/smstong', 'smstong_mobilearea_ip138'), $result, $area);
                    $checkresult = $area[1];
                } else {
                    preg_match(lang('plugin/smstong', 'smstong_mobilearea_ip138'), iconv("gbk", "utf-8", $result), $area);
                    $checkresult = $area[1];
                }
                $errormsg = lang('plugin/smstong', 'smstong_checkmobile_default') . $_G['cache']['plugin']['smstong']['areavalue'] . lang('plugin/smstong', 'smstong_checkmobile_areatype_province');
                break;
            default:
                if ($_G['charset'] == "gbk") {
                    preg_match(lang('plugin/smstong', 'smstong_mobilearea_ip138'), $result, $area);
                    $checkresult = $area[2];
                } else {
                    preg_match(lang('plugin/smstong', 'smstong_mobilearea_ip138'), iconv("gbk", "utf-8", $result), $area);
                    $checkresult = $area[2];
                }
                $errormsg = lang('plugin/smstong', 'smstong_checkmobile_default') . $_G['cache']['plugin']['smstong']['areavalue'] . lang('plugin/smstong', 'smstong_checkmobile_areatype_city');
                break;
        }
        $area_array = explode("|", $_G['cache']['plugin']['smstong']['areavalue']);
        $flag1 = false;
        $flag2 = false;
        if (in_array($checkresult, $area_array)) {
            $flag1 = true;
        }
        if ($_G['cache']['plugin']['smstong']['ipareacons'] == "1") {
            require_once libfile('function/misc');
            $iparea = trim(trim(convertip($_G['clientip']), '-'));
            foreach ($area_array as $k => $v) {
                if (strstr($iparea, $v)) {
                    $flag2 = true;
                    break;
                }
            }
        } else {
            $flag2 = true;
        }
        if ($flag1 && $flag2) {
            return true;
        }
    } else {
        return true;
    }
    return $errormsg;
}
Ejemplo n.º 25
0
 if (!$_GET['ipact']) {
     if (!submitcheck('ipbansubmit')) {
         require_once libfile('function/misc');
         $iptoban = explode('.', getgpc('ip'));
         $ipbanned = '';
         foreach (C::t('common_banned')->fetch_all_order_dateline() as $banned) {
             for ($i = 1; $i <= 4; $i++) {
                 if ($banned["ip{$i}"] == -1) {
                     $banned["ip{$i}"] = '*';
                 }
             }
             $disabled = $_G['adminid'] != 1 && $banned['admin'] != $_G['member']['username'] ? 'disabled' : '';
             $banned['dateline'] = dgmdate($banned['dateline'], 'Y-m-d');
             $banned['expiration'] = dgmdate($banned['expiration'], 'Y-m-d');
             $theip = "{$banned['ip1']}.{$banned['ip2']}.{$banned['ip3']}.{$banned['ip4']}";
             $ipbanned .= showtablerow('', array('class="td25"'), array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$banned['id']}]\" value=\"{$banned['id']}\" {$disabled} />", $theip, convertip($theip, "./"), $banned[admin], $banned[dateline], "<input type=\"text\" class=\"txt\" size=\"10\" name=\"expirationnew[{$banned['id']}]\" value=\"{$banned['expiration']}\" {$disabled} />"), TRUE);
         }
         shownav('user', 'nav_members_ipban');
         showsubmenu('nav_members_ipban', array(array('nav_members_ipban', 'members&operation=ipban', 1), array('nav_members_ipban_output', 'members&operation=ipban&ipact=input', 0)));
         showtips('members_ipban_tips');
         showformheader('members&operation=ipban');
         showtableheader();
         showsubtitle(array('', 'ip', 'members_ipban_location', 'operator', 'start_time', 'end_time'));
         echo $ipbanned;
         showtablerow('', array('', 'class="td28" colspan="3"', 'class="td28" colspan="2"'), array($lang['add_new'], '<input type="text" class="txt" name="ip1new" value="' . $iptoban[0] . '" size="3" maxlength="3">.<input type="text" class="txt" name="ip2new" value="' . $iptoban[1] . '" size="3" maxlength="3">.<input type="text" class="txt" name="ip3new" value="' . $iptoban[2] . '" size="3" maxlength="3">.<input type="text" class="txt" name="ip4new" value="' . $iptoban[3] . '" size="3" maxlength="3">', $lang['validity'] . ': <input type="text" class="txt" name="validitynew" value="30" size="3"> ' . $lang['days']));
         showsubmit('ipbansubmit', 'submit', 'del');
         showtablefooter();
         showformfooter();
     } else {
         if (!empty($_GET['delete'])) {
             C::t('common_banned')->delete_by_id($_GET['delete'], $_G['adminid'], $_G['username']);
Ejemplo n.º 26
0
function AdminResponse() {
    global $db, $config,$lang;
    $objResponse = new xajaxResponse('utf-8');
    $departmentid = $_SESSION['cel_departmentid'];
    $sql = "SELECT `id`,`name`,`ip`,`timestamp` FROM `" . $config['prefix'] . "sessions` WHERE `departmentid`='" . $departmentid . "' AND `status`='0' ORDER BY `id` ASC";
    @$result = $db->my_fetch_array($sql);
    $text = '';
    for ($i = 0; $i < count($result); $i++) {
        $sessionid = $result[$i]['id'];
        $name = $result[$i]['name'];
        $ip = $result[$i]['ip'];
        $ip = convertip($ip);
        $time = date('Y-m-d H:i:s',$result[$i]['timestamp']);
        $_SESSION['adminthislive'] = md5(time() . $sessionid);
        $_SESSION['adminthislivetmp'] = $_SESSION['adminthislive'];
        $text = "<div class=\"response_t\">&nbsp;&nbsp;&nbsp;<input name='id' id='id' class='checkbox' type='checkbox' value='".$sessionid."' />&nbsp;" . $name . "&nbsp;&nbsp;&nbsp;&nbsp;" . $ip . "&nbsp;&nbsp;申请时间:".$time."&nbsp;&nbsp;<span1>[<a href=\"../admin/live/?action=1&module=celive&thislive=" . $_SESSION['adminthislive'] . "&sessionid=" . $sessionid . "\" target=\"_blank\">".$lang['accept']."</a>] [<a href=\"javascript:\" onclick=\"xajax_AdminDecline(" . $sessionid . ");\">".$lang['close']."</a></a>]</span1></div>" . $text;
    }
    if (isset($_SESSION['cel_r'])) {
        $r = $_SESSION['cel_r'];
    } else {
        $r = '0';
    }
    $sound = $_SESSION['cel_sound'];
    if ($sound == '1') {
        $soundR = 'true';
    } else {
        $soundR = 'false';
    }
    @$r = $_SESSION['cel_r'];
    $sql = "SELECT `id` FROM `" . $config['prefix'] . "sessions` WHERE `departmentid`='" . $departmentid . "' AND `id`>'" . $r . "' AND `status`='0' ORDER BY `id` ASC";
    @$result2 = $db->my_fetch_array($sql);
    if (count($result2) != '0') {
        $text = $text . "<embed src=\"" . $config['url'] . "/include/sound/request.mp3\" id=\"mp3\" autostart=\"" . $soundR . "\" hidden=\"true\">";
        $j = count($result2) - 1;
        $r = $result2[$j]['id'];
        $_SESSION['cel_r'] = $r;
        $objResponse->script('window.focus();');
    }
    $objResponse->addAssign('response', 'innerHTML', $text);
    return $objResponse;
}
Ejemplo n.º 27
0
            showmessage('register_disable_activation');
        }
    } elseif (!$_G['setting']['regstatus']) {
        showmessage(!$_G['setting']['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $_G['setting']['regclosemessage']));
    }
}
$inviteconfig = array();
$query = DB::query("SELECT * FROM " . DB::table('common_setting') . " WHERE skey IN ('bbrules', 'bbrulesforce', 'bbrulestxt', 'welcomemsg', 'welcomemsgtitle', 'welcomemsgtxt', 'inviteconfig')");
while ($setting = DB::fetch($query)) {
    ${$setting}['skey'] = $setting['svalue'];
}
if ($_G['setting']['regverify']) {
    if ($_G['setting']['areaverifywhite']) {
        $location = $whitearea = '';
        require_once libfile('function/misc');
        $location = trim(convertip($_G['clientip'], "./"));
        if ($location) {
            $whitearea = preg_quote(trim($_G['setting']['areaverifywhite']), '/');
            $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
            $whitearea = '.*' . $whitearea . '.*';
            $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
            if (@preg_match($whitearea, $location)) {
                $_G['setting']['regverify'] = 0;
            }
        }
    }
    if ($_G['cache']['ipctrl']['ipverifywhite']) {
        foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) {
            if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                $_G['setting']['regverify'] = 0;
                break;
Ejemplo n.º 28
0
     }
     $query = DB::query('SELECT * FROM ' . tname('spacecomments') . ' WHERE cid=\'' . $upcid . '\' AND status=\'1\'');
     if ($comment = DB::fetch($query)) {
         $comment['floornum'] += 1;
         if ($comment['floornum'] == 1) {
             $comment['firstcid'] = $comment['cid'];
         }
     } else {
         $upcid = 0;
     }
 }
 if ($comment['floornum']) {
     $comment['hideauthor'] = !empty($comment['hideauthor']) && !empty($_G['setting']['commanonymous']) ? 1 : 0;
     $comment['hideip'] = !empty($comment['hideip']) && !empty($_G['setting']['commhideip']) ? 1 : 0;
     $comment['hidelocation'] = !empty($comment['hidelocation']) && !empty($_G['setting']['commhidelocation']) ? 1 : 0;
     $comment['iplocation'] = str_replace(array('-', ' '), '', convertip($comment['ip']));
     $comment['ip'] = preg_replace("/^(\\d{1,3})\\.(\\d{1,3})\\.\\d{1,3}\\.\\d{1,3}\$/", "\$1.\$2.*.*", $comment['ip']);
     $html = '<div id="cid_{cid}_' . $comment['floornum'] . '_title" class="old_title"><span class="author">' . $_G['setting']['sitename'];
     if (!$comment['hidelocation']) {
         $html .= $comment['iplocation'] != 'LAN' ? $comment['iplocation'] : $lang['mars'];
     }
     $html .= $lang['visitor'];
     if (!empty($comment['authorid']) && !$comment['hideauthor']) {
         $html .= " [{$comment['author']}] ";
     }
     if (!$comment['hideip']) {
         $html .= " ({$comment['ip']}) ";
     }
     $html .= $lang['from_the_original_note'] . '</span><span class="color_red">' . $comment['floornum'] . '</span></div>';
     $comment['message'] = str_replace('<div class="new"', $html . '<div id="cid_{cid}_' . $comment['floornum'] . '_detail" class="detail"', $comment['message']);
     $comment['message'] = '<div id="cid_{cid}_' . $comment['floornum'] . '" class="old">' . $comment['message'] . '</div>';
Ejemplo n.º 29
0
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: topicadmin_getip.php 20099 2011-02-15 01:55:29Z monkey $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if (!$_G['group']['allowviewip']) {
    showmessage('no_privilege_viewip');
}
$pid = $_G['gp_pid'];
$posttable = getposttablebytid($_G['tid']);
$member = DB::fetch_first("SELECT m.adminid, p.first, p.useip FROM " . DB::table($posttable) . " p\r\n\t\t\tLEFT JOIN " . DB::table('common_member') . " m ON m.uid=p.authorid\r\n\t\t\tWHERE p.pid='{$pid}' AND p.tid='{$_G['tid']}'");
if (!$member) {
    showmessage('thread_nonexistence', NULL);
} elseif ($member['adminid'] == 1 && $_G['adminid'] > 1 || $member['adminid'] == 2 && $_G['adminid'] > 2) {
    showmessage('admin_getip_nopermission', NULL);
}
$member['iplocation'] = convertip($member['useip']);
include template('forum/topicadmin_getip');
Ejemplo n.º 30
0
function convertSubjectandIP($value, $viewlink = '')
{
    global $lang;
    if ($viewlink) {
        $result = '<h3>' . $viewlink . '</h3>';
    } else {
        $result = '<h3><a title="' . $lang['security_clicktotoggle'] . '" href="javascript:;" onclick="return toggle_mod(\'mod_' . $value['tid'] . '_row_' . $value['pid'] . '\');" target="_blank">' . $value['subject'] . '</a></h3>';
    }
    $result .= '<p>' . $value['useip'] . ' ' . convertip($value['useip']) . ' ( pid : ' . $value['pid'] . ' )</p>';
    if (!$value['message']) {
        return $lang['security_postdeleted'] . "(tid:{$value['tid']} pid:{$value['pid']})";
    }
    return $result;
}