Exemple #1
0
function cvipfrom($ip, $txt = null)
{
    if ($ip == 'Unknown') {
        return 'Unknown';
    }
    $d_ip = explode('.', $ip);
    if ($txt != '0.txt') {
        $onlineip = $ip;
        $ip = substr($ip, strpos($ip, '.') + 1);
        $txt = $d_ip[0] . '.txt';
        $d_ip[0] = $d_ip[1];
        $d_ip[1] = $d_ip[2];
        $d_ip[2] = $d_ip[3];
        $d_ip[3] = '';
    }
    if ($db = @fopen(R_P . 'ipdata/' . $txt, 'rb')) {
        flock($db, LOCK_SH);
        $f = $l_d = '';
        $d = "\n" . fread($db, filesize(R_P . 'ipdata/' . $txt));
        $wholeIP = $d_ip[0] . '.' . $d_ip[1] . '.' . $d_ip[2];
        $d_ip[3] && ($wholeIP .= '.' . $d_ip[3]);
        $wholeIP = str_replace('255', '*', $wholeIP);
        if (($s = strpos($d, "\n{$wholeIP}\t")) !== false) {
            fseek($db, $s, SEEK_SET);
            $l_d = substr(fgets($db, 100), 0, -1);
            fclose($db);
            $ip_a = explode("\t", $l_d);
            $ip_a[3] && ($ip_a[2] .= ' ' . $ip_a[3]);
            return $ip_a[2];
        }
        $ip = d_ip($d_ip);
        while (!$f && !$l_d && $wholeIP) {
            if (($s = strpos($d, "\n" . $wholeIP . '.')) !== false) {
                list($l_d, $f) = s_ip($db, $s, $ip);
                if ($f) {
                    return $f;
                }
                while ($l_d && preg_match("/^\n{$wholeIP}/i", "\n" . $l_d) !== false) {
                    list($l_d, $f) = s_ip($db, $s, $ip, $l_d);
                    if ($f) {
                        return $f;
                    }
                }
            }
            if (strpos($wholeIP, '.') !== false) {
                $wholeIP = substr($wholeIP, 0, strrpos(substr($wholeIP, 0, -1), '.'));
            } else {
                if ($txt == '0.txt') {
                    return 'Unknown';
                }
                $wholeIP--;
            }
        }
        fclose($db);
    }
    if ($txt != '0.txt') {
        $f = cvipfrom($onlineip, '0.txt');
        if (!$f) {
            return 'Unknown';
        }
        return $f;
    }
    return 'Unknown';
}
Exemple #2
0
     $refer = "post.php?action=reply&tid={$tid}&tmp={$timestamp}";
     wap_header('post', $db_bbsname);
     require_once PrintEot('wap_post');
     wap_footer();
 } else {
     if (!$tp['ifcheck']) {
         wap_msg('reply_ifcheck');
     }
     if ($tp['locked'] > 0) {
         wap_msg("reply_lockatc");
     }
     InitGP(array('subject', 'content'), 'P', 0);
     wap_check($fid, 'reply');
     $subject = wap_cv($subject);
     $content = wap_cv($content);
     $ipfrom = Char_cv(cvipfrom($onlineip));
     $pw_posts = GetPtable($tp['ptable']);
     if ($db_plist && count($db_plist) > 1) {
         $db->update("INSERT INTO pw_pidtmp(pid) values('')");
         $pid = $db->insert_id();
     } else {
         $pid = '';
     }
     $db->update("INSERT INTO {$pw_posts}" . " SET " . pwSqlSingle(array('pid' => $pid, 'tid' => $tid, 'fid' => $fid, 'ifcheck' => 1, 'subject' => $subject, 'author' => $windid, 'authorid' => $winduid, 'postdate' => $timestamp, 'userip' => $onlineip, 'ipfrom' => $ipfrom, 'content' => $content)));
     !$pid && ($pid = $db->insert_id());
     $db->update("UPDATE pw_threads" . " SET " . pwSqlSingle(array('lastpost' => $timestamp, 'lastposter' => $windid)) . ",replies=replies+1,hits=hits+1" . " WHERE tid=" . pwEscape($tid));
     #增加高楼索引
     if ($openIndex && $pid) {
         $db->update("INSERT INTO pw_postsfloor SET pid=" . pwEscape($pid) . ", tid=" . pwEscape($tid));
     }
     # memcache refresh
Exemple #3
0
    $pagemin = min(($page - 1) * $db_perpage, $count - 1);
    $pagemax = min($pagemin + $db_perpage - 1, $count - 1);
    $pages = numofpage($count, $page, $numofpage, "{$basename}&");
    require_once R_P . 'require/postfunc.php';
    $inbbsdb = array();
    for ($i = $pagemin; $i <= $pagemax; $i++) {
        if (!trim($todayshow[$i])) {
            continue;
        }
        list($inbbs['user'], $null1, $null2, $inbbs['rgtime'], $inbbs['logintime'], $inbbs['intime'], $inbbs['ip'], $inbbs['post'], $inbbs['rvrc'], $null) = explode("\t", $todayshow[$i]);
        $inbbs['rawuser'] = rawurlencode($inbbs['user']);
        $inbbs['rvrc'] = floor($inbbs['rvrc'] / 10);
        $inbbs['rgtime'] = get_date($inbbs['rgtime']);
        $inbbs['logintime'] = get_date($inbbs['logintime']);
        $inbbs['intime'] = get_date($inbbs['intime']);
        $inbbs['ipfrom'] = cvipfrom($inbbs['ip']);
        $inbbsdb[] = $inbbs;
    }
    include PrintEot('viewtoday');
    exit;
}
adminmsg('operate_success');
function fseeks($fp, $dbtdsize, $seed)
{
    $break = $num = 0;
    while ($break != 1 && $num < $seed) {
        $num++;
        $sdata = fread($fp, $dbtdsize);
        $sdb = explode("\t", $sdata);
        $sdbnext = $sdb[2] * $dbtdsize;
        if ($sdbnext != 'NULL') {